/* ============================================================
   Boishakhi Mela Ops Portal — Shared Stylesheet
   Design tokens: Cream #F7F3EC | Gold #B8972A | Dark #1A1712
   Teal #0F6E56 | Amber #854F0B | Red #A32D2D | Font: DM Sans
   ============================================================ */

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

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

:root {
  --cream:  #F7F3EC;
  --gold:   #B8972A;
  --dark:   #1A1712;
  --teal:   #0F6E56;
  --amber:  #854F0B;
  --red:    #A32D2D;
  --white:  #FFFFFF;
  --border: #E0D9CE;
  --muted:  #7A6F62;
  --surface:#EEEAE2;

  --sidebar-w: 220px;
  --bottomnav-h: 60px;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(26,23,18,0.10);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--dark);
  background: var(--cream);
  line-height: 1.5;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem;   font-weight: 600; }

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1.25rem;
}

.muted { color: var(--muted); font-size: 0.875rem; }

/* ── Layout ───────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
  margin-left: var(--sidebar-w);
  max-width: 960px;
}

/* ── Sidebar (desktop) ────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-mark {
  width: 36px; height: 36px;
  background: var(--gold);
  color: var(--dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.logo-sub {
  color: rgba(255,255,255,0.45);
  font-size: 0.7rem;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}

.nav-item.active {
  color: var(--white);
  border-left-color: var(--gold);
  background: rgba(184,151,42,0.12);
}

.nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Sidebar footer lives on dark background — override light-bg defaults */
.sidebar-footer .muted {
  color: rgba(255, 255, 255, 0.4);
}
.sidebar-footer .btn-outline {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.2);
}
.sidebar-footer .btn-outline:hover {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.user-info {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Bottom Nav (mobile) ──────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--dark);
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.bottom-nav-inner {
  display: flex;
  height: 100%;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(255,255,255,0.5);
  font-size: 0.65rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
  border-top: 2px solid transparent;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--white);
  border-top-color: var(--gold);
  text-decoration: none;
}

.bottom-nav-item .nav-icon { font-size: 1.15rem; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
}

/* ── Stat cards (dashboard) ───────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.1;
}

.stat-card.teal  .stat-value { color: var(--teal); }
.stat-card.amber .stat-value { color: var(--amber); }
.stat-card.red   .stat-value { color: var(--red); }
.stat-card.gold  .stat-value { color: var(--gold); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:hover { opacity: 0.88; text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-primary   { background: var(--teal);  color: var(--white); }
.btn-gold      { background: var(--gold);  color: var(--white); }
.btn-danger    { background: var(--red);   color: var(--white); }
.btn-outline   { background: transparent; color: var(--dark); border: 1.5px solid var(--border); }
.btn-ghost     { background: transparent; color: var(--teal); padding-left: 0.25rem; }
.btn-sm        { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-full      { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,110,86,0.1);
}

textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-hint {
  font-size: 0.775rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--surface);
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(247,243,236,0.6); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-active,
.badge-ok,
.badge-occupied,
.badge-resolved  { background: rgba(15,110,86,0.12);  color: var(--teal); }
.badge-vacant    { background: rgba(122,111,98,0.12); color: var(--muted); }
.badge-warning,
.badge-partial,
.badge-medium    { background: rgba(133,79,11,0.12);  color: var(--amber); }
.badge-suspended,
.badge-down,
.badge-high,
.badge-issue,
.badge-open      { background: rgba(163,45,45,0.12);  color: var(--red); }
.badge-exited,
.badge-low       { background: rgba(122,111,98,0.12); color: var(--muted); }

/* ── Alert banner (high severity incidents) ───────────────── */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(163,45,45,0.08);
  border: 1.5px solid var(--red);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--red);
}

.alert-banner strong { font-weight: 700; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.empty-state-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.empty-state p    { font-size: 0.875rem; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,23,18,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(26,23,18,0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none; border: none;
  font-size: 1.25rem; color: var(--muted);
  cursor: pointer; line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.modal-close:hover { background: var(--surface); }

.modal-body   { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: 0.6rem; justify-content: flex-end; }

/* ── Checklist items ──────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type="checkbox"] {
  width: 20px; height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--teal);
  cursor: pointer;
}

.checklist-label {
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.checklist-item.checked .checklist-label {
  text-decoration: line-through;
  color: var(--muted);
}

/* ── Utility status selectors ─────────────────────────────── */
.status-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-btn {
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--surface);
  color: var(--muted);
  transition: all 0.15s;
  font-family: inherit;
}

.status-btn:hover { border-color: var(--border); }

.status-btn.active-ok        { background: rgba(15,110,86,0.12);  color: var(--teal);  border-color: var(--teal); }
.status-btn.active-partial   { background: rgba(133,79,11,0.12);  color: var(--amber); border-color: var(--amber); }
.status-btn.active-down      { background: rgba(163,45,45,0.12);  color: var(--red);   border-color: var(--red); }

/* ── Search / filter bar ──────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  max-width: 220px;
  width: auto;
  flex: 1;
}

/* ── Severity tap targets (mobile incident form) ──────────── */
.severity-group {
  display: flex;
  gap: 0.6rem;
}

.severity-btn {
  flex: 1;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: var(--surface);
  color: var(--muted);
}

.severity-btn:hover { opacity: 0.8; }

.severity-btn[data-value="low"].selected    { background: rgba(122,111,98,0.15); color: var(--muted);  border-color: var(--muted); }
.severity-btn[data-value="medium"].selected { background: rgba(133,79,11,0.15);  color: var(--amber); border-color: var(--amber); }
.severity-btn[data-value="high"].selected   { background: rgba(163,45,45,0.15);  color: var(--red);   border-color: var(--red); }

/* ── Section divider ──────────────────────────────────────── */
.section-gap { margin-top: 2rem; }

/* ── Toast notification ───────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--dark);
  color: var(--white);
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Loading spinner ──────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  padding: 1rem;
}

.login-card {
  background: var(--cream);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo-mark {
  width: 56px; height: 56px;
  background: var(--gold);
  color: var(--dark);
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
}

.login-logo h1 {
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 0.2rem;
}

.login-logo p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Print styles ─────────────────────────────────────────── */
@media print {
  .sidebar, .bottom-nav, .btn, .filter-bar,
  .modal-overlay, #toast, .no-print { display: none !important; }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }

  body { background: white; color: black; font-size: 12pt; }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #B8972A;
  }
}

.print-header { display: none; }

/* ── Responsive: mobile ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar       { display: none; }
  .bottom-nav    { display: block; }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-bottom: calc(var(--bottomnav-h) + 1rem);
  }

  .form-row { grid-template-columns: 1fr; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .modal { max-width: 100%; margin: 0; border-radius: 12px 12px 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .filter-bar input,
  .filter-bar select { max-width: 100%; }
}
