/* ============================================================
   IRON BLOSAM — Admin Dashboard Styles
   Overrides Bootstrap with the summer design system.
   Requires design.css to be loaded first (for tokens + fonts).
   ============================================================ */

/* ---- Base ---- */
body { font-family: var(--font-ui) !important; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display) !important;
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: -0.01em;
}
p, span, td, th, label, small { font-family: var(--font-ui); }

/* ---- Page layout ---- */
.ab-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ab-main {
  flex: 1;
  padding: 2rem 2rem 4rem;
}

/* ---- Admin Navbar ---- */
.ab-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 1.5rem;
  height: 60px;
  background: rgba(4, 14, 40, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.ab-nav-brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-right: 2rem;
  flex-shrink: 0;
}

.ab-nav-icon { font-size: 1.1rem; }

.ab-nav-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.ab-nav-sub {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(180, 215, 255, 0.6);
  align-self: center;
}

.ab-nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  flex: 1;
}

.ab-nav-link {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(210, 232, 255, 0.80);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  transition: color 180ms ease, background 180ms ease;
  white-space: nowrap;
}

.ab-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
}

.ab-nav-link-logout {
  color: rgba(255, 130, 120, 0.80);
  margin-left: auto;
}

.ab-nav-link-logout:hover {
  color: #ff9f96;
  background: rgba(255, 100, 90, 0.12);
}

/* ---- Flash alerts inside admin pages ---- */
.ab-alerts { margin-bottom: 1.5rem; }

/* ---- Bootstrap table overrides ---- */
.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
  --bs-table-color: var(--text-primary);
  --bs-table-striped-color: var(--text-primary);
  --bs-table-hover-color: var(--text-primary);
  --bs-table-border-color: rgba(255, 255, 255, 0.08);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(6, 22, 60, 0.65);
  border-radius: 0.875rem;
  overflow: hidden;
}

.table thead th {
  background: rgba(4, 14, 40, 0.85) !important;
  color: rgba(180, 215, 255, 0.75) !important;
  font-family: var(--font-ui) !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.10em !important;
  text-transform: uppercase !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 0.85rem 1rem !important;
}

.table tbody td {
  color: var(--text-primary) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  padding: 0.8rem 1rem !important;
  vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: rgba(255, 255, 255, 0.025);
}

.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: rgba(255, 255, 255, 0.06);
  cursor: default;
}

tr.clickable { cursor: pointer; }

