/* responders/assets/css/style.css — SAFETAP Responder Portal */
:root {
  --primary:      #c91818;
  --primary-dark: #980f0f;
  --primary-soft: #fff0f0;
  --success:      #0f8b45;
  --success-soft: #e8f8ee;
  --warning:      #9a6700;
  --warning-soft: #fff4db;
  --info:         #1d4ed8;
  --info-soft:    #eff6ff;
  --text:         #181818;
  --muted:        #6b7280;
  --border:       #edd7d7;
  --white:        #ffffff;
  --shadow:       0 18px 50px rgba(168,24,24,0.10);
  --radius-lg:    28px;
  --radius-md:    20px;
  --radius-sm:    14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #fff8f8;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

/* ── Buttons ── */
.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 20px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-size: 0.95rem;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), #ef4444);
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #dc2626); }
.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid rgba(201,24,24,0.18);
}
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 0.85rem; border-radius: 12px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-danger     { background: rgba(201,24,24,0.10); color: var(--primary); }
.badge-assigned   { background: var(--info-soft);     color: var(--info); }
.badge-responding { background: var(--warning-soft);  color: var(--warning); }
.badge-arrived    { background: #f0fdf4;              color: #15803d; }
.badge-success    { background: var(--success-soft);  color: var(--success); }
.badge-closed     { background: #f3f4f6;              color: #6b7280; }

/* ── Brand ── */
.brand, .portal-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 48px; height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #ef4444);
  color: white;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.3rem;
  box-shadow: var(--shadow);
}
.brand-mark-sm {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #ef4444);
  color: white;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1rem;
}
.brand-name { font-size: 1rem; font-weight: 800; letter-spacing: 0.08em; }
.brand-sub  { font-size: 0.8rem; color: var(--muted); }

/* ── Login View ── */
.portal-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #fff8f8 0%, #ffffff 50%, #fff7f7 100%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201,24,24,0.08);
  box-shadow: var(--shadow);
  padding: 32px;
}

/* ── Tab buttons ── */
.tab-buttons {
  display: flex;
  background: #fff7f7;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 5px; gap: 5px;
  margin: 24px 0 20px;
}
.tab-btn {
  flex: 1;
  border: 0; border-radius: 13px;
  padding: 11px 14px;
  background: transparent;
  font-weight: 700; font-size: 0.9rem;
  color: var(--muted);
}
.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(201,24,24,0.10);
}

/* ── Auth forms ── */
.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.active-form { display: flex; }
.auth-form label {
  display: flex; flex-direction: column;
  gap: 7px; font-weight: 600; font-size: 0.9rem; color: #333;
}
.auth-form input,
.auth-form select {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 0.95rem;
  outline: none;
  background: #fffdfd;
  color: var(--text);
  width: 100%;
}
.auth-form input:focus,
.auth-form select:focus {
  border-color: rgba(201,24,24,0.35);
  box-shadow: 0 0 0 4px rgba(201,24,24,0.08);
}

.message { min-height: 20px; font-weight: 600; font-size: 0.88rem; margin-top: 4px; }
.message.error   { color: var(--primary); }
.message.success { color: var(--success); }

/* ── Portal View ── */
.portal-view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.portal-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid rgba(201,24,24,0.08);
  backdrop-filter: blur(12px);
  padding: 14px 20px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.portal-header-right { display: flex; align-items: center; gap: 14px; }
.responder-info { display: flex; flex-direction: column; align-items: flex-end; }
.responder-info span { font-weight: 700; font-size: 0.95rem; }
.responder-info small { color: var(--muted); font-size: 0.8rem; }

