/* NHM-DCBMS Custom Styles */

/* ===== CSS Variables ===== */
:root {
    --primary: #1E3A5F;
    --accent: #2563EB;
    --nhm-green: #059669;
    --danger: #DC2626;
    --warning: #D97706;
    --dark-bg: #0A1628;
    --light-bg: #F8FAFC;
    --sidebar-w: 260px;
    --navbar-h: 64px;
}

/* ===== Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light-bg);
    color: #1E293B;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #F1F5F9; }
::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 3px; }

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

.app-sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.app-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-navbar {
    height: var(--navbar-h);
    background: white;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.app-content {
    flex: 1;
    padding: 24px;
}

/* ===== KPI Cards ===== */
.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #E2E8F0;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.kpi-card .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}
.kpi-card .kpi-label {
    font-size: 0.8rem;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}
.kpi-card .kpi-trend {
    font-size: 0.75rem;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
}
.kpi-trend.up { background: #DCFCE7; color: #16A34A; }
.kpi-trend.down { background: #FEE2E2; color: #DC2626; }

/* ===== Circular Progress ===== */
.circular-progress {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ===== Problem Dashboard Specific ===== */
.problem-bg {
    background: var(--dark-bg);
    color: white;
    min-height: 100vh;
}

.counter-dramatic {
    font-size: 4.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, #FF4444, #FF6B6B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pulse-red {
    animation: pulseRed 2s ease-in-out infinite;
}

@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
    50% { box-shadow: 0 0 20px 8px rgba(220,38,38,0.15); }
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #DC2626;
    animation: pulseDot 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

/* ===== Ticker ===== */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    background: rgba(220,38,38,0.1);
    border-top: 1px solid rgba(220,38,38,0.3);
    padding: 12px 0;
}
.ticker {
    display: inline-flex;
    white-space: nowrap;
    animation: ticker 40s linear infinite;
}
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===== Count-up Animation ===== */
.count-up {
    font-variant-numeric: tabular-nums;
}

/* ===== Chart Containers ===== */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #E2E8F0;
}
.chart-container h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 16px;
}

/* ===== Data Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table thead th {
    background: #F8FAFC;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #E2E8F0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: #F8FAFC;
}
.data-table tbody tr.receipt-row { background: rgba(5,150,105,0.04); }
.data-table tbody tr.payment-row { background: rgba(220,38,38,0.03); }

/* ===== Status Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-green { background: #DCFCE7; color: #16A34A; }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-amber { background: #FEF3C7; color: #D97706; }
.badge-blue { background: #DBEAFE; color: #2563EB; }
.badge-gray { background: #F1F5F9; color: #64748B; }

/* ===== Progress Bars ===== */
.progress-bar {
    height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar .fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    color: white;
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transform: translateX(120%);
    animation: toastIn 0.4s ease forwards;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}
.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}
.toast-success { background: linear-gradient(135deg, #059669, #10B981); }
.toast-error { background: linear-gradient(135deg, #DC2626, #EF4444); }
.toast-warning { background: linear-gradient(135deg, #D97706, #F59E0B); }
.toast-info { background: linear-gradient(135deg, #2563EB, #3B82F6); }
.toast-critical {
    background: linear-gradient(135deg, #991B1B, #DC2626);
    border: 1px solid #FCA5A5;
}

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #64748B;
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #CBD5E1; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #1D4ED8; }
.btn-green { background: var(--nhm-green); color: white; }
.btn-green:hover { background: #047857; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; }
.btn-outline {
    background: transparent;
    border: 1.5px solid #CBD5E1;
    color: #475569;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ===== FAB (Floating Action Button) ===== */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37,99,235,0.5);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s;
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

/* ===== Gantt Chart ===== */
.gantt-bar {
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gantt-bar.visible {
    opacity: 1;
    transform: scaleX(1);
}

/* ===== Map Styles ===== */
.district-path {
    stroke: #FFFFFF;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.3s ease;
}
.district-path:hover {
    stroke-width: 2.5;
    filter: brightness(1.15);
    transform-origin: center;
}

.map-tooltip {
    position: absolute;
    background: rgba(30,58,95,0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.2s;
    max-width: 280px;
}
.map-tooltip.visible { opacity: 1; }

/* ===== Activity Feed ===== */
.feed-item {
    padding: 12px 0;
    border-bottom: 1px solid #F1F5F9;
    display: flex;
    gap: 12px;
    font-size: 0.82rem;
}
.feed-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

/* ===== Fade In Animation ===== */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    animation: fadeIn 0.6s ease forwards;
}
@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }
.fade-in-delay-4 { animation-delay: 0.4s; }
.fade-in-delay-5 { animation-delay: 0.5s; }

/* ===== Slide In ===== */
.slide-in-left {
    opacity: 0;
    transform: translateX(-30px);
    animation: slideInLeft 0.5s ease forwards;
}
@keyframes slideInLeft {
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Hex Grid Background (Login) ===== */
.hex-bg {
    background-image:
        radial-gradient(circle at 20% 50%, rgba(5,150,105,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(37,99,235,0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(30,58,95,0.05) 0%, transparent 50%);
}

/* ===== Print Styles ===== */
@media print {
    .app-sidebar, .app-navbar, .fab, .toast-container, .no-print { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: white !important; }
}