/* Wrap table in a glass card */
.ab-table-wrap {
  background: rgba(6, 22, 60, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1rem;
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---- Bootstrap button overrides ---- */
.btn {
  font-family: var(--font-ui) !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  letter-spacing: 0.04em !important;
  border-radius: 0.6rem !important;
  padding: 0.4rem 0.9rem !important;
  transition: filter 180ms ease, transform 180ms ease, box-shadow 180ms ease !important;
}

.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(0) !important; }

.btn-primary {
  background: linear-gradient(135deg, #1260c4 0%, #1a80e0 55%, #48aaff 100%) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(24, 128, 220, 0.20) !important;
}

.btn-danger {
  background: rgba(200, 50, 50, 0.85) !important;
  border: none !important;
  color: #ffffff !important;
}

.btn-success {
  background: rgba(34, 150, 72, 0.85) !important;
  border: none !important;
  color: #ffffff !important;
}

.btn-warning {
  background: rgba(200, 150, 20, 0.85) !important;
  border: none !important;
  color: #ffffff !important;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: rgba(210, 232, 255, 0.85) !important;
}

.btn-info {
  background: rgba(30, 140, 200, 0.80) !important;
  border: none !important;
  color: #ffffff !important;
}

/* ---- Bootstrap form overrides ---- */
.form-control, .form-select {
  background: rgba(255, 255, 255, 0.10) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  font-family: var(--font-ui) !important;
  border-radius: var(--radius-input) !important;
}

.form-control::placeholder { color: rgba(180, 215, 255, 0.45) !important; }

.form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

.form-select option { background: #0c2d62; color: #ffffff; }

.form-floating label {
  color: rgba(180, 215, 255, 0.65) !important;
  font-family: var(--font-ui) !important;
  font-size: 0.9rem !important;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: rgba(210, 232, 255, 0.75) !important;
}

/* ---- Bootstrap alert overrides ---- */
.alert {
  font-family: var(--font-ui);
  border-radius: 0.75rem;
  border: 1px solid;
  font-size: 0.875rem;
}
.alert-danger  { background: rgba(255, 80, 70, 0.12) !important;  border-color: rgba(255, 112, 102, 0.30) !important; color: #ff9f96 !important; }
.alert-success { background: rgba(77, 204, 106, 0.12) !important; border-color: rgba(77, 204, 106, 0.30) !important;  color: #6ddc88 !important; }
.alert-warning { background: rgba(255, 200, 40, 0.12) !important; border-color: rgba(255, 200, 40, 0.30) !important;  color: #ffd050 !important; }
.alert-info    { background: rgba(100, 170, 255, 0.12) !important;border-color: rgba(100, 170, 255, 0.25) !important; color: #80b8ff !important; }
.text-muted, small.text-muted { color: var(--text-muted) !important; }
.text-warning { color: var(--warning) !important; }

/* ---- Bootstrap modal overrides ---- */
.modal-content {
  background: rgba(6, 22, 60, 0.96) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 1.25rem !important;
  color: #ffffff;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-family: var(--font-ui);
}

.modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
  padding: 1.25rem 1.5rem !important;
}

.modal-title {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  color: #ffffff !important;
}

.modal-body { padding: 1.25rem 1.5rem !important; }

.modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
  padding: 1rem 1.5rem !important;
}

.btn-close {
  filter: invert(1) opacity(0.6) !important;
}

.modal-backdrop { background-color: rgba(4, 14, 38, 0.7) !important; }

/* ---- Bootstrap card overrides (analytics page) ---- */
.card {
  background: rgba(6, 22, 60, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 1rem !important;
  color: var(--text-primary) !important;
  backdrop-filter: blur(12px);
}

.card-body { color: var(--text-primary); }

.text-primary { color: #48aaff !important; }
.text-success { color: var(--success) !important; }

/* Progress bars (analytics) */
.progress {
  background: rgba(255, 255, 255, 0.10) !important;
  border-radius: 999px !important;
  height: 0.6rem !important;
}

.progress-bar { border-radius: 999px !important; }

/* ---- Container adjustments ---- */
.container, .container-fluid {
  color: var(--text-primary);
}

/* ---- Page header row ---- */
.ab-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ab-page-header h1 {
  font-size: 1.8rem;
  margin: 0;
}

/* ---- Permissions panel (super-admin only; edit account page) ---- */
.perm-panel {
  border: 1px solid #dee2e6;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  /* The page inherits light text for the dark hero background; force dark text
     here so labels are readable on the white card. */
  color: #212529;
  margin-top: 1.5rem;
}

/* Every label/heading inside the panel reads on white. The base sheet forces
   headings to white via !important, so the h2 override must match it. */
.perm-panel h2 {
  color: #212529 !important;
}
.perm-panel .perm-area-name,
.perm-panel .form-check-label,
.perm-panel .perm-panel-sub,
.perm-panel .perm-note {
  color: #212529;
}

.perm-panel .perm-panel-sub,
.perm-panel .perm-hint,
.perm-panel .perm-note {
  color: #6c757d;
}

.perm-panel-head h2 {
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
}

.perm-panel-sub {
  color: #6c757d;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.perm-super {
  padding: 0.6rem 0.75rem;
  background: #f1f3f5;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.perm-hint {
  color: #6c757d;
  font-weight: 400;
}

/* One row per area: label on the left, its action toggles on the right. */
.perm-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: opacity 0.15s ease;
}

/* Dimmed (but still submittable) while "Super admin" is on, since it overrides. */
.perm-grid--off {
  opacity: 0.45;
}

.perm-area {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid #f0f1f3;
}

.perm-area-name {
  font-weight: 600;
}

.perm-area-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

/* Keep each action toggle + label on one line. */
.perm-toggle {
  min-width: 5.5rem;
}

.perm-note {
  color: #6c757d;
  font-size: 0.85rem;
  margin: 0.85rem 0 0;
}

@media (max-width: 640px) {
  .perm-area {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
