/* ─────────────────────────────────────────────
   Almost Fit — Global Design System
───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,600&display=swap');

:root {
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --bg-dark: #050b18;
  --bg-card: #0d1528;
  --bg-glass: rgba(13, 21, 40, 0.72);
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --teal-glow: rgba(13, 148, 136, 0.25);
  --gold: #d97706;
  --red: #dc2626;
  --green: #16a34a;
  --text-primary: #f0f4ff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(255,255,255,0.06);
  --border-teal: rgba(13,148,136,0.4);
  --sidebar-w: 268px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 8px 32px rgba(0,0,0,0.22);
  --shadow-teal: 0 4px 28px var(--teal-glow);
  --transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

/* Light mode */
[data-theme="light"] {
  --bg-dark: #f0f4f8;
  --bg-card: #ffffff;
  --bg-glass: rgba(255,255,255,0.8);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border: rgba(0,0,0,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--teal); border-radius: 3px; }

/* ── Typography ── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.25rem); font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 700; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 600; font-size: 0.875rem; cursor: pointer;
  border: none; text-decoration: none;
  transition: var(--transition); white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--teal), #0f766e);
  color: white; box-shadow: var(--shadow-teal);
}
.btn-primary:hover { box-shadow: 0 6px 20px var(--teal-glow); }
.btn-outline {
  background: transparent; color: var(--teal);
  border: 1px solid var(--border-teal);
}
.btn-outline:hover { background: var(--teal-glow); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b45309);
  color: #0f172a; font-weight: 600;
}
.btn-danger { background: var(--red); color: white; padding: 8px 20px; }
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-icon { padding: 10px; border-radius: 50%; width: 40px; height: 40px; justify-content: center; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { border-color: var(--border-teal); }

/* Focus (pages without theme override still get visible focus) */
.btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-teal { background: var(--teal-glow); color: var(--teal-light); border: 1px solid var(--border-teal); }
.badge-gold { background: rgba(245,158,11,0.15); color: var(--gold); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--green); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text-secondary); font-size: 0.9rem; }
.form-control {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.95rem; font-family: inherit;
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-glow); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-card); }

[data-theme="light"] .form-control {
  background: #ffffff;
  border-color: rgba(30, 27, 75, 0.2);
  color: var(--text-primary);
}

[data-theme="light"] .form-label {
  color: #334155;
}

/* ── Media Input (Cloudinary + URL) ── */
.media-input-group { display: flex; flex-direction: column; gap: 10px; }
.media-tabs { display: flex; gap: 4px; margin-bottom: 4px; }
.media-tab {
  padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); color: var(--text-secondary);
  background: transparent; transition: var(--transition);
}
.media-tab.active { background: var(--teal); color: white; border-color: var(--teal); }
.media-upload-area {
  border: 2px dashed var(--border-teal); border-radius: var(--radius-sm);
  padding: 20px; text-align: center; cursor: pointer;
  transition: var(--transition); color: var(--text-secondary);
}
.media-upload-area:hover { background: var(--teal-glow); color: var(--teal-light); }
.media-preview { max-width: 200px; max-height: 150px; border-radius: 8px; margin-top: 8px; }
.upload-progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 8px; display: none; }
.upload-progress-bar { height: 100%; background: var(--teal); width: 0; transition: width 0.3s; }

/* ── Toast Notifications ── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-weight: 500;
  box-shadow: var(--shadow); max-width: 360px;
  animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 10px;
}
.toast-msg { flex: 1; font-size: 0.9rem; }
.toast-success { border-left: 4px solid var(--green); }
.toast-error { border-left: 4px solid var(--red); }
.toast-info { border-left: 4px solid var(--teal); }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }

/* ── Expiry Banner ── */
.expiry-banner {
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(245,158,11,0.1));
  border: 1px solid rgba(239,68,68,0.4); border-radius: var(--radius-sm);
  padding: 14px 20px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.expiry-banner.warning { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.08); }

/* ── Section header ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  text-align: center; transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-teal); }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--teal-light); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Table ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text-secondary); }
tr:hover td { background: rgba(255,255,255,0.02); }

[data-theme="light"] tr:hover td {
  background: rgba(79, 70, 229, 0.06);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; max-width: 540px; width: 100%;
  transform: scale(0.9); transition: var(--transition);
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.4rem; }

/* ── Utility ── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-teal { color: var(--teal-light); }
.text-gold { color: var(--gold); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
