@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --navy: #16233f;
  --gold: #b08d52;
  --gold-soft: #c9a96b;
  --cream: #f1ede4;
  --ink: #1c2436;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
.serif { font-family: 'Cormorant Garamond', serif; }

a { text-decoration: none; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd4dd; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

@keyframes hmFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes hmPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.hm-fade { animation: hmFade .5s ease both; }

/* Hover helpers (inline styles can't express :hover) */
.nav-item { transition: all .15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item.active { background: rgba(176,141,82,0.16) !important; color: #e9c98a !important; }
.btn-dark { transition: background .15s; }
.btn-dark:hover { background: #1f2d4d; }
.expo-card { transition: box-shadow .15s, transform .15s; }
.expo-card:hover { box-shadow: 0 12px 34px rgba(22,35,63,0.13); transform: translateY(-2px); }
.drop-zone { transition: all .15s; }
.drop-zone:hover { border-color: var(--gold); background: #fbfaf6; }
.data-row:hover { background: #faf8f3; }
.qr-btn { transition: all .15s; }
.qr-btn:hover { border-color: var(--gold); background: #fbf7ef; }

/* ===================== Admin responsive ===================== */
.hamburger { display: none; }
.admin-backdrop { display: none; }

/* Never let inner content force a horizontal page scroll. Wide tables get their
   own scroll container (.table-scroll); everything else must fit the width. */
.admin-content { overflow-x: hidden; }
.kpi-grid > *, .charts-grid > *, .expo-grid > *, .roles-grid > *,
.detail-qr-grid > * { min-width: 0; }

/* Tablet / phone: sidebar becomes an off-canvas drawer (toggled via body.hm-nav-open) */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed !important;
    top: 0; left: 0;
    height: 100vh !important;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  body.hm-nav-open .admin-sidebar { transform: none; }
  body.hm-nav-open .admin-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,15,25,.45); z-index: 55; }
  .hamburger { display: flex !important; }

  .admin-content { padding: 18px 16px 48px !important; }
  .admin-topbar { padding: 10px 16px !important; }
  .topbar-scope, .topbar-sep, .topbar-bell { display: none !important; }

  /* Stack the dashboard / card grids */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .charts-grid { grid-template-columns: 1fr !important; }
  .charts-grid > div { grid-column: auto !important; }
  .expo-grid { grid-template-columns: 1fr !important; }
  .roles-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .detail-qr-grid { grid-template-columns: 1fr !important; }
  .detail-qr-panel { flex-direction: column !important; gap: 18px !important; }
  .detail-qr-panel > div { width: 100% !important; max-width: 100% !important; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr !important; }

  /* Wide data tables scroll horizontally instead of breaking.
     !important beats the inline overflow:hidden on the card container. */
  .table-scroll { overflow-x: auto !important; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  .table-min { min-width: 700px; }
}

@media (max-width: 560px) {
  .kpi-grid, .roles-grid { grid-template-columns: 1fr !important; }
  .topbar-sub { display: none !important; }
}

/* Login: stack and drop the brand panel on small screens */
@media (max-width: 820px) {
  .login-grid { grid-template-columns: 1fr !important; }
  .login-brand { display: none !important; }
}

/* Topbar dropdown menus */
.hm-menu-wrap { position: relative; }
.hm-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: #fff;
  border: 1px solid #e4dfd4;
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(22,35,63,.18);
  z-index: 70;
  overflow: hidden;
}
.hm-menu.show { display: block; }
.hm-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; font-size: 13.5px; color: #1c2436;
  cursor: pointer; text-decoration: none; background: #fff; border: none; width: 100%; text-align: left;
}
.hm-menu-item:hover { background: #f7f5ef; }
.hm-menu-item.active { color: #16233f; font-weight: 600; }
@media (max-width: 900px) { .hm-menu { right: -8px; } }

/* QR code fills its assigned slot regardless of intrinsic module count */
.qrbox { display: block; overflow: hidden; }
.qrbox svg { width: 100% !important; height: 100% !important; display: block; }

/* Public view content protection */
.protected-art { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.no-context { -webkit-user-select: none; user-select: none; }

input, textarea { font-family: inherit; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); }

#blazor-error-ui {
  background: #fbf7ef; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
  display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
