/* HRA Disaster Response Hub — Portal Styles */
:root {
  --hra-purple: #1E0348;
  --hra-purple-dark: #0D0120;
  --hra-purple-light: #3B0764;
  --hra-purple-tint: #F0EBFF;
  --hra-purple-border: #B8A0F8;
  --success: #15803D;
  --warning: #D97706;
  --danger: #DC2626;
  --dark: #1E1B4B;
  --gray-100: #F8F7FF;
  --gray-200: #EDE9FE;
}
* { box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background-color: var(--gray-100); color: var(--dark); }

/* NAVBAR */
.portal-navbar { background: linear-gradient(135deg, var(--hra-purple-dark) 0%, var(--hra-purple) 100%); box-shadow: 0 2px 20px rgba(30,3,72,0.4); }
.portal-navbar .nav-link { color: rgba(255,255,255,0.93) !important; font-size: 0.85rem; font-weight: 500; padding: 0.5rem 0.85rem !important; border-radius: 6px; transition: all 0.2s; }
.portal-navbar .nav-link:hover, .portal-navbar .nav-link.active { color: #fff !important; background: rgba(255,255,255,0.15); }
.portal-navbar .nav-link i { margin-right: 5px; }
.text-purple { color: var(--hra-purple) !important; }
.bg-purple { background-color: var(--hra-purple) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-white-75 { color: rgba(255,255,255,0.93) !important; }

/* HERO */
.hero-section { background: linear-gradient(135deg, var(--hra-purple-dark) 0%, var(--hra-purple) 70%, #5B1A9E 100%); min-height: 100vh; display: flex; flex-direction: column; }
.hero-content { flex: 1; display: flex; align-items: center; padding: 80px 0 60px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: 50px; padding: 6px 16px; font-size: 0.8rem; color: #fff; margin-bottom: 1.5rem; }
.hero-badge .dot { width: 8px; height: 8px; background: #4ADE80; border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity:1; transform:scale(1); } 50% { opacity:0.7; transform:scale(1.2); } }

/* METRIC CARDS */
.metric-card { background: rgba(255,255,255,0.12); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.2); border-radius: 16px; padding: 24px; text-align: center; transition: transform 0.2s, background 0.2s; }
.metric-card:hover { transform: translateY(-4px); background: rgba(255,255,255,0.18); }
.metric-card .metric-number { font-size: 2.5rem; font-weight: 700; color: #fff; line-height: 1; }
.metric-card .metric-label { font-size: 0.8rem; color: #ffffff; margin-top: 6px; font-weight: 600; }
.metric-card .metric-icon { font-size: 1.8rem; color: rgba(255,255,255,0.82); margin-bottom: 12px; }

/* PORTAL CARDS */
.portal-cards-section { background: var(--gray-100); padding: 80px 0; }
.portal-card { border: none; border-radius: 20px; overflow: hidden; box-shadow: 0 4px 24px rgba(30,3,72,0.10); transition: all 0.3s; height: 100%; cursor: pointer; }
.portal-card:hover { transform: translateY(-8px); box-shadow: 0 12px 40px rgba(107,33,168,0.2); }
.portal-card .card-header-area { padding: 32px 32px 24px; position: relative; }
.portal-card.facility .card-header-area { background: linear-gradient(135deg, #15803D, #166534); }
.portal-card.partner .card-header-area { background: linear-gradient(135deg, #1D4ED8, #1E3A8A); }
.portal-card.admin .card-header-area { background: linear-gradient(135deg, var(--hra-purple), var(--hra-purple-dark)); }
.portal-card .card-icon { width: 60px; height: 60px; background: rgba(255,255,255,0.2); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: #fff; margin-bottom: 16px; }
.portal-card .card-body-area { padding: 24px 32px 32px; background: #fff; }

/* STAT CARDS */
.stat-card { background: #fff; border-radius: 16px; padding: 24px; border: 1px solid var(--hra-purple-border); box-shadow: 0 2px 12px rgba(30,3,72,0.07); transition: box-shadow 0.2s; }
.stat-card:hover { box-shadow: 0 4px 24px rgba(107,33,168,0.12); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-card .stat-number { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.8rem; color: #6B7280; font-weight: 500; }

/* PRIORITY BADGES */
.badge-critical { background: #FEE2E2 !important; color: #DC2626 !important; }
.badge-high { background: #FEF3C7 !important; color: #D97706 !important; }
.badge-medium { background: #EDE9FE !important; color: #6B21A8 !important; }
.badge-low { background: #D1FAE5 !important; color: #15803D !important; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.priority-dot.critical { background: #DC2626; }
.priority-dot.high { background: #D97706; }
.priority-dot.medium { background: #6B21A8; }
.priority-dot.low { background: #15803D; }

/* STATUS PILLS */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.status-pill.fully-operational { background: #D1FAE5; color: #15803D; }
.status-pill.limited-operations { background: #FEF3C7; color: #D97706; }
.status-pill.temporarily-closed { background: #FEE2E2; color: #DC2626; }
.status-pill.evacuated { background: #FCE7F3; color: #BE185D; }
.status-pill.status-unknown { background: #F3F4F6; color: #6B7280; }
.status-pill.submitted { background: #EDE9FE; color: #6B21A8; }
.status-pill.under-review { background: #FEF3C7; color: #D97706; }
.status-pill.claimed { background: #DBEAFE; color: #1D4ED8; }
.status-pill.fulfilled { background: #D1FAE5; color: #15803D; }
.status-pill.verified { background: #D1FAE5; color: #065F46; font-weight: 700; }

/* FORMS */
.form-control, .form-select { border-radius: 10px; border: 1.5px solid #DDD6FE; padding: 10px 14px; font-size: 0.9rem; font-family: 'Poppins', sans-serif; transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus, .form-select:focus { border-color: var(--hra-purple); box-shadow: 0 0 0 3px rgba(30,3,72,0.12); }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.form-text { font-size: 0.78rem; }

/* BUTTONS */
.btn-purple { background: var(--hra-purple); color: #fff; border: none; border-radius: 10px; font-weight: 600; font-family: 'Poppins', sans-serif; padding: 10px 20px; transition: all 0.2s; }
.btn-purple:hover { background: var(--hra-purple-dark); color: #fff; transform: translateY(-1px); }
.btn-outline-purple { background: transparent; color: var(--hra-purple); border: 1.5px solid var(--hra-purple); border-radius: 10px; font-weight: 600; font-family: 'Poppins', sans-serif; padding: 9px 20px; transition: all 0.2s; }
.btn-outline-purple:hover { background: var(--hra-purple); color: #fff; }

/* TABLES */
.portal-table { border-radius: 12px; overflow: hidden; }
.portal-table thead th { background: var(--hra-purple-tint); color: var(--hra-purple-dark); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border: none; padding: 14px 16px; }
.portal-table tbody td { font-size: 0.875rem; padding: 14px 16px; border-color: #F0EAFF; vertical-align: middle; }
.portal-table tbody tr:hover { background: #FAF8FF; }

/* PAGE LAYOUT */
.portal-main { padding: 32px; }
.portal-main .page-title { font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.portal-main .page-subtitle { font-size: 0.875rem; color: #6B7280; }
.page-header { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--hra-purple-border); }

/* CATEGORY BADGES */
.category-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; background: var(--hra-purple-tint); color: var(--hra-purple); }

/* EMPTY STATES */
.empty-state { text-align: center; padding: 60px 20px; color: #9CA3AF; }
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h5 { color: #4B5563; }

/* ALERTS */
.alert { border-radius: 12px; border: none; }
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-danger { background: #FEE2E2; color: #991B1B; }
.alert-warning { background: #FEF3C7; color: #92400E; }
.alert-info { background: #EDE9FE; color: #4C1D95; }

/* MAP */
#facility-map { border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }

/* CARDS */
.card { border: 1px solid var(--hra-purple-border); border-radius: 16px; box-shadow: 0 2px 12px rgba(30,3,72,0.07); }
.card-header { background: var(--hra-purple-tint); border-bottom: 1px solid var(--hra-purple-border); border-radius: 16px 16px 0 0 !important; font-weight: 600; color: var(--hra-purple-dark); }

/* NEED CARDS (partner browse) */
.need-card { background: #fff; border-radius: 16px; border: 1px solid var(--hra-purple-border); padding: 20px; transition: all 0.2s; }
.need-card:hover { box-shadow: 0 8px 24px rgba(107,33,168,0.12); transform: translateY(-2px); }
.need-card .need-title { font-weight: 600; font-size: 1rem; color: var(--dark); }
.need-card .need-meta { font-size: 0.8rem; color: #6B7280; }

/* LOGIN PAGE */
.login-bg { min-height: 100vh; background: linear-gradient(135deg, #4C1D95, #6B21A8); display: flex; align-items: center; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .portal-main { padding: 20px 16px; }
  .hero-content { padding: 60px 0 40px; }
  .metric-card .metric-number { font-size: 1.8rem; }
}

/* PENDING BADGE */
.pending-count { background: #DC2626; color: #fff; border-radius: 50px; font-size: 0.7rem; padding: 2px 7px; font-weight: 700; }

/* ─── POLISH ADDITIONS ─────────────────────────────────────── */

/* Sticky submit bar on long forms */
.form-sticky-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--hra-purple-border);
  padding: 16px 0;
  margin-top: 8px;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(30,3,72,0.10);
}

/* Additional status pill variants */
.status-pill.partially-matched { background: #FEF3C7; color: #92400E; }
.status-pill.fully-matched     { background: #D1FAE5; color: #065F46; }
.status-pill.in-transit        { background: #DBEAFE; color: #1E40AF; }
.status-pill.cancelled         { background: #F3F4F6; color: #6B7280; text-decoration: line-through; }
.status-pill.closed            { background: #F3F4F6; color: #4B5563; }
.status-pill.rejected          { background: #FEE2E2; color: #991B1B; }
.status-pill.approved          { background: #D1FAE5; color: #15803D; }
.status-pill.pending           { background: #FEF3C7; color: #92400E; }
.status-pill.normal            { background: #D1FAE5; color: #15803D; }
.status-pill.generator         { background: #FEF3C7; color: #D97706; }
.status-pill.partial           { background: #FEE2E2; color: #B45309; }
.status-pill.none              { background: #FEE2E2; color: #DC2626; }
.status-pill.unknown           { background: #F3F4F6; color: #6B7280; }

/* Spinner button states */
.btn[disabled] { opacity: 0.75; cursor: not-allowed; }

/* Better card focus outline for form cards */
.card:focus-within { box-shadow: 0 0 0 3px rgba(30,3,72,0.12), 0 2px 12px rgba(30,3,72,0.07); }

/* Badge step numbers */
.badge.bg-purple { background: var(--hra-purple) !important; }

/* Improved mobile nav */
@media (max-width: 992px) {
  .portal-navbar .navbar-collapse { background: var(--hra-purple-dark); border-radius: 0 0 16px 16px; padding: 12px 16px; }
  .portal-navbar .nav-link { padding: 8px 12px !important; }
}

/* Mobile portal layout */
@media (max-width: 768px) {
  .portal-main { padding: 16px 12px; }
  .page-header { margin-bottom: 20px; padding-bottom: 16px; }
  .page-header h1 { font-size: 1.2rem !important; }
  .stat-card { padding: 16px; }
  .stat-card .stat-number { font-size: 1.5rem; }
  .portal-table thead { display: none; }
  .portal-table tbody td { display: block; padding: 6px 16px; border: none; }
  .portal-table tbody td:first-child { padding-top: 14px; font-weight: 600; }
  .portal-table tbody td:last-child { padding-bottom: 14px; border-bottom: 1px solid #F0EAFF; }
  .need-card { padding: 16px; }
  .form-sticky-footer { padding: 12px 0; }
  /* Category grid on mobile - 2 per row */
  #requestForm .col-md-4.col-lg-3 { flex: 0 0 50%; max-width: 50%; }
}

@media (max-width: 480px) {
  #requestForm .col-md-4.col-lg-3 { flex: 0 0 100%; max-width: 100%; }
  .hero-content h1 { font-size: 2rem; }
}

/* Improved form section styling in category details */
.cat-section .form-label { font-size: 0.82rem; }
.cat-section .form-check-label { font-size: 0.85rem; }

/* Audit log table */
.audit-row td { font-size: 0.8rem; }
.audit-row code { font-size: 0.75rem; background: #F0EAFF; padding: 2px 6px; border-radius: 4px; }

/* Hover state on list-group items */
.list-group-item { transition: background 0.15s; }
.list-group-item:hover { background: #FAF8FF; }

/* Verified check icon */
.verified-icon { color: #15803D; font-size: 1rem; }

/* Print utilities */
@media print {
  .portal-navbar, .page-header .btn, .btn, nav { display: none !important; }
  .portal-main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ─── FOOTER ───────────────────────────────────────────────── */
.portal-footer {
  background: var(--hra-purple-dark);
  color: rgba(255,255,255,0.88);
  padding: 14px 24px;
  margin-top: auto;
  font-size: 0.78rem;
}
.portal-footer a { color: rgba(255,255,255,0.82); text-decoration: none; }
.portal-footer a:hover { color: #fff; }

/* ─── ACCESSIBILITY: contrast overrides ───────────────────── */
/* Bootstrap .text-white-50 fails WCAG AA on purple — override site-wide */
.text-white-50 { color: rgba(255,255,255,0.82) !important; }
/* Bootstrap .text-muted inside dark containers */
.portal-navbar .text-white-50,
.portal-footer .text-white-50,
nav .text-white-50 { color: rgba(255,255,255,0.82) !important; }
/* Ensure small secondary text meets 4.5:1 on white/light backgrounds */
.text-muted { color: #595959 !important; }  /* darkened from Bootstrap's #6c757d — passes AA */

/* === DARK MODE OVERRIDES === */
[data-bs-theme="dark"] .form-label{color:rgba(255,255,255,0.85)}
[data-bs-theme="dark"] .form-text{color:rgba(255,255,255,0.55)}
[data-bs-theme="dark"] .portal-main .page-title{color:rgba(255,255,255,0.9)}
[data-bs-theme="dark"] .page-subtitle{color:rgba(255,255,255,0.6)}
[data-bs-theme="dark"] .stat-card{background:#1e1e2e;border-color:rgba(168,85,247,0.3)}
[data-bs-theme="dark"] .stat-card .stat-label{color:rgba(255,255,255,0.55)}
[data-bs-theme="dark"] .stat-card .stat-number{color:rgba(255,255,255,0.9)}
[data-bs-theme="dark"] .card{background:#1e1e2e;border-color:rgba(168,85,247,0.25)}
[data-bs-theme="dark"] .card-header{background:rgba(107,33,168,0.3);color:#c4b5fd;border-bottom-color:rgba(168,85,247,0.25)}
[data-bs-theme="dark"] .portal-table thead th{background:rgba(107,33,168,0.3);color:#c4b5fd}
[data-bs-theme="dark"] .portal-table tbody td{border-color:rgba(168,85,247,0.15);color:rgba(255,255,255,0.85)}
[data-bs-theme="dark"] .portal-table tbody tr:hover{background:rgba(107,33,168,0.15)}
[data-bs-theme="dark"] .need-card{background:#1e1e2e;border-color:rgba(168,85,247,0.25)}
[data-bs-theme="dark"] .need-card .need-title{color:rgba(255,255,255,0.9)}
[data-bs-theme="dark"] .need-card .need-meta{color:rgba(255,255,255,0.55)}
[data-bs-theme="dark"] .category-badge{background:rgba(107,33,168,0.3);color:#c4b5fd}
[data-bs-theme="dark"] .empty-state{color:rgba(255,255,255,0.4)}
[data-bs-theme="dark"] .empty-state h5{color:rgba(255,255,255,0.6)}
[data-bs-theme="dark"] .form-sticky-footer{background:#121212;border-top-color:rgba(168,85,247,0.25)}
[data-bs-theme="dark"] .list-group-item{background:#1e1e2e;border-color:rgba(168,85,247,0.2);color:rgba(255,255,255,0.85)}
[data-bs-theme="dark"] .list-group-item:hover{background:rgba(107,33,168,0.2)}
[data-bs-theme="dark"] .page-header{border-bottom-color:rgba(168,85,247,0.2)}
[data-bs-theme="dark"] .audit-row code{background:rgba(107,33,168,0.3);color:#c4b5fd}
