/**
 * Common Styles — PAWS and Pixels
 * Responsive shared styles for all pages
 */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: #f8f9fa;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
}

/* ── Page padding below fixed navbar ── */
.page-content {
  padding-top: 76px; /* navbar height */
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  background: #0f172a;                     /* Slate-900, matches the dark Overview page */
  border-bottom: 1px solid #1e293b;        /* Slate-800 hairline */
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.25), 0 2px 4px -2px rgba(0,0,0,.2);   /* shadow-md */
  min-height: 64px;
}
.navbar-brand         { color: white !important; font-weight: 700; font-size: 1.1rem; }
.nav-link             { color: rgba(255,255,255,.85) !important; font-weight: 500; transition: color .2s; padding: .5rem .75rem !important; }
.nav-link:hover       { color: white !important; }
.nav-link.active      { color: white !important; font-weight: 700; }
#user-name            { color: rgba(255,255,255,.9); font-size: .85rem; white-space: nowrap; }

/* ── Bottom tab bar (phones and small tablets; desktop uses the top links) ── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex; height: 62px;
  background: #0f172a; border-top: 1px solid #1e293b;
  box-shadow: 0 -4px 6px -1px rgba(0,0,0,.25);
}
.bottom-nav-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #94a3b8; font-size: .72rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  border-top: 2px solid transparent;
}
.bottom-nav-item:hover { color: #e2e8f0; }
.bottom-nav-item.active { color: #ffffff; background: #1e293b; border-top-color: #818cf8; }
.bottom-nav-icon { font-size: 1.15rem; line-height: 1.2; }
@media (max-width: 991px) {
  body:has(.bottom-nav) { padding-bottom: 62px; }   /* keep page ends above the bar */
}

/* ── Cards ── */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.card-header {
  border-radius: 12px 12px 0 0 !important;
  font-weight: 600;
}

/* ── Buttons ── */
.btn { border-radius: 8px; font-weight: 500; transition: transform .15s, box-shadow .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }

/* ── Alerts ── */
.alert { border-radius: 10px; font-size: .9rem; }

/* ── Status dots ── */
.status-dot    { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot-online    { background: #28a745; box-shadow: 0 0 0 3px rgba(40,167,69,.2); }
.dot-offline   { background: #dc3545; }

/* ── Forms ── */
.form-control:focus,
.form-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 .2rem rgba(102,126,234,.2);
}

/* ── Gradient text ── */
.text-gradient {
  background: linear-gradient(135deg,#667eea,#764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Loading spinner ── */
.spinner-border-sm { width: 1rem; height: 1rem; border-width: .15em; }

/* ── Badge ── */
.badge { font-weight: 600; }

/* ── Fade animation ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease; }

/* ── Map (default) ── */
#map { height: 55vh; border-radius: .5rem; min-height: 250px; }

/* ══════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════ */

/* Tablets and below */
@media (max-width: 991px) {
  .page-content { padding-top: 64px; }
  #map { height: 45vh; }
}

/* Mobile */
@media (max-width: 767px) {
  .navbar-brand { font-size: 1rem; }
  #map { height: 40vh; min-height: 220px; }

  /* Stack tables cleanly */
  .table-responsive-stack td,
  .table-responsive-stack th { display: block; width: 100%; }

  /* Prevent overflow */
  pre { white-space: pre-wrap; word-break: break-all; }
}

/* Small phones */
@media (max-width: 480px) {
  body { font-size: .9rem; }
  h1   { font-size: 1.6rem !important; }
  h2   { font-size: 1.3rem !important; }
  .btn { font-size: .85rem; padding: .45rem .9rem; }
}

/* Phones: iPhone Safari zooms the page in when a text box/dropdown under 16px is tapped.
   16px stops that on every page that uses this stylesheet. */
@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select, textarea, .form-control, .form-select { font-size: 16px !important; }
}

/* ── Navbar alert bell (assets/js/alert-bell.js) ── */
.nav-bell {
  background: #1e293b; color: #fbbf24; border: 1px solid #334155;
  width: 36px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
}
.nav-bell:hover, .nav-bell.show { background: #334155; color: #fcd34d; border-color: #475569; }
.alert-menu {
  width: 340px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden;
  background: #1e293b; border: 1px solid #334155; border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,.45);
}
.alert-menu-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #334155; color: #f8fafc; font-weight: 700;
}
.alert-menu-head button { background: none; border: none; color: #a5b4fc; font-size: .82rem; font-weight: 600; padding: 0; }
.alert-menu-head button:disabled { color: #64748b; }
#alert-bell-list { max-height: 360px; overflow-y: auto; }
.alert-menu-item {
  display: flex; gap: 12px; align-items: center; padding: 11px 16px;
  border-bottom: 1px solid #334155; text-decoration: none; color: #e2e8f0;
}
.alert-menu-item:last-child { border-bottom: none; }
.alert-menu-item:hover { background: #273449; color: #ffffff; }
.alert-menu-item.unread { background: rgba(99,102,241,.12); }
.alert-menu-item.unread .alert-menu-title::after {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #818cf8; margin-left: 6px; vertical-align: middle;
}
.alert-menu-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.alert-menu-icon.exit  { background: rgba(239,68,68,.18); }
.alert-menu-icon.entry { background: rgba(34,197,94,.18); }
.alert-menu-icon.vaccine { background: rgba(245,158,11,.18); }
.alert-menu-text  { display: flex; flex-direction: column; min-width: 0; }
.alert-menu-title { font-size: .88rem; line-height: 1.3; }
.alert-menu-time  { font-size: .75rem; color: #94a3b8; }
.alert-menu-empty { padding: 28px 16px; text-align: center; color: #94a3b8; font-size: .88rem; }
@media (max-width: 991px) {
  /* The bell isn't at the screen edge here, so open the list across the screen instead of under it */
  #alert-bell .alert-menu { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-width: none; margin: 0; }
  #alert-bell-list { max-height: calc(100vh - 200px); }
}
