/* ============================================================
   Al Basad Admin Panel — Design System
   ============================================================ */

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

:root {
  --sage:    #2C4C3B;
  --clay:    #C97B5A;
  --sand:    #F5F0E8;
  --olive:   #6B7C5C;
  --white:   #FFFFFF;
  --red:     #DC2626;
  --green:   #16A34A;
  --amber:   #D97706;
  --border:  #E2DCCF;
  --sidebar-w: 240px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--sand);
  color: var(--sage);
  min-height: 100vh;
  display: flex;
}

a { text-decoration: none; color: inherit; }

/* -----------------------------------------------
   Layout
----------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sage);
  color: var(--sand);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--sand);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo span { color: var(--clay); }

.sidebar-admin {
  padding: 16px 24px;
  font-size: 0.75rem;
  color: rgba(245,240,232,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-admin strong { display: block; color: var(--sand); font-size: 0.85rem; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(245,240,232,0.7);
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.07);
  color: var(--sand);
  border-left-color: var(--clay);
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: rgba(245,240,232,0.5);
}
.sidebar-footer a:hover { color: var(--clay); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 36px 40px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* -----------------------------------------------
   Page header
----------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-title { font-family: 'Playfair Display', serif; font-size: 1.75rem; font-weight: 600; }
.page-subtitle { font-size: 0.875rem; color: var(--olive); margin-top: 2px; }

/* -----------------------------------------------
   Cards / Stats
----------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}
.stat-card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
}
.stat-card .label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--olive); }
.stat-card .value { font-size: 2rem; font-weight: 700; margin-top: 8px; color: var(--sage); }
.stat-card .sub { font-size: 0.75rem; color: var(--olive); margin-top: 4px; }

/* -----------------------------------------------
   Tables
----------------------------------------------- */
.table-wrap {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.table-wrap th {
  text-align: left;
  padding: 14px 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--olive);
  background: rgba(44,76,59,0.04);
  border-bottom: 1px solid var(--border);
}
.table-wrap td {
  padding: 14px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: rgba(44,76,59,0.02); }

/* -----------------------------------------------
   Buttons
----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}
.btn-primary   { background: var(--clay); color: white; }
.btn-primary:hover { background: #b36852; }
.btn-secondary { background: var(--sage); color: white; }
.btn-secondary:hover { background: #1e3527; }
.btn-outline   { background: transparent; color: var(--sage); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--sage); }
.btn-danger    { background: #fef2f2; color: var(--red); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn svg { width: 16px; height: 16px; }

/* -----------------------------------------------
   Forms
----------------------------------------------- */
.form-card {
  background: var(--white);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 32px;
  margin-bottom: 24px;
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--olive);
  margin-bottom: 8px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: var(--sage);
  background: var(--sand);
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--clay); background: white; }
.form-group textarea { min-height: 140px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row label { font-weight: 600; font-size: 0.9rem; }
.toggle-row small { display: block; color: var(--olive); font-size: 0.78rem; }
.toggle {
  position: relative;
  width: 48px; height: 26px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--clay); }
.toggle input:checked + .toggle-slider:before { transform: translateX(22px); }

/* -----------------------------------------------
   Image upload dropzone
----------------------------------------------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--sand);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--clay); background: rgba(201,123,90,0.05); }
.dropzone svg { width: 40px; height: 40px; color: var(--olive); margin-bottom: 12px; }
.dropzone p { color: var(--olive); font-size: 0.875rem; }
.dropzone strong { color: var(--clay); }
.dropzone-preview { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.dropzone-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 10px; }

/* -----------------------------------------------
   Badges / Status
----------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-clay   { background: rgba(201,123,90,0.15); color: var(--clay); }
.badge-olive  { background: rgba(107,124,92,0.15); color: var(--olive); }
.badge-amber  { background: #fef3c7; color: var(--amber); }
.badge-gray   { background: #f1f5f9; color: #64748b; }

/* -----------------------------------------------
   Alerts / Toasts
----------------------------------------------- */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  z-index: 9999;
  display: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  max-width: 320px;
}
#toast.success { background: var(--green); display: block; }
#toast.error   { background: var(--red);   display: block; }

/* -----------------------------------------------
   Modal / Dialog
----------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 20px;
  padding: 36px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { font-family: 'Playfair Display', serif; font-size: 1.3rem; margin-bottom: 12px; }
.modal p { color: var(--olive); font-size: 0.9rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* -----------------------------------------------
   Login page (index.html)
----------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sage);
}
.login-card {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--sage);
}
.login-logo p { color: var(--olive); font-size: 0.85rem; margin-top: 4px; }
.login-error {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* -----------------------------------------------
   Member / Gallery grid
----------------------------------------------- */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}
.member-card {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 20px;
  text-align: center;
}
.member-card img {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  display: block;
  background: var(--sand);
}
.member-card .name { font-weight: 600; font-size: 0.875rem; }
.member-card .role { color: var(--clay); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; margin-top: 2px; }
.member-card .actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}
.gallery-item:hover .overlay { opacity: 1; }

/* -----------------------------------------------
   Utility
----------------------------------------------- */
.text-clay { color: var(--clay); }
.text-olive { color: var(--olive); }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: 700; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--clay);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
