/* ============================================
   ClimaInsight Assessment Page Styles
   ============================================ */

:root {
    --navy-900: #060d1b;
    --navy-800: #0a1628;
    --navy-700: #0f1d32;
    --navy-600: #142640;
    --navy-500: #1e3a5f;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --teal-500: #14b8a6;
    --teal-400: #2dd4bf;
    --teal-600: #0d9488;
    --blue-500: #0ea5e9;
    --amber-500: #f59e0b;
    --red-500: #ef4444;
    --green-500: #22c55e;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; }

body {
    font-family: var(--font-sans);
    color: var(--navy-800);
    line-height: 1.6;
    background: var(--slate-50);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 12px 0;
    background: rgba(6, 13, 27, 0.95);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon { color: var(--teal-400); display: flex; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link {
    color: var(--slate-300);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition);
}

.nav-link:hover { color: var(--white); }

/* --- Form Section --- */
.section-form {
    padding: 120px 0 60px;
    min-height: 100vh;
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
}

.badge {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(20, 184, 166, 0.2);
    border-radius: 16px;
    color: var(--teal-600);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.form-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--navy-800);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.form-header p {
    font-size: 1.05rem;
    color: #64748b;
}

/* Step indicator bar */
.steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 640px;
    margin: 0 auto 32px;
    padding: 16px 24px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--slate-100);
    color: var(--slate-400);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-item span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--slate-400);
    white-space: nowrap;
}

.step-item.active .step-num {
    background: var(--teal-500);
    color: var(--white);
}

.step-item.active span {
    color: var(--navy-800);
}

.step-connector-line {
    flex: 1;
    height: 2px;
    background: var(--slate-200);
    margin: 0 12px;
    min-width: 20px;
}

@media (max-width: 600px) {
    .steps-bar {
        padding: 12px 16px;
    }

    .step-item span {
        display: none;
    }

    .step-connector-line {
        margin: 0 8px;
    }
}

.screening-note {
    max-width: 640px;
    margin: 32px auto 0;
    font-size: 0.88rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.7;
}

.screening-note a {
    color: #2dd4bf;
    text-decoration: none;
}

.screening-note a:hover {
    text-decoration: underline;
}

.form-card {
    max-width: 640px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--slate-200);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.form-body {
    padding: 32px;
}

.input-section { margin-bottom: 28px; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--navy-800);
    margin-bottom: 4px;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--slate-400);
    margin-bottom: 10px;
}

.textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--slate-200);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--navy-800);
    background: var(--slate-50);
    resize: vertical;
    outline: none;
    transition: all var(--transition);
}

