/* ==========================================================================
   MEXOR COMMAND SUITE & CUSTOMER PORTAL
   Based on Behbar-Admin Architecture — Tailored for Haute Parfumerie
   Powered by Pinar Typeface
   ========================================================================== */

@font-face {
  font-family: 'Pinar';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/pinar/Epic Pinar-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Pinar';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/pinar/Epic Pinar-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Pinar';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../assets/fonts/pinar/Epic Pinar-Black.woff2') format('woff2');
}

:root {
  /* Behbar Dark Emerald & Mexor Luxury Palette */
  --bg-app: #0D130F;
  --bg-surface: #141C16;
  --bg-card: #1A241D;
  --bg-card-hover: #222F26;
  --bg-elevated: #28372D;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(197, 155, 99, 0.28);
  --border-gold-strong: #C59B63;

  --text-main: #F4EFE6;
  --text-muted: #95A198;
  --text-dim: #647268;

  --gold: #C59B63;
  --gold-glow: rgba(197, 155, 99, 0.2);
  --clay: #B5562F;
  --emerald: #2ECC71;
  --emerald-glow: rgba(46, 204, 113, 0.2);
  --red: #E74C3C;
  --blue: #3498DB;

  --font-pinar: 'Pinar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  font-family: var(--font-pinar) !important;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

/* TOPBAR */
.admin-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(20, 28, 22, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold) 0%, #8C6A37 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px var(--gold-glow);
}

.admin-brand-info {
  display: flex;
  flex-direction: column;
}

.admin-brand-title {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--text-main);
  line-height: 1.2;
}

.admin-brand-desc {
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 600;
}

/* Behbar Live Status Pill */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background-color: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-live 1.8s infinite ease-in-out;
}

@keyframes pulse-live {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Quick Nav Tabs */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-card);
  padding: 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s var(--ease);
}

.nav-tab:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-tab.is-active {
  background: linear-gradient(135deg, var(--gold) 0%, #9B763F 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--gold-glow);
}

/* Topbar End Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Switcher between Store Admin & Customer Lounge */
.portal-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  background-color: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.portal-switch-btn:hover {
  background-color: var(--gold);
  color: #fff;
}

.btn-back-site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.25s;
}

.btn-back-site:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* MAIN STAGE */
.admin-stage {
  flex-grow: 1;
  padding: 32px 28px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* Header of views */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-header-title h1 {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.2;
}

.view-header-title p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* KPI CARDS GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.kpi-card:hover::after {
  opacity: 1;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.kpi-footer {
  font-size: 0.75rem;
  color: var(--emerald);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

/* ANALYTICS SECTION */
.analytics-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.panel-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

/* SVG Chart Simulation */
.chart-container {
  width: 100%;
  height: 220px;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 44px;
  background: linear-gradient(180deg, var(--gold) 0%, rgba(197, 155, 99, 0.2) 100%);
  border-radius: 6px 6px 0 0;
  transition: height 0.6s var(--ease);
  position: relative;
}

.chart-bar:hover {
  filter: brightness(1.15);
}

.chart-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* DATA TABLES */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

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

.data-table th {
  background-color: var(--bg-card);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  background-color: var(--bg-surface);
  vertical-align: middle;
}

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

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-pending {
  background-color: rgba(217, 130, 43, 0.15);
  color: #E67E22;
  border: 1px solid rgba(217, 130, 43, 0.3);
}

.badge-processing {
  background-color: rgba(52, 152, 219, 0.15);
  color: #3498DB;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.badge-shipped {
  background-color: rgba(155, 89, 182, 0.15);
  color: #9B59B6;
  border: 1px solid rgba(155, 89, 182, 0.3);
}

.badge-delivered {
  background-color: rgba(46, 204, 113, 0.15);
  color: #2ECC71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.badge-gold {
  background: linear-gradient(135deg, rgba(197, 155, 99, 0.2) 0%, rgba(197, 155, 99, 0.05) 100%);
  color: var(--gold);
  border: 1px solid var(--border-gold);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.25s var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #9B763F 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-gold);
}

.btn-danger {
  background-color: rgba(231, 76, 60, 0.15);
  color: var(--red);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
  background-color: var(--red);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* MODALS */
dialog.panel-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 12, 0.75);
  backdrop-filter: blur(10px);
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

dialog.panel-modal[open] {
  display: flex;
}

.panel-modal-card {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

/* INVOICE STYLING */
.invoice-sheet {
  background: #FFFDF9;
  color: #1A221B;
  padding: 40px;
  border-radius: var(--radius-md);
  border: 2px solid #C59B63;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  font-family: var(--font-pinar);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px dashed #D6C29E;
  padding-bottom: 20px;
}

.invoice-stamp {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid #9A4423;
  color: #9A4423;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  transform: rotate(-8deg);
  opacity: 0.85;
}

/* CUSTOMER LOUNGE SPECIFIC */
.customer-hero {
  background: linear-gradient(135deg, var(--bg-surface) 0%, #1A261E 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 20px;
}

.vip-card-badge {
  background: linear-gradient(135deg, var(--gold) 0%, #8C6A37 100%);
  color: #fff;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }
  .admin-nav {
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px;
  }
  .admin-stage {
    padding: 20px 14px;
  }
}

/* MODAL & FORM ADDITIONS */
.modal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.modal-card-head h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  font-weight: 800;
}
.btn-close-modal {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-close-modal:hover {
  border-color: var(--gold);
  color: #fff;
}
.modal-card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}
.form-field input, .form-field select, .form-field textarea {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--gold);
}
.modal-card-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}
.btn-save {
  background: var(--gold);
  color: #0D130F;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:hover {
  opacity: 0.9;
}
.btn-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
}
.btn-cancel:hover {
  color: var(--text-main);
}
.tab-vip-gold {
  color: var(--gold) !important;
  border-color: rgba(197, 155, 99, 0.4) !important;
}
.tab-vip-gold:hover, .tab-vip-gold.is-active {
  background: rgba(197, 155, 99, 0.15) !important;
  color: #fff !important;
}