.portal-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 30px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ── Summary cards ── */
.portal-summary {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 24px;
}
.summary-card {
  background: white;
  border: 1px solid rgba(201,24,24,0.10);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.summary-card h2 { font-size: 2.2rem; color: var(--primary); margin-bottom: 4px; }
.summary-card p  { color: var(--muted); font-size: 0.85rem; }
.summary-card--resolved h2 { color: var(--success); }

.portal-section-head {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.portal-section-head h3 { font-size: 1.1rem; }

/* ── Alert cards ── */
.alerts-list { display: grid; gap: 16px; }

.alert-item {
  background: white;
  border: 1px solid rgba(201,24,24,0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease;
}
.alert-item:hover { transform: translateY(-1px); }
.alert-item--resolved { opacity: 0.72; }

.alert-item__header {
  padding: 16px 16px 12px;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
}
.alert-item__header h4 { margin: 0 0 4px; font-size: 1rem; }
.alert-item__header p  { color: var(--muted); font-size: 0.85rem; margin: 0; }

.alert-item__photo { cursor: pointer; overflow: hidden; }
.alert-item__photo img {
  width: 100%; max-height: 200px;
  object-fit: cover; display: block;
  transition: opacity 0.18s ease;
}
.alert-item__photo img:hover { opacity: 0.88; }

/* ── Alert map ── */
.alert-item__map {
  height: 190px;
  border-top: 1px solid var(--border);
}
.alert-item__map .leaflet-container {
  height: 100%;
  border-radius: 0;
}

.alert-item__meta {
  padding: 12px 16px 14px;
  display: grid; gap: 8px;
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.alert-item__meta-row { display: flex; gap: 10px; }
.alert-item__meta-row span   { color: var(--muted); min-width: 100px; flex-shrink: 0; }
.alert-item__meta-row strong { color: var(--text); }

.alert-item__actions {
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.alert-item__closed-note {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
  font-style: italic;
}
.alert-item__resolve-form {
  display: flex; flex-direction: column; gap: 10px;
}
.alert-item__resolve-form textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
  resize: vertical; min-height: 72px;
  outline: none; color: var(--text); background: #fffdfd;
}
.alert-item__resolve-form textarea:focus {
  border-color: rgba(201,24,24,0.35);
  box-shadow: 0 0 0 3px rgba(201,24,24,0.08);
}

/* ── Incident type selector ── */
.incident-type-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.incident-type-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.incident-type-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.9rem;
  outline: none;
  background: #fffdfd;
  color: var(--text);
  appearance: auto;
}
.incident-type-select:focus {
  border-color: rgba(201,24,24,0.35);
  box-shadow: 0 0 0 3px rgba(201,24,24,0.08);
}

/* ── Resolve + dismiss button row ── */
.resolve-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.resolve-btn-row .btn { flex: 1 1 130px; }

.btn-dismiss {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 13px 20px;
  font-weight: 700;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
}
.btn-dismiss:hover {
  background: #fee2e2;
  color: var(--primary);
  border-color: rgba(201,24,24,0.22);
}

/* ── Incident type badge (view-only state) ── */
.incident-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.08);
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 700;
}
.incident-type-badge[data-type="Prank / False Alarm"] {
  background: #f3f4f6;
  color: #6b7280;
}

/* ── Photo Modal ── */
.r-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.r-modal.hidden { display: none; }
.r-modal__backdrop { position: absolute; inset: 0; }
.r-modal__panel--photo {
  position: relative; z-index: 1;
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  width: min(700px, 100%);
  box-shadow: 0 30px 80px rgba(0,0,0,0.2);
}
.r-modal__panel--photo img {
  width: 100%; max-height: 75vh;
  object-fit: contain; border-radius: 16px;
  display: block; background: #111;
}
.r-modal__close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: white;
  font-size: 1.1rem; display: grid; place-items: center;
}

/* ── Empty state ── */
.empty-state {
  padding: 32px 24px; text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(201,24,24,0.2);
  border-radius: var(--radius-md);
  background: #fffdfd; font-size: 0.95rem; line-height: 1.6;
}

