/* ========================================================
   TOFAAH COLLECTIVE — SHOPIFY-GRADE ADMIN DASHBOARD CSS
   Luxury Polaris + Forest Gold Theme
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --admin-bg: #09130e;
  --admin-sidebar: #0f1d16;
  --admin-card: #14261d;
  --admin-card-border: rgba(201, 168, 76, 0.18);
  --admin-card-hover: #193125;
  --admin-text: #e8ece9;
  --admin-text-muted: #8e9e95;
  --admin-gold: #c9a84c;
  --admin-gold-light: #ecd599;
  --admin-gold-glow: rgba(201, 168, 76, 0.15);
  
  --status-paid-bg: rgba(16, 185, 129, 0.15);
  --status-paid-text: #34d399;
  --status-pending-bg: rgba(245, 158, 11, 0.15);
  --status-pending-text: #fbbf24;
  --status-shipped-bg: rgba(59, 130, 246, 0.15);
  --status-shipped-text: #60a5fa;
  --status-delivered-bg: rgba(139, 92, 246, 0.15);
  --status-delivered-text: #a78bfa;
  --status-cancelled-bg: rgba(239, 68, 68, 0.15);
  --status-cancelled-text: #f87171;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--admin-bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--admin-gold);
}

/* ─── AUTH SCREEN ─── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(circle at 50% 20%, #152c20 0%, #09130e 70%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--admin-sidebar);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px var(--admin-gold-glow);
  text-align: center;
}

.auth-logo {
  max-width: 160px;
  margin: 0 auto 1.5rem;
  display: block;
}

.auth-badge {
  display: inline-block;
  background: var(--admin-gold-glow);
  color: var(--admin-gold);
  border: 1px solid rgba(201, 168, 76, 0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.auth-subtitle {
  color: var(--admin-text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.auth-input-group {
  text-align: left;
  margin-bottom: 1.25rem;
}

.auth-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--admin-gold-light);
  margin-bottom: 0.4rem;
}

.auth-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 0.9rem;
  transition: all 0.2s;
  outline: none;
}
.auth-input:focus {
  border-color: var(--admin-gold);
  box-shadow: 0 0 0 3px var(--admin-gold-glow);
}

.btn-admin-primary {
  width: 100%;
  background: var(--admin-gold);
  color: #0b1812;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-admin-primary:hover {
  background: var(--admin-gold-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(201, 168, 76, 0.25);
}

.auth-quick-login {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--admin-text-muted);
}
.quick-login-btn {
  background: transparent;
  border: 1px dashed var(--admin-gold);
  color: var(--admin-gold-light);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  margin-top: 0.6rem;
  transition: all 0.2s;
}
.quick-login-btn:hover {
  background: var(--admin-gold-glow);
  color: #fff;
}

/* ─── ADMIN DASHBOARD SHELL ─── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar);
  border-right: 1px solid var(--admin-card-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
  height: 38px;
  object-fit: contain;
}

.sidebar-store-badge {
  font-size: 0.68rem;
  background: rgba(201, 168, 76, 0.12);
  color: var(--admin-gold);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--admin-text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: var(--admin-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  text-decoration: none;
  font-size: 0.88rem;
}
.nav-item:hover {
  background: var(--admin-card);
  color: #ffffff;
}
.nav-item.active {
  background: var(--admin-gold-glow);
  color: var(--admin-gold-light);
  font-weight: 600;
  border-left: 3px solid var(--admin-gold);
}
.nav-item-icon {
  font-size: 1.15rem;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-badge {
  margin-left: auto;
  background: var(--admin-gold);
  color: #0b1812;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--admin-gold);
  color: #0b1812;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.admin-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}
.admin-user-role {
  font-size: 0.7rem;
  color: var(--admin-text-muted);
}
.logout-btn {
  background: none;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}
.logout-btn:hover {
  color: #f87171;
}

/* ─── MAIN CONTENT AREA ─── */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--admin-bg);
}

/* ─── TOP BAR ─── */
.admin-topbar {
  height: 64px;
  background: rgba(15, 29, 22, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--admin-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: #fff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-storefront {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(201, 168, 76, 0.12);
  color: var(--admin-gold-light);
  border: 1px solid rgba(201, 168, 76, 0.35);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-storefront:hover {
  background: var(--admin-gold);
  color: #0b1812;
}

/* ─── VIEW PANELS ─── */
.admin-content {
  padding: 2rem;
  flex: 1;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* ─── KPI GRID ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 168, 76, 0.4);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}
.kpi-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--admin-text-muted);
}
.kpi-icon {
  font-size: 1.25rem;
  opacity: 0.75;
}
.kpi-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.kpi-trend.up {
  color: #34d399;
}
.kpi-trend.down {
  color: #f87171;
}
.kpi-sub {
  color: var(--admin-text-muted);
  font-weight: 400;
  margin-left: 0.25rem;
}

/* ─── SECTION CARDS & DATA TABLES ─── */
.panel-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.panel-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: #ffffff;
}
.panel-desc {
  font-size: 0.82rem;
  color: var(--admin-text-muted);
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  color: #fff;
  font-size: 0.85rem;
  min-width: 220px;
  outline: none;
}
.search-input:focus {
  border-color: var(--admin-gold);
}

.filter-select {
  background: var(--admin-sidebar);
  border: 1px solid var(--admin-card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ─── DATA TABLE ─── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  color: var(--admin-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--admin-card-border);
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--admin-card-hover);
}

/* ─── STATUS PILLS ─── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-status.paid {
  background: var(--status-paid-bg);
  color: var(--status-paid-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-status.pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-status.shipped {
  background: var(--status-shipped-bg);
  color: var(--status-shipped-text);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-status.delivered {
  background: var(--status-delivered-bg);
  color: var(--status-delivered-text);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.badge-status.cancelled {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled-text);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ─── ACTION BUTTONS ─── */
.action-btn-group {
  display: flex;
  gap: 0.4rem;
}
.btn-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--admin-text);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action:hover {
  background: var(--admin-gold);
  color: #0b1812;
  border-color: var(--admin-gold);
}
.btn-action.danger:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* ─── MODAL DRAWERS & POPUPS ─── */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.admin-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-box {
  width: 100%;
  max-width: 600px;
  background: var(--admin-sidebar);
  border: 1px solid var(--admin-gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 35px var(--admin-gold-glow);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--admin-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-modal-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: #ffffff;
}
.modal-close-icon {
  background: none;
  border: none;
  color: var(--admin-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close-icon:hover {
  color: #fff;
}

.admin-modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.admin-modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
}

/* ─── TOAST NOTIFICATION ─── */
.admin-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #11221a;
  border: 1px solid var(--admin-gold);
  color: #fff;
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.88rem;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    left: -260px;
    transition: left 0.3s ease;
  }
  .admin-sidebar.open {
    left: 0;
  }
}
