/* ============================================================
   Troop 212 Merit Badge Tracker — Admin Styles
   ============================================================ */

:root {
  --sidebar-width:  240px;
  --sidebar-bg:     #1b5e20;
  --sidebar-hover:  #2e7d32;
  --sidebar-active: #43a047;
  --sidebar-text:   rgba(255,255,255,.88);
  --topbar-height:  56px;
  --content-bg:     #f5f5f5;
  --card-radius:    10px;
  --scout-green:    #1b5e20;
  --scout-green-mid:#2e7d32;
  --eagle-gold:     #f9a825;
}

/* ── Layout ── */
body.admin-body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
}

.admin-wrapper { display: flex; min-height: 100vh; }

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

.sidebar-brand {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  text-align: center;
}
.sidebar-brand .fleur { font-size: 2rem; }
.sidebar-brand h5 {
  color: #fff;
  margin: .3rem 0 .1rem;
  font-size: .95rem;
  font-weight: 700;
}
.sidebar-brand small { color: rgba(255,255,255,.6); font-size: .78rem; }

.sidebar-admin-info {
  padding: .6rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  font-size: .8rem;
  color: rgba(255,255,255,.6);
}
.sidebar-admin-info strong { color: rgba(255,255,255,.9); display: block; }

.sidebar-nav { list-style: none; padding: .5rem 0; margin: 0; flex: 1; }
.sidebar-nav li a,
.sidebar-nav li button {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1.1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .88rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-nav li a:hover,
.sidebar-nav li button:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav li a.active    { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-nav .nav-divider { height: 1px; background: rgba(255,255,255,.12); margin: .4rem 0; }
.sidebar-nav .nav-section-label {
  padding: .5rem 1.1rem .2rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.45);
}
.sidebar-nav li a .bi,
.sidebar-nav li button .bi { font-size: 1rem; width: 1.2rem; text-align: center; }

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

/* ── Top bar (mobile hamburger + breadcrumb) ── */
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.admin-topbar h6 { margin: 0; font-weight: 700; font-size: .95rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* ── Page content area ── */
.admin-page { padding: 1.5rem; flex: 1; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }

/* ── Cards ── */
.admin-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 6px rgba(0,0,0,.09);
  overflow: hidden;
}
.admin-card .card-header {
  background: #fafafa;
  border-bottom: 1px solid #e8e8e8;
  padding: .85rem 1.25rem;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Stat cards (dashboard) ── */
.stat-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 6px rgba(0,0,0,.09);
  padding: 1.25rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid var(--scout-green-mid);
}
.stat-card.eagle { border-left-color: var(--eagle-gold); }
.stat-card.counselors { border-left-color: #1565c0; }
.stat-card.admins { border-left-color: #6a1b9a; }
.stat-icon {
  font-size: 2rem;
  width: 48px;
  text-align: center;
  color: var(--scout-green-mid);
}
.stat-card.eagle .stat-icon { color: var(--eagle-gold); }
.stat-card.counselors .stat-icon { color: #1565c0; }
.stat-card.admins .stat-icon { color: #6a1b9a; }
.stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .82rem; color: #757575; }

/* ── Tables ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th {
  background: #f5f5f5;
  padding: .65rem .9rem;
  text-align: left;
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid #e0e0e0;
  white-space: nowrap;
}
.admin-table td {
  padding: .6rem .9rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }

.eagle-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: #fff8e1;
  border: 1px solid #f9a825;
  color: #b45309;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  white-space: nowrap;
}
.status-chip {
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
}
.status-active   { background: #e8f5e9; color: #2e7d32; }
.status-inactive { background: #fafafa; color: #9e9e9e; }

/* ── Forms ── */
.admin-form label { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--scout-green);
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--scout-green-light, #e8f5e9);
  margin-bottom: 1rem;
}
.badge-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .35rem;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: .75rem;
  background: #fafafa;
}
.badge-checkbox-grid .form-check { margin: 0; }
.badge-checkbox-grid .form-check-label { font-weight: 400; font-size: .85rem; cursor: pointer; }

/* Image preview */
.img-preview-wrap { margin-top: .5rem; }
.img-preview {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: .25rem;
  background: #f5f5f5;
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 60%, #43a047 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.login-card .login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-card .login-logo .fleur { font-size: 3rem; }
.login-card .login-logo h4 { font-weight: 800; color: #1b5e20; margin: .25rem 0 .1rem; }
.login-card .login-logo small { color: #757575; font-size: .85rem; }
.btn-login {
  background: #1b5e20;
  color: #fff;
  border: none;
  padding: .65rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  width: 100%;
  transition: background .15s;
}
.btn-login:hover { background: #2e7d32; color: #fff; }

/* ── Buttons ── */
.btn-scout {
  background: var(--scout-green-mid);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .45rem 1rem;
  font-weight: 600;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: background .15s;
  text-decoration: none;
  cursor: pointer;
}
.btn-scout:hover { background: var(--scout-green); color: #fff; }
.btn-scout-outline {
  background: #fff;
  color: var(--scout-green-mid);
  border: 2px solid var(--scout-green-mid);
  border-radius: 6px;
  padding: .4rem 1rem;
  font-weight: 600;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  transition: all .15s;
  cursor: pointer;
}
.btn-scout-outline:hover { background: #e8f5e9; color: var(--scout-green); }

/* ── Action icons in table rows ── */
.action-icons { display: flex; gap: .5rem; align-items: center; }
.action-icons a,
.action-icons button {
  padding: .25rem .5rem;
  border-radius: 4px;
  font-size: .82rem;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  transition: all .15s;
}
.btn-edit  { color: #1565c0; border-color: #bbdefb; }
.btn-edit:hover  { background: #e3f2fd; color: #0d47a1; }
.btn-del   { color: #c62828; border-color: #ffcdd2; }
.btn-del:hover   { background: #ffebee; color: #b71c1c; }

/* ── Search bar in admin lists ── */
.admin-search { max-width: 320px; }

/* ── Mobile sidebar toggle ── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #424242;
  cursor: pointer;
  padding: .25rem .5rem;
}

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
}