.textarea:focus {
    border-color: var(--teal-500);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.code-count {
    font-size: 0.8rem;
    color: var(--slate-400);
    font-weight: 500;
}

.code-count.over-limit {
    color: var(--red-500);
    font-weight: 700;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-btn:hover {
    border-color: var(--teal-500);
    color: var(--teal-600);
}

/* Hazard options */
.hazard-section { margin-bottom: 28px; }

.hazard-options {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.hazard-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 1.5px solid var(--slate-200);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.hazard-option input { display: none; }

.hazard-option span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
}

.hazard-option.active {
    border-color: var(--teal-500);
    background: rgba(20, 184, 166, 0.04);
}

.hazard-option.active span { color: var(--teal-600); }

.hazard-option:hover { border-color: var(--teal-400); }

.hazard-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.hazard-icon.flood { background: rgba(14, 165, 233, 0.1); color: var(--blue-500); }
.hazard-icon.wildfire { background: rgba(245, 158, 11, 0.1); color: var(--amber-500); }
.hazard-icon.heat { background: rgba(239, 68, 68, 0.1); color: var(--red-500); }

.error-msg {
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: var(--red-500);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.btn-assess {
    width: 100%;
    padding: 14px;
    background: var(--teal-500);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-assess:hover { background: var(--teal-600); }
.btn-assess:disabled { opacity: 0.7; cursor: not-allowed; }

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Results Section --- */
.section-results {
    padding: 90px 0 60px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--navy-800);
    letter-spacing: -0.02em;
}

.results-title p {
    color: #64748b;
    font-size: 0.95rem;
}

.results-actions {
    display: flex;
    gap: 10px;
}

.btn-download, .btn-new {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.btn-download {
    background: var(--teal-500);
    color: var(--white);
}

.btn-download:hover {
    background: var(--teal-600);
}

.btn-new {
    background: var(--white);
    color: var(--navy-800);
    border: 1.5px solid var(--slate-200);
}

.btn-new:hover {
    border-color: var(--teal-500);
    color: var(--teal-600);
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.summary-value {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy-800);
}

/* Risk color classes */
.risk-critical { color: #ef4444 !important; }
.risk-high { color: #f97316 !important; }
.risk-medium { color: #f59e0b !important; }
.risk-low { color: #22c55e !important; }

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.panel {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-100);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy-800);
}

.map-container {
    height: 450px;
    width: 100%;
}

.map-container .leaflet-control-attribution {
    font-size: 9px;
    opacity: 0.5;
    background: rgba(255,255,255,0.4);
    padding: 1px 4px;
}

.chart-container {
    padding: 12px;
}

/* Map legend */
.map-legend {
    display: flex;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.5);
}

.dot-critical { background: #ef4444; }
.dot-high { background: #f97316; }
.dot-medium { background: #f59e0b; }
.dot-low { background: #22c55e; }

/* Data table */
.panel-table { margin-bottom: 24px; }

.table-wrap { overflow-x: auto; }

.risk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.risk-table th {
    padding: 12px 16px;
    background: var(--slate-50);
    font-weight: 700;
    color: var(--navy-800);
    text-align: left;
    border-bottom: 2px solid var(--slate-200);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.risk-table th:hover { color: var(--teal-600); }

.sort-icon {
    font-size: 0.7rem;
    color: var(--teal-500);
    margin-left: 2px;
}

.risk-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--navy-800);
}

.risk-table tbody tr:hover {
    background: rgba(20, 184, 166, 0.03);
}

.mono { font-family: var(--font-mono); font-size: 0.8rem; }

/* Severity badges */
.severity-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sev-high { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.sev-medium { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.sev-low { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.sev-none { background: var(--slate-100); color: var(--slate-400); }

.category-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.cat-critical { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.cat-high { background: rgba(249, 115, 22, 0.1); color: #ea580c; }
.cat-medium { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.cat-low { background: rgba(34, 197, 94, 0.1); color: #16a34a; }

/* Email capture card */
.email-capture-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px;
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    border-radius: 14px;
    margin-bottom: 20px;
}

.email-capture-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(20, 184, 166, 0.1);
    color: var(--teal-500);
    margin-bottom: 16px;
}

.email-capture-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-800);
    margin-bottom: 6px;
}

.email-capture-content p {
    font-size: 0.9rem;
    color: #64748b;
    max-width: 480px;
    margin-bottom: 20px;
}

.email-capture-form {
    width: 100%;
    max-width: 440px;
}

.email-input-group {
    display: flex;
    gap: 8px;
}

.email-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--slate-200);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--navy-800);
    outline: none;
    transition: all var(--transition);
}

.email-input::placeholder {
    color: var(--slate-400);
}

.email-input:focus {
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.btn-send-report {
    padding: 10px 20px;
    background: var(--teal-500);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-send-report:hover {
    background: var(--teal-600);
}

.btn-send-report:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.email-hint {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--slate-400);
}

.email-success {
    flex-direction: row;
    gap: 12px;
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.04);
    color: #16a34a;
}

.email-success p {
    font-size: 0.9rem;
    color: #16a34a;
    margin: 0;
}

.email-success strong {
    font-weight: 700;
}

@media (max-width: 480px) {
    .email-input-group {
        flex-direction: column;
    }

    .email-capture-card {
        padding: 24px 20px;
    }
}

/* Upgrade banner */
.upgrade-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px;
    background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
    border-radius: 14px;
    margin-top: 8px;
}

.upgrade-content h3 {
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.upgrade-content p {
    color: var(--slate-400);
    font-size: 0.9rem;
}

.btn-upgrade {
    padding: 10px 24px;
    background: var(--teal-500);
    color: var(--white);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-upgrade:hover {
    background: var(--teal-600);
    transform: translateY(-1px);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .map-container { height: 350px; }

    .hazard-options {
        flex-direction: column;
    }

    .results-header {
        flex-direction: column;
    }

    .upgrade-banner {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .nav-right { gap: 16px; }
}

@media (max-width: 480px) {
    .summary-cards { grid-template-columns: 1fr; }
    .section-form { padding: 100px 0 40px; }
    .form-body { padding: 20px; }
}
