/* ═══════════════════════════════════════════════════════════════
   CursuriPro – Admin Panel Stylesheet
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF6FF;
  --sidebar-bg: #0F172A;
  --sidebar-hover: #1E293B;
  --sidebar-active: #2563EB;
  --sidebar-text: #94A3B8;
  --sidebar-text-active: #FFFFFF;
  --bg: #F1F5F9;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-muted: #64748B;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --shadow-lg: 0 4px 6px -1px rgba(0,0,0,.1);
  --radius: 10px;
  --font: 'Poppins', system-ui, sans-serif;
  --sidebar-width: 240px;
}

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

body { font-family: var(--font); color: var(--text); background: var(--bg); }
img { max-width: 100%; }
a { text-decoration: none; }
ul { list-style: none; }

/* ─── LOGIN ──────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #0F172A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-page { width: 100%; max-width: 400px; }

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0,0,0,.3);
  padding: 40px;
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 3rem; margin-bottom: 8px; }
.login-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.login-header p { font-size: 0.85rem; color: var(--text-muted); }

.login-form .form-group { margin-bottom: 20px; }
.login-form label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.login-form label i { color: var(--primary); font-size: 0.8rem; }

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  transition: all .2s;
  outline: none;
  color: var(--text);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.password-wrap { position: relative; }
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .2s;
  margin-top: 8px;
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }

.login-back { text-align: center; margin-top: 20px; }
.login-back a { font-size: 0.83rem; color: var(--text-muted); }
.login-back a:hover { color: var(--primary); }

/* ─── LAYOUT ─────────────────────────────────────────────────── */
.admin-body { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  display: block;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 10px 4px;
  margin-top: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .2s;
  position: relative;
}