/* ── Toast ── */
.portal-toast-host {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.portal-toast {
  padding: 12px 22px; border-radius: 14px;
  background: #1a1a1a; color: white;
  font-weight: 600; font-size: 0.88rem;
  white-space: nowrap; opacity: 1;
  transition: opacity 0.25s ease;
}
.portal-toast--success { background: #0f8b45; }
.portal-toast--error   { background: var(--primary); }
.portal-toast--fade    { opacity: 0; }

/* ── Password show/hide ── */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; width: 100%; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  border: 0; background: transparent;
  color: var(--muted); padding: 4px;
  display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--text); transform: translateY(-50%) scale(1.1); }
.pw-toggle svg { width: 18px; height: 18px; }

/* ── Confirm Dialog ── */
.confirm-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.confirm-modal.hidden { display: none; }
.confirm-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.confirm-modal__box {
  position: relative; z-index: 1;
  background: white;
  border-radius: var(--radius-md);
  padding: 28px 24px 20px;
  width: min(360px, 100%);
  box-shadow: 0 30px 60px rgba(0,0,0,0.15);
  text-align: center;
}
.confirm-modal__box h4 { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; }
.confirm-modal__box p  { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.55; }
.confirm-modal__btns   { display: flex; gap: 10px; }
.confirm-modal__btns .btn { flex: 1; }

/* ── Action Success Dialog ── */
.action-success-overlay {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.22);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeBgIn 0.2s ease;
}
.action-success-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.action-success-box {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(0,0,0,0.12);
  padding: 32px 28px 24px;
  text-align: center;
  max-width: 280px;
  width: 100%;
  animation: successPop 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
.action-success-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: grid; place-items: center;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 auto 14px;
}
.action-success-box strong {
  display: block;
  font-size: 1rem; font-weight: 800;
  color: var(--text); margin-bottom: 4px;
}
.action-success-box p {
  font-size: 0.85rem; color: var(--muted);
  margin: 0; line-height: 1.5;
}
@keyframes successPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes fadeBgIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Tab content ── */
.tab-content { display: none; }
.tab-content.active-tab { display: block; }

/* ── Bottom Navigation ── */
.bottom-nav {
  flex-shrink: 0;
  background: rgba(255,255,255,0.97);
  border-top: 1px solid rgba(201,24,24,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  transition: color 0.15s ease;
}
.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item.active { color: var(--primary); }

/* ── Profile Tab ── */
.profile-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(201,24,24,0.08);
  box-shadow: var(--shadow);
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #ef4444);
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(201,24,24,0.2);
  margin-bottom: 4px;
}
.profile-name { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.profile-role-chip {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 700;
}
.profile-stats { display: flex; gap: 28px; margin: 12px 0 4px; }
.profile-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.profile-stat strong { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.profile-stat span { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.profile-details {
  width: 100%;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.profile-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; }
.profile-row span { color: var(--muted); font-weight: 500; }
.profile-row strong { color: var(--text); font-weight: 700; }

/* ── Settings Tab ── */
.settings-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(201,24,24,0.08);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.settings-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 18px 6px;
}
.settings-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}
.settings-row svg { color: var(--muted); width: 18px; height: 18px; }
.settings-row:hover { background: #fff8f8; }
.change-pw-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: #fffdfd;
}
.change-pw-form input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  outline: none;
  color: var(--text);
  background: white;
  width: 100%;
}
.change-pw-form input:focus {
  border-color: rgba(201,24,24,0.35);
  box-shadow: 0 0 0 3px rgba(201,24,24,0.08);
}
.btn-signout {
  width: 100%;
  border: 0;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 16px;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  display: block;
}
.btn-signout:hover { background: #fde8e8; }
.settings-version { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 16px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 0 8px;
}
.pagination__info {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 90px;
  text-align: center;
}
.pagination .btn { min-width: 76px; }

/* ── Responsive ── */
@media (max-width: 500px) {
  .portal-header    { padding: 12px 14px; }
  .portal-main      { padding: 14px; }
  .login-card       { padding: 22px 18px; }
  .portal-summary   { gap: 10px; }
  .summary-card     { padding: 16px; }
  .summary-card h2  { font-size: 1.8rem; }
  .responder-info   { display: none; }
}
