/* ============================================================
   DISASTER BOARD — Shared Stylesheet
   Theme: Professional Emergency Management
   Colors: Black, Grey, Red, Blue
   ============================================================ */

:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --bg3:         #1c2330;
  --nav:         #0a0f16;
  --border:      #30363d;
  --border-soft: #21262d;
  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --red:         #c62828;
  --red-hover:   #d32f2f;
  --blue:        #1565c0;
  --blue-hover:  #1976d2;
  --blue-light:  #1e3a5f;
  --amber:       #b45309;
  --amber-hover: #d97706;
  --green:       #155724;
  --green-hover: #1a6b2e;
  --radius:      8px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  min-height: 100vh;
}

a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top Navigation Bar ---- */
.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 56px;
  background: var(--nav);
  border-bottom: 2px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 200;
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
  text-decoration: none;
}

.topnav .brand .shield {
  width: 28px; height: 28px;
  background: var(--red);
  clip-path: polygon(50% 0%, 100% 25%, 100% 70%, 50% 100%, 0% 70%, 0% 25%);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; color: #fff;
  flex-shrink: 0;
}

.topnav .spacer { flex: 1; }

.topnav .org-badge {
  background: var(--blue-light);
  border: 1px solid #1565c0;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #90caf9;
}

.topnav .user-name {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: var(--radius);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .15s, transform .1s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--blue);  color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }

.btn-danger    { background: var(--red);   color: #fff; }
.btn-danger:hover  { background: var(--red-hover); }

.btn-warning   { background: var(--amber); color: #fff; }
.btn-warning:hover { background: var(--amber-hover); }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); }

.btn-secondary {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg2); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #58a6ff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

.btn-icon {
  background: transparent; border: 0;
  color: var(--text-muted); cursor: pointer;
  padding: 4px 8px; border-radius: 4px; font-size: 16px;
}
.btn-icon:hover { color: var(--red); background: rgba(255,255,255,.05); }

/* ---- Cards / Panels ---- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 16px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.section-title {
  font-size: 18px; font-weight: 700;
  color: var(--text);
  border-left: 4px solid var(--red);
  padding-left: 12px;
  margin: 0 0 16px;
}

/* ---- Forms ---- */
label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin: 14px 0 5px;
}

input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=date], select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.25);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg3); color: var(--text); }
textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  gap: 12px;
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 2px solid var(--border);
  background: var(--bg3);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,.025); }
.data-table td input, .data-table td select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  padding: 5px 8px;
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: none; align-items: center; justify-content: center;
  z-index: 500; padding: 16px;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 560px; max-width: 100%; max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-box.modal-sm { width: 380px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  margin: 0; font-size: 16px; font-weight: 700;
  color: var(--text);
}

.modal-body  { padding: 18px 20px; }
.modal-foot  {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ---- Confirmation Dialog ---- */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.confirm-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  width: 420px; max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
}
.confirm-box h3 {
  margin: 0 0 12px;
  font-size: 18px; font-weight: 700;
  color: var(--text);
}
.confirm-box p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px; line-height: 1.5;
}
.confirm-foot {
  display: flex; gap: 12px; justify-content: center;
}

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  background: none; border: none; border-bottom: 3px solid transparent;
  color: var(--text-muted); font-family: inherit;
  font-size: 14px; font-weight: 600;
  padding: 10px 20px; cursor: pointer; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: #58a6ff; border-bottom-color: #58a6ff; }

.tab-panel { display: none; }
.tab-panel.show { display: block; }

/* ---- Badges / Pills ---- */
.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
}
.badge-active  { background: #1a3a1a; color: #4caf50; border: 1px solid #2e7d32; }
.badge-ended   { background: #3a1a1a; color: #ef9a9a; border: 1px solid #c62828; }

/* ---- Page layout ---- */
.page-wrap {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 20px;
}
.page-wrap-wide {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 20px;
}

/* ---- Utility ---- */
.flex       { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: #ef9a9a; }
.text-center { text-align: center; }
.bold   { font-weight: 700; }
.w-full { width: 100%; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p     { font-size: 14px; margin: 0; }

/* ---- Loading spinner ---- */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Dropdown ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 260px;
  box-shadow: var(--shadow);
  z-index: 300;
  display: none;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }

.dropdown-menu a,
.dropdown-menu button {
  display: block; width: 100%;
  text-align: left; background: none; border: none;
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 10px 16px; cursor: pointer;
  text-decoration: none;
  transition: background .1s;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover { background: var(--bg3); }

.dropdown-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 4px 0;
}

.dropdown-header {
  padding: 6px 16px 4px;
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
}

/* ---- Print ---- */
@media print { .topnav, .no-print { display: none !important; } }