.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-link:hover { background: var(--sidebar-hover); color: white; }
.sidebar-link.active { background: var(--primary); color: white; }
.sidebar-link.logout-link { color: #F87171; margin-top: 8px; }
.sidebar-link.logout-link:hover { background: rgba(239,68,68,.15); color: #FCA5A5; }

.sidebar-badge {
  margin-left: auto;
  background: #EF4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

/* ─── MAIN ───────────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.topbar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-muted);
  display: none;
  font-size: 1rem;
}
.topbar-toggle:hover { background: var(--bg); }

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.topbar-user i { color: var(--primary); }

.topbar-user a {
  width: 32px;
  height: 32px;
  background: #FEE2E2;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #DC2626;
  font-size: 0.85rem;
  transition: all .2s;
}
.topbar-user a:hover { background: #DC2626; color: white; }

.admin-content { padding: 28px 28px 40px; }

/* ─── STATS CARDS ────────────────────────────────────────────── */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card-admin {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: all .2s;
}

.stat-card-admin.blue { border-left-color: #2563EB; }
.stat-card-admin.green { border-left-color: #10B981; }
.stat-card-admin.purple { border-left-color: #7C3AED; }
.stat-card-admin.orange { border-left-color: #F59E0B; }

.stat-card-admin:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-card-admin.blue .stat-card-icon { background: #EFF6FF; color: #2563EB; }
.stat-card-admin.green .stat-card-icon { background: #ECFDF5; color: #10B981; }
.stat-card-admin.purple .stat-card-icon { background: #F5F3FF; color: #7C3AED; }
.stat-card-admin.orange .stat-card-icon { background: #FFFBEB; color: #F59E0B; }

.stat-card-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin: 3px 0; }
.stat-card-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ─── QUICK ACTIONS ──────────────────────────────────────────── */
.admin-section { margin-bottom: 24px; }
.admin-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all .2s;
  text-decoration: none;
}

.quick-action-btn i { font-size: 1.1rem; }
.quick-action-btn.blue { background: #EFF6FF; color: #2563EB; }
.quick-action-btn.green { background: #ECFDF5; color: #059669; }
.quick-action-btn.orange { background: #FFFBEB; color: #D97706; }
.quick-action-btn.purple { background: #F5F3FF; color: #7C3AED; }
.quick-action-btn:hover { filter: brightness(0.95); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ─── DASHBOARD GRID ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ─── ADMIN CARD ─────────────────────────────────────────────── */
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.admin-card:last-child { margin-bottom: 0; }

.admin-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-card-header h3 i { color: var(--primary); }

.admin-link { font-size: 0.82rem; color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.admin-link:hover { text-decoration: underline; }

.admin-card-body { padding: 20px; }
.admin-card-body.p-0 { padding: 0; }

/* ─── TOOLBAR ────────────────────────────────────────────────── */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left h2 { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.record-count { font-size: 0.78rem; color: var(--text-muted); background: var(--bg); padding: 3px 12px; border-radius: 999px; font-weight: 500; }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-admin-primary { background: var(--primary); color: white; }
.btn-admin-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-admin-secondary { background: var(--bg); color: var(--text-muted); }
.btn-admin-secondary:hover { background: var(--border); }

.btn-admin.btn-lg { padding: 12px 24px; font-size: 0.92rem; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all .2s;
  font-weight: 500;
}
.btn-back:hover { background: var(--bg); color: var(--text); }

/* Action buttons */
.action-buttons { display: flex; gap: 6px; align-items: center; }

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
}

.btn-action.blue { background: #EFF6FF; color: #2563EB; }
.btn-action.blue:hover { background: #2563EB; color: white; }
.btn-action.red { background: #FEF2F2; color: #DC2626; }
.btn-action.red:hover { background: #DC2626; color: white; }
.btn-action.gray { background: var(--bg); color: var(--text-muted); }
.btn-action.gray:hover { background: var(--border); color: var(--text); }

/* ─── TABLE ──────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table.admin-table-full { min-width: 700px; }

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #FAFBFC; }

.row-unpublished td { opacity: 0.6; }

.course-cell strong { display: block; font-size: 0.87rem; font-weight: 600; }
.course-cell small { color: var(--text-muted); font-size: 0.75rem; }

/* ─── STATUS BADGES ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
}

.status-pending { background: #FFFBEB; color: #92400E; }
.status-confirmed { background: #ECFDF5; color: #065F46; }
.status-cancelled { background: #FEF2F2; color: #991B1B; }

.status-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background: var(--white);
}

.type-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 4px;
}
.type-badge.adult { background: #EFF6FF; color: #1D4ED8; }
.type-badge.child { background: #F5F3FF; color: #6D28D9; }

.flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 0.75rem;
  margin-right: 2px;
}
.flag-badge.gold { background: #FFFBEB; color: #D97706; }
.flag-badge.blue { background: #EFF6FF; color: #2563EB; }

/* ─── FILTER TABS ────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--white);
  padding: 6px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-tab:hover { background: var(--bg); color: var(--text); }
.filter-tab.active { background: var(--primary); color: white; }
.filter-tab.pending.active { background: #D97706; }
.filter-tab.confirmed.active { background: #059669; }
.filter-tab.cancelled.active { background: #DC2626; }

.tab-count {
  background: rgba(255,255,255,.25);
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.7rem;
}
.filter-tab:not(.active) .tab-count { background: var(--bg); color: var(--text-muted); }

/* ─── FORMS ──────────────────────────────────────────────────── */
.admin-form { margin-top: 0; }

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.form-column { display: flex; flex-direction: column; gap: 0; }
.form-column .admin-card { margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.help-text {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 4px;
  display: block;
}

.required { color: #EF4444; }

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--white);
  transition: all .2s;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-textarea { resize: vertical; }
.code-textarea { font-family: 'Consolas', monospace; font-size: 0.82rem; }

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

.slug-input-wrap { display: flex; align-items: center; }
.slug-prefix { padding: 10px 10px 10px 12px; background: var(--bg); border: 1.5px solid var(--border); border-right: none; border-radius: 7px 0 0 7px; font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.slug-input-wrap .form-input { border-radius: 0 7px 7px 0; }

.image-preview {
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  max-height: 180px;
}
.image-preview img { width: 100%; height: 180px; object-fit: cover; }

.mt-1 { margin-top: 6px; }
.mt-3 { margin-top: 16px; }

/* Toggle switches */
.toggle-group { display: flex; flex-direction: column; gap: 12px; }

.toggle-item .toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: #CBD5E1;
  border-radius: 999px;
  transition: background .2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

input[type="checkbox"]:checked + .toggle-switch { background: var(--primary); }
input[type="checkbox"]:checked + .toggle-switch::after { transform: translateX(18px); }
input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }

.checkbox-group { display: flex; gap: 20px; margin-top: 8px; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 500;
}

input[type="checkbox"].regular-cb {
  position: relative;
  width: 16px;
  height: 16px;
  opacity: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Color input */
.color-input-wrap { display: flex; gap: 8px; align-items: center; }
.form-color { width: 44px; height: 40px; padding: 4px; border-radius: 7px; border: 1.5px solid var(--border); cursor: pointer; }
.color-text { flex: 1; }

/* Form actions */
.form-actions { display: flex; gap: 12px; margin-top: 4px; }

/* ─── ALERTS ─────────────────────────────────────────────────── */
.admin-alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
}

.admin-alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.admin-alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ─── CATEGORIES PAGE ────────────────────────────────────────── */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  align-items: start;
}

.slug-code {
  font-family: monospace;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ─── MESSAGES ───────────────────────────────────────────────── */
.message-preview { color: var(--text-muted); font-size: 0.82rem; cursor: help; }
.message-full { font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; }

.show-more-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  font-family: var(--font);
  margin-top: 3px;
  display: block;
}
.show-more-btn:hover { text-decoration: underline; }

/* ─── MISC ───────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-link { color: var(--primary); font-size: inherit; }
.text-link:hover { text-decoration: underline; }

.empty-msg { text-align: center; padding: 32px; color: var(--text-muted); font-size: 0.87rem; }

.empty-state-admin {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state-admin i { margin-bottom: 16px; opacity: 0.35; display: block; }
.empty-state-admin h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state-admin p { font-size: 0.87rem; margin-bottom: 20px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .admin-main { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .sidebar-overlay.open { display: block; }
  .form-grid-2col { grid-template-columns: 1fr; }
  .two-col-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-cards { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 16px; }
  .filter-tabs { gap: 2px; }
  .filter-tab { padding: 7px 10px; font-size: 0.78rem; }
}

@media (max-width: 400px) {
  .stats-cards { grid-template-columns: 1fr; }
}
