@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600&family=Montserrat:wght@300;400;500;600&family=Cairo:wght@300;400;500;600;700&display=swap');

:root {
  --cream: #FDFAF5;
  --cream-dark: #F5EFE4;
  --gold: #B8924A;
  --gold-light: #D4AF70;
  --gold-dark: #8A6A30;
  --ink: #1E1A16;
  --ink-soft: #4A3F35;
  --ink-muted: #8A7F74;
  --border: rgba(184,146,74,0.2);
  --border-soft: rgba(30,26,22,0.08);
  --white: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(30,26,22,0.04);
  --shadow-md: 0 8px 24px rgba(184,146,74,0.08);
  --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Cairo', sans-serif;
  background: var(--cream-dark);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
}
.serif-title { font-family: 'Playfair Display', serif; }

/* ──────── SIDEBAR ──────── */
.sidebar {
  width: 260px;
  background: var(--white);
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-brand {
  padding: 32px 24px;
  border-bottom: 1px solid var(--border-soft);
  text-align: center;
}
.sidebar-brand h2 {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 4px;
}
.sidebar-brand span {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--gold);
  text-transform: uppercase;
}
.sidebar-nav {
  padding: 24px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 15px;
  transition: all var(--transition);
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover, .nav-item.active {
  background: var(--cream);
  color: var(--gold);
}
.nav-item.active {
  background: rgba(184,146,74,0.08);
  font-weight: 600;
}
.sidebar-footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border-soft);
}
.back-to-store { color: var(--ink); }

/* ──────── MAIN CONTENT ──────── */
.main-content {
  flex: 1;
  margin-right: 260px;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 72px;
  background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-muted);
}
.topbar-search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  width: 250px;
}
.admin-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-avatar {
  width: 36px; height: 36px;
  background: var(--gold);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
}
.admin-info { display: flex; flex-direction: column; }
.admin-name { font-size: 13px; font-weight: 600; }
.admin-role { font-size: 10px; color: var(--ink-muted); }

.content-wrapper {
  padding: 40px;
}
.admin-section { display: none; }
.admin-section.active { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header { margin-bottom: 32px; }
.section-header h1 { font-size: 28px; margin-bottom: 4px; }
.section-header p { color: var(--ink-muted); font-size: 14px; }
.flex-between { display: flex; justify-content: space-between; align-items: flex-end; }

/* ──────── STATS GRID ──────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-soft);
}
.stat-icon {
  width: 48px; height: 48px;
  background: rgba(184,146,74,0.1);
  color: var(--gold);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-label { display: block; font-size: 13px; color: var(--ink-muted); margin-bottom: 4px; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 600; color: var(--ink); }

/* ──────── CARDS & TABLES ──────── */
.card-panel {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.table-responsive { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}
.admin-table th {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 16px 24px;
  background: var(--cream);
  border-bottom: 1px solid var(--border-soft);
}
.admin-table td {
  padding: 16px 24px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-soft);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(253,250,245,0.5); }

/* ──────── BADGES ──────── */
.badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge.pending { background: #FFF3E0; color: #E65100; }
.badge.processing { background: #E3F2FD; color: #1565C0; }
.badge.shipped { background: #E8F5E9; color: #2E7D32; }

/* ──────── BUTTONS ──────── */
.btn-primary {
  background: var(--ink);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--transition);
}
.btn-primary:hover { background: var(--gold); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-soft);
  padding: 10px 20px;
  border-radius: 6px;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--ink); }
.btn-text {
  background: none; border: none; color: var(--gold);
  font-weight: 600; font-family: 'Cairo', sans-serif; cursor: pointer;
}
.btn-icon { background: none; border: none; cursor: pointer; color: var(--ink-muted); }
.btn-icon:hover { color: var(--ink); }

/* ──────── MODAL ──────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(30,26,22,0.6);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; justify-content: center; align-items: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-panel {
  background: var(--white); border-radius: 16px;
  width: 90%; max-width: 500px;
  transform: translateY(20px); transition: transform 0.3s;
  max-height: 90vh; overflow-y: auto;
}
.modal-panel.large { max-width: 700px; }
.modal-overlay.open .modal-panel { transform: translateY(0); }
.modal-header {
  padding: 24px; border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 24px; }

/* ──────── FORMS ──────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group.full-width { grid-column: span 2; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--ink);
}
.form-control {
  width: 100%; padding: 12px 16px;
  border: 1px solid var(--border-soft); border-radius: 8px;
  font-family: 'Cairo', sans-serif; font-size: 14px;
  outline: none; transition: border-color 0.3s;
}
.form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,146,74,0.1); }
.sizes-checkboxes { display: flex; flex-wrap: wrap; gap: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.mt-4 { margin-top: 24px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--border-soft); padding-top: 24px; }

/* ──────── FILTERS ──────── */
.filter-tabs { display: flex; gap: 8px; }
.tab-btn {
  padding: 8px 16px; border-radius: 20px; background: var(--cream);
  border: 1px solid var(--border-soft); font-family: 'Cairo', sans-serif;
  font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: all 0.2s;
}
.tab-btn.active, .tab-btn:hover { background: var(--gold); color: var(--white); border-color: var(--gold); }

/* ──────── LOGIN SCREEN ──────── */
body.not-logged-in .sidebar,
body.not-logged-in .main-content {
  display: none !important;
}
body.not-logged-in .login-screen {
  display: flex;
}
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--cream-dark);
  background: radial-gradient(circle at center, var(--cream) 0%, var(--cream-dark) 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.login-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(184,146,74,0.12);
  border: 1px solid var(--border);
  width: 90%;
  max-width: 420px;
  padding: 40px;
  animation: fadeIn 0.5s ease;
}
.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-brand h2 {
  font-size: 36px;
  color: var(--ink);
  margin-bottom: 6px;
}
.login-brand span {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--gold);
  text-transform: uppercase;
}

/* ──────── ORDER ACTIONS ──────── */
.order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}
.btn-deliver {
  background: #E8F5E9;
  color: #2E7D32;
}
.btn-deliver:hover {
  background: #2E7D32;
  color: var(--white);
}
.btn-ship {
  background: #E3F2FD;
  color: #1565C0;
}
.btn-ship:hover {
  background: #1565C0;
  color: var(--white);
}
.btn-cancel {
  background: #FFEBEE;
  color: #C62828;
}
.btn-cancel:hover {
  background: #C62828;
  color: var(--white);
}

/* ──────── BANNERS GRID ──────── */
.banner-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.banner-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.banner-preview {
  height: 160px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.banner-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(30,26,22,0.85);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.banner-badge.active {
  background: var(--gold);
}
.banner-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.banner-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.banner-info p {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 12px;
}
.banner-link-text {
  font-size: 11px;
  color: var(--gold);
  font-family: 'Montserrat', sans-serif;
  word-break: break-all;
  margin-bottom: 16px;
}
.banner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}

/* ──────── SHIPPING & COMPANIES ──────── */
.company-card {
  cursor: pointer;
  transition: all 0.3s ease;
}
.company-card:hover {
  border-color: var(--gold) !important;
  transform: translateY(-2px);
}
.badge.completed,
.badge.delivered {
  background: #E8F5E9;
  color: #2E7D32;
}
.badge.confirmed {
  background: #E8EAF6;
  color: #283593;
}

/* Wilaya Table Inputs */
.wilaya-fee-input {
  width: 90px;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  outline: none;
  text-align: center;
  transition: all 0.2s;
}
.wilaya-fee-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(184,146,74,0.1);
}

