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

/* ── VARIABLES ── */
:root {
  --bg:           #F2ECDA;
  --bg2:          #EAE3CE;
  --bg3:          #E0D9C5;
  --text:         #36332f;
  --text2:        #6b5e4b;
  --text3:        #9a8a78;
  --gold:         #D3C9B5;
  --gold2:        #BAAA91;
  --gold3:        #8B6914;
  --card-cat:     #554C41;
  --card-cat2:    #4a4238;
  --card-meal:    #FFFFFF;
  --card-meal2:   #F8F4EC;
  --border:       rgba(54,51,47,0.12);
  --shadow:       rgba(54,51,47,0.1);
  --shadow2:      rgba(54,51,47,0.2);
  --radius:       14px;
  --radius-sm:    8px;
  --transition:   0.3s ease;
}

[data-theme="dark"] {
  --bg:           #111111;
  --bg2:          #1a1a1a;
  --bg3:          #222222;
  --text:         #D3C9B5;
  --text2:        #9a8e7e;
  --text3:        #6b605a;
  --gold:         #D3C9B5;
  --gold2:        #BAAA91;
  --gold3:        #C0A060;
  --card-cat:     #201F1F;
  --card-cat2:    #2a2929;
  --card-meal:    #36332f;
  --card-meal2:   #2e2b28;
  --border:       rgba(211,201,181,0.1);
  --shadow:       rgba(0,0,0,0.3);
  --shadow2:      rgba(0,0,0,0.5);
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

[lang="en"] body,
[lang="en"] .font-body { font-family: 'Josefin Sans', sans-serif; }
[lang="en"] .font-heading { font-family: 'Cormorant Garamond', serif; }
[lang="ar"] .font-heading { font-family: 'Amiri', serif; }

/* ── HEADER ── */
.site-header {
  background: var(--card-cat);
  position: sticky; top: 0; z-index: 200;
  border-bottom: 1px solid rgba(211,201,181,0.15);
  box-shadow: 0 2px 24px var(--shadow2);
}

.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 1.5rem;
  height: 70px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}

.logo-area {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}

.logo-img {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--gold2);
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px; font-weight: 600;
  color: var(--gold);
  line-height: 1.1; letter-spacing: 1px;
}
.brand-slogan {
  font-size: 11px; color: var(--gold2);
  letter-spacing: 0.5px; opacity: 0.85;
}

.header-controls { display: flex; align-items: center; gap: 8px; }

.ctrl-btn {
  background: rgba(211,201,181,0.1);
  border: 1px solid rgba(211,201,181,0.25);
  color: var(--gold);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.ctrl-btn:hover { background: rgba(211,201,181,0.2); border-color: rgba(211,201,181,0.4); }
.ctrl-btn.active { background: rgba(211,201,181,0.25); }

.theme-btn { font-size: 16px; padding: 6px 10px; }

/* ── MAIN CONTENT ── */
.main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── PAGE HERO ── */
.page-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  margin-bottom: 1rem;
}
.page-hero h1 {
  font-family: 'Amiri', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
[lang="en"] .page-hero h1 { font-family: 'Cormorant Garamond', serif; }
.page-hero .divider {
  width: 80px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold2), transparent);
  margin: 1rem auto;
}
.page-hero p { color: var(--text2); font-size: 15px; }

/* ── SECTION TITLE ── */
.section-title {
  font-family: 'Amiri', serif;
  font-size: 1.6rem; font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.5rem;
}
[lang="en"] .section-title { font-family: 'Cormorant Garamond', serif; }

/* ── CATEGORY GRID ── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.cat-card {
  background: var(--card-cat);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid rgba(211,201,181,0.08);
  text-decoration: none;
  display: flex; flex-direction: column;
  gap: 0.5rem;
  position: relative; overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold2), var(--gold3), var(--gold2));
  opacity: 0;
  transition: opacity var(--transition);
}
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px var(--shadow2); }
.cat-card:hover::before { opacity: 1; }

.cat-icon {
  font-size: 2rem; margin-bottom: 0.25rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.cat-name {
  font-family: 'Amiri', serif;
  font-size: 1.2rem; font-weight: 700;
  color: var(--card-cat-text, #D3C9B5);
  line-height: 1.3;
}
[lang="en"] .cat-name { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; }
.cat-count {
  font-size: 12px;
  color: var(--gold2);
  opacity: 0.8;
}
.cat-arrow {
  margin-top: auto;
  color: var(--gold2);
  font-size: 18px;
  opacity: 0.6;
  transition: opacity var(--transition), transform var(--transition);
}
.cat-card:hover .cat-arrow { opacity: 1; transform: translateX(-4px); }
[lang="en"] .cat-card:hover .cat-arrow { transform: translateX(4px); }

/* ── BACK BUTTON ── */
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card-cat);
  color: var(--gold);
  border: 1px solid rgba(211,201,181,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  margin-bottom: 1.5rem;
  font-family: inherit;
}
.back-btn:hover { background: var(--card-cat2); border-color: rgba(211,201,181,0.4); }

/* ── CATEGORY HEADER ── */
.cat-header {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card-cat);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  border: 1px solid rgba(211,201,181,0.1);
}
.cat-header-icon { font-size: 2.5rem; }
.cat-header-text h2 {
  font-family: 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--gold);
}
[lang="en"] .cat-header-text h2 { font-family: 'Cormorant Garamond', serif; }
.cat-header-text p { color: var(--gold2); font-size: 13px; margin-top: 2px; }

