/* =========================================================
   static/css/admin.css — Admin Panel Bootstrap 5 layer (A3 UI pass)

   Loaded only by templates/admin/*.html (never the public site).
   Reuses the brand color variables already declared in gypsy.css's
   :root (--color-primary-maroon etc.) rather than redefining them, so
   the Admin Panel and the public site never drift out of sync on
   brand color. This file supplies: (1) small Bootstrap variable
   overrides so buttons/links pick up the brand palette, and (2) the
   actual app-shell layout (sidebar / topbar / mobile bottom nav) as
   plain flexbox — deliberately NOT dependent on Bootstrap's grid or
   its offcanvas JS component, so the responsive shell keeps working
   even if the Bootstrap CDN is slow/unavailable (only buttons/forms/
   tables/modals lose their polish in that case, not the layout).
   ========================================================= */

:root {
  --admin-sidebar-width: 264px;
  --admin-bottomnav-h: 60px;
}

body.admin-body {
  background: var(--color-light-beige, #F5EEE6);
  overflow-x: hidden;
}

/* ---- Brand-color Bootstrap overrides ---- */
.btn-primary {
  --bs-btn-bg: var(--color-primary-maroon, #641415);
  --bs-btn-border-color: var(--color-primary-maroon, #641415);
  --bs-btn-hover-bg: var(--color-dark-maroon, #4A0F10);
  --bs-btn-hover-border-color: var(--color-dark-maroon, #4A0F10);
  --bs-btn-active-bg: var(--color-dark-maroon, #4A0F10);
  --bs-btn-active-border-color: var(--color-dark-maroon, #4A0F10);
  --bs-btn-focus-shadow-rgb: 100, 20, 21;
}
.btn-outline-primary {
  --bs-btn-color: var(--color-primary-maroon, #641415);
  --bs-btn-border-color: var(--color-primary-maroon, #641415);
  --bs-btn-hover-bg: var(--color-primary-maroon, #641415);
  --bs-btn-hover-border-color: var(--color-primary-maroon, #641415);
}
.text-brand { color: var(--color-primary-maroon, #641415) !important; }
.bg-brand-dark { background-color: var(--color-dark-maroon, #4A0F10) !important; }
a { color: var(--color-primary-maroon, #641415); }
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary-maroon, #641415);
  box-shadow: 0 0 0 .25rem rgba(100, 20, 21, .15);
}
.nav-pills .nav-link.active, .page-item.active .page-link {
  background-color: var(--color-primary-maroon, #641415);
  border-color: var(--color-primary-maroon, #641415);
}

/* ---- App shell ---- */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--admin-sidebar-width);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e7ddd0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  transform: translateX(-100%);
  transition: transform .2s ease;
  z-index: 1045;
  display: flex;
  flex-direction: column;
}
.admin-sidebar.is-open { transform: translateX(0); }

.admin-sidebar-brand {
  background: var(--color-dark-maroon, #4A0F10);
  min-height: 68px;
}
.admin-sidebar-brand .brand-title { color: #fff; }
.admin-sidebar-brand .brand-subtitle { color: rgba(255,255,255,.7); }

.admin-sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(31, 31, 31, .4);
  z-index: 1040;
  display: none;
}
.admin-sidebar-backdrop.is-visible { display: block; }

.admin-nav-link {
  color: #1F1F1F;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
}
.admin-nav-link.active, .admin-nav-link:hover { background: rgba(100, 20, 21, .08); color: var(--color-primary-maroon, #641415); }
.admin-nav-link.disabled { color: #bbb; cursor: not-allowed; }
.admin-nav-link.disabled:hover { background: none; }
.admin-nav-section-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: #999; padding: .75rem .75rem .25rem;
}

.admin-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky; top: 0; z-index: 1020;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #e7ddd0;
}

.admin-content { padding-bottom: calc(var(--admin-bottomnav-h) + 1rem); }

.admin-card { border: 1px solid #e7ddd0; border-radius: 1rem; background: #fff; }

.admin-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.admin-avatar-fallback {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--color-primary-maroon, #641415); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .9rem;
}

/* ---- Mobile bottom navigation ---- */
.admin-bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 1030;
  background: #fff;
  border-top: 1px solid #e7ddd0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.admin-bottomnav a, .admin-bottomnav button {
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: .4rem 0;
  color: #666;
  font-size: .66rem;
  border: 0;
  background: none;
  text-decoration: none;
}
.admin-bottomnav a.active { color: var(--color-primary-maroon, #641415); }
.admin-bottomnav i { font-size: 1.15rem; }
.admin-bottomnav .fab-slot { display: flex; align-items: flex-start; justify-content: center; }
.admin-bottomnav .fab {
  margin-top: -20px;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--color-primary-maroon, #641415);
  color: #fff !important;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(100, 20, 21, .35);
}
.admin-bottomnav .fab i { color: #fff; font-size: 1.3rem; }

/* ---- Toast (used by the "coming soon" placeholders) ---- */
.admin-toast {
  position: fixed; left: 50%; bottom: calc(var(--admin-bottomnav-h) + 14px);
  transform: translate(-50%, 8px);
  background: var(--color-dark-maroon, #4A0F10); color: #fff;
  padding: .55rem 1rem; border-radius: 999px; font-size: .8rem;
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
  z-index: 1080; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.admin-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---- Breakpoint: desktop sidebar becomes static, mobile chrome hides ---- */
@media (min-width: 992px) {
  .admin-sidebar { position: static; transform: none; }
  .admin-sidebar-backdrop { display: none !important; }
  .admin-bottomnav { display: none; }
  .admin-content { padding-bottom: 1.5rem; }
  .admin-sidebar-toggle, .admin-toast { display: none; }
}

/* Never let a wide table/card force the page itself to scroll sideways —
   only the table's own .table-responsive wrapper should scroll. This
   duplicates Bootstrap's own .table-responsive rule on purpose: if the
   Bootstrap CDN is ever slow/unavailable, a wide table degrades to a
   horizontal scrollbar inside its own card instead of blowing out the
   whole page (verified via a Playwright pass with the CDN blocked —
   see the A3 UI pass test notes). */
.admin-content, .admin-main { max-width: 100%; }
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Touch-friendly buttons everywhere in the Admin Panel */
.admin-body .btn { min-height: 38px; }
