/* ═══════════════════════════════════════════
   MERIDIAN — admin.css
   Admin panel styles
═══════════════════════════════════════════ */

.admin-page { min-height: 100vh; background: #f7f6f3; padding-top: var(--nav-h); display: flex; }

/* ── Sidebar ── */
.admin-sidebar {
  width: 230px; flex-shrink: 0; background: var(--deep);
  min-height: calc(100vh - var(--nav-h)); padding: 24px 0;
  position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}

.admin-sidebar-logo {
  padding: 0 20px 24px; border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 12px;
}
.admin-sidebar-logo span {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(200,169,110,.6); font-weight: 500;
}

.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; font-size: 13px; color: rgba(245,242,236,.5);
  cursor: pointer; transition: all .15s; border-left: 2px solid transparent;
}
.admin-nav-item:hover { color: rgba(245,242,236,.85); background: rgba(255,255,255,.04); }
.admin-nav-item.active {
  color: var(--paper); background: rgba(255,255,255,.07);
  border-left-color: var(--warm);
}
.admin-nav-item svg { flex-shrink: 0; opacity: .7; }
.admin-nav-item.active svg { opacity: 1; }

.admin-nav-section {
  font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(245,242,236,.25); padding: 18px 20px 6px;
}

/* ── Main content ── */
.admin-main { flex: 1; padding: 32px 40px; overflow-y: auto; }

.admin-page-title {
  font-family: 'Cormorant Garamond', serif; font-size: 30px;
  font-weight: 300; margin-bottom: 4px;
}
.admin-page-sub { font-size: 13px; color: var(--muted); margin-bottom: 28px; }

/* ── Metric cards ── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }

.metric-card {
  background: white; border: 1px solid var(--div); border-radius: 6px;
  padding: 20px 22px;
}
.metric-label { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
.metric-value {
  font-family: 'Cormorant Garamond', serif; font-size: 40px;
  font-weight: 300; line-height: 1; color: var(--ink);
}
.metric-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.metric-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; margin-top: 6px;
}
.metric-trend.up { color: var(--sage); }
.metric-trend.down { color: #c0392b; }

/* ── Charts row ── */
.admin-charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 28px; }
.admin-chart-box {
  background: white; border: 1px solid var(--div); border-radius: 6px; padding: 22px 24px;
}
.admin-chart-title { font-size: 13px; font-weight: 500; margin-bottom: 16px; }