/* ── ITEMS GRID ── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.item-card {
  background: var(--card-meal);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
}
.item-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }

.item-info { flex: 1; min-width: 0; }
.item-name {
  font-size: 15px; font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}
.item-desc {
  font-size: 12px; color: var(--text3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem; font-weight: 600;
  color: var(--gold3);
  white-space: nowrap;
  flex-shrink: 0;
}
.item-currency { font-size: 11px; font-weight: 400; opacity: 0.7; }

/* ── LOADING ── */
.loading {
  text-align: center; padding: 4rem 1rem;
  color: var(--text3);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 4rem 1rem;
  color: var(--text3);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 1.5rem;
  left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--card-cat);
  color: var(--gold);
  border: 1px solid rgba(211,201,181,0.25);
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  white-space: nowrap;
  box-shadow: 0 8px 24px var(--shadow2);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(99,200,80,0.3); }
.toast.error { border-color: rgba(220,80,80,0.3); color: #e57373; }

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 13px;
}
.site-footer span { color: var(--gold2); }

/* ── ADMIN LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--card-cat);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
  border: 1px solid rgba(211,201,181,0.15);
  box-shadow: 0 20px 60px var(--shadow2);
}
.login-logo {
  text-align: center; margin-bottom: 2rem;
}
.login-logo img { width: 80px; height: 80px; border-radius: 50%; border: 2px solid var(--gold2); }
.login-logo h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem; color: var(--gold);
  margin-top: 0.75rem;
}
.login-logo p { font-size: 13px; color: var(--gold2); opacity: 0.8; }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: 13px; color: var(--gold2); font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: rgba(211,201,181,0.08);
  border: 1px solid rgba(211,201,181,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--gold);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: rgba(211,201,181,0.5);
}
.form-group input::placeholder { color: rgba(211,201,181,0.3); }
.form-group select option { background: #36332f; color: #D3C9B5; }

.btn-primary {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--gold2), var(--gold3));
  border: none; border-radius: var(--radius-sm);
  color: #111; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity var(--transition), transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

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

.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--card-cat);
  border-left: 1px solid rgba(211,201,181,0.1);
  padding: 1.5rem 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
[lang="en"] .sidebar { border-left: none; border-right: 1px solid rgba(211,201,181,0.1); }

.sidebar-logo {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(211,201,181,0.1);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold2); }
.sidebar-logo span { font-family: 'Cormorant Garamond',serif; font-size: 16px; color: var(--gold); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 1.25rem;
  color: var(--gold2);
  font-size: 14px; cursor: pointer;
  transition: all var(--transition);
  border-right: 3px solid transparent;
}
[lang="en"] .nav-item { border-right: none; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(211,201,181,0.08); color: var(--gold); }
.nav-item.active { background: rgba(211,201,181,0.12); color: var(--gold); border-right-color: var(--gold2); }
[lang="en"] .nav-item.active { border-left-color: var(--gold2); border-right-color: transparent; }
.nav-icon { font-size: 16px; }

.admin-main { flex: 1; padding: 2rem; overflow-x: hidden; }

.admin-section { display: none; }
.admin-section.active { display: block; }

.admin-title {
  font-family: 'Amiri', serif;
  font-size: 1.5rem; color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
[lang="en"] .admin-title { font-family: 'Cormorant Garamond', serif; }

.btn-add {
  background: var(--gold2);
  color: #111;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity var(--transition);
}
.btn-add:hover { opacity: 0.85; }

/* ── DATA TABLE ── */
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--card-meal);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.data-table th {
  background: var(--card-cat);
  color: var(--gold2);
  padding: 12px 16px;
  text-align: right; font-size: 13px; font-weight: 500;
}
[lang="en"] .data-table th { text-align: left; }
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg2); }

.badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge-active { background: rgba(99,180,80,0.15); color: #5a9e45; }
.badge-inactive { background: rgba(200,80,80,0.15); color: #c05050; }

.action-btns { display: flex; gap: 6px; }
.btn-edit, .btn-delete {
  border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 12px;
  cursor: pointer; font-family: inherit;
  transition: opacity var(--transition);
}
.btn-edit { background: rgba(180,150,80,0.2); color: var(--gold3); }
.btn-delete { background: rgba(200,80,80,0.15); color: #c05050; }
.btn-edit:hover, .btn-delete:hover { opacity: 0.75; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%; max-width: 500px;
  border: 1px solid rgba(211,201,181,0.15);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title {
  font-family: 'Amiri', serif; font-size: 1.2rem; color: var(--text);
}
[lang="en"] .modal-title { font-family: 'Cormorant Garamond', serif; }
.modal-close {
  background: none; border: none;
  color: var(--text3); font-size: 20px;
  cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ── STATS CARDS ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--card-cat);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1rem;
  text-align: center;
  border: 1px solid rgba(211,201,181,0.08);
}
.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 600;
  color: var(--gold);
}
.stat-label { font-size: 12px; color: var(--gold2); margin-top: 4px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .header-inner { padding: 0 1rem; }
  .brand-slogan { display: none; }
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: 0.5rem; display: flex; gap: 0; }
  .sidebar-logo { display: none; }
  .nav-item { white-space: nowrap; border-right: none !important; border-bottom: 2px solid transparent; }
  .nav-item.active { border-bottom-color: var(--gold2) !important; }
  .admin-main { padding: 1rem; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .items-grid { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
  .modal { padding: 1.25rem; }
  .cat-header { padding: 1rem; }
}

/* ── ANIMATIONS ── */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.stagger > * { animation: fadeIn 0.4s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