/* ── Donut chart ── */
.donut-wrap { position: relative; width: 120px; height: 120px; margin: 0 auto 16px; }
.donut-wrap canvas { width: 100% !important; height: 100% !important; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut-pct { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 300; }
.donut-lbl { font-size: 10px; color: var(--muted); }

.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Tables ── */
.admin-table-wrap { background: white; border: 1px solid var(--div); border-radius: 6px; overflow: hidden; }
.admin-table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--div);
}
.admin-table-title { font-size: 14px; font-weight: 500; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 11px 16px; border-bottom: 1px solid var(--div);
  background: #faf9f6;
}
.admin-table td { padding: 13px 16px; font-size: 13px; border-bottom: 1px solid var(--div); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #faf9f6; }

/* ── User avatar in table ── */
.tbl-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--warm-l); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-family: 'Cormorant Garamond', serif;
  color: var(--warm); flex-shrink: 0; font-weight: 400;
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: .06em;
}
.badge-free    { background: #f0ede5; color: var(--muted); }
.badge-path    { background: rgba(200,169,110,.15); color: #7a5c1e; }
.badge-indiv   { background: rgba(30,43,26,.1); color: var(--deep); }
.badge-active  { background: rgba(122,140,110,.15); color: #3d5232; }
.badge-inactive { background: #f5e8e8; color: #8b2020; }

/* ── Content management (courses/meditations) ── */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.content-card {
  background: white; border: 1px solid var(--div); border-radius: 6px;
  padding: 18px 20px; position: relative;
}
.content-card-emoji { font-size: 28px; margin-bottom: 10px; }
.content-card-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.content-card-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.content-card-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.content-card-actions { display: flex; gap: 8px; margin-top: 14px; }

.btn-sm {
  padding: 7px 14px; font-size: 12px; border-radius: var(--radius);
  border: 1px solid var(--div); background: transparent;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all .15s; color: var(--ink);
}
.btn-sm:hover { border-color: var(--ink); }
.btn-sm.danger { color: #c0392b; border-color: rgba(192,57,43,.3); }
.btn-sm.danger:hover { background: rgba(192,57,43,.06); border-color: #c0392b; }
.btn-sm.primary { background: var(--ink); color: white; border-color: var(--ink); }
.btn-sm.primary:hover { background: var(--deep); }

/* ── Search bar ── */
.admin-search {
  display: flex; align-items: center; gap: 10px;
  background: white; border: 1px solid var(--div);
  border-radius: var(--radius); padding: 9px 14px;
  font-size: 13px; font-family: 'DM Sans', sans-serif; color: var(--ink);
  outline: none; width: 260px; transition: border-color .2s;
}
.admin-search:focus { border-color: var(--warm); }

/* ── Tabs (admin) ── */
.admin-tabs { display: flex; gap: 2px; margin-bottom: 20px; }
.admin-tab {
  padding: 9px 18px; font-size: 13px; background: white;
  border: 1px solid var(--div); border-radius: var(--radius);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all .15s; color: var(--muted);
}
.admin-tab.active { background: var(--ink); color: white; border-color: var(--ink); }

/* ── Inline meditation list in course card ── */
.med-list { margin-top: 12px; border-top: 1px solid var(--div); }
.med-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--div); font-size: 13px;
}
.med-list-item:last-child { border-bottom: none; }
.med-order { font-size: 11px; color: var(--muted); width: 20px; flex-shrink: 0; }
.med-list-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; transition: color .15s;
}
.icon-btn:hover { color: var(--ink); }
.icon-btn.danger:hover { color: #c0392b; }

/* ── Modal (admin) ── */
.admin-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(14,13,11,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.admin-modal.open { opacity: 1; pointer-events: all; }
.admin-modal-box {
  background: white; border-radius: 8px; padding: 32px 36px;
  width: 540px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
  transform: translateY(16px); transition: transform .2s;
}
.admin-modal.open .admin-modal-box { transform: translateY(0); }
.admin-modal-title { font-size: 18px; font-weight: 500; margin-bottom: 6px; }
.admin-modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; }

.form-row { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; display: block; }
.form-row .inp { font-size: 13px; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }

/* ── Upload area ── */
.upload-zone {
  border: 2px dashed var(--div); border-radius: 6px;
  padding: 28px; text-align: center; cursor: pointer;
  transition: all .2s; background: #faf9f6;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--warm); background: var(--warm-dim); }
.upload-zone-icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone p { font-size: 13px; color: var(--muted); }
.upload-zone strong { color: var(--ink); }
.upload-file-name { font-size: 12px; color: var(--sage); margin-top: 8px; font-weight: 500; }

/* ── Pagination ── */
.admin-pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; justify-content: flex-end; }
.page-btn {
  width: 32px; height: 32px; border: 1px solid var(--div); border-radius: var(--radius);
  background: white; cursor: pointer; font-size: 13px; font-family: 'DM Sans', sans-serif;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.page-btn:hover { border-color: var(--ink); }
.page-btn.active { background: var(--ink); color: white; border-color: var(--ink); }

/* ── Color picker for category ── */
.color-preview {
  width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--div);
  cursor: pointer; flex-shrink: 0;
}
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] { opacity: 0; position: absolute; pointer-events: none; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .admin-sidebar { display: none; }
  .admin-main { padding: 20px 16px; }
  .content-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
