/* Affordability Lab Add-ons CSS */

/* --- Map & Dashboard Styles (Adapted from Young Adult Map) --- */
:root {
    /* Ensure these variables exist or map them */
    --map-primary: #3B82F6;
    --map-primary-dark: #2563EB;
    --map-green: #10B981;
    --map-yellow: #F59E0B;
    --map-red: #EF4444;
    --map-radius: 12px;
}

#financial-health-map {
    background: var(--surface-color);
    padding: 80px 0;
}

#financial-health-map h2 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.15;
    text-align: center;
}

#financial-health-map .intro-text {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
    color: var(--text-muted);
}

/* Indicator Toggle */
.indicator-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.toggle-container {
    display: inline-flex;
    background: var(--white);
    border-radius: 100px;
    padding: 4px;
    gap: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.toggle-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    border-radius: 100px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.toggle-btn:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.05);
}

.toggle-btn.active {
    background: var(--text-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.summary-card {
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--map-radius);
    padding: 1.25rem;
    transition: all 0.25s ease;
    cursor: pointer;
    text-align: center;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.summary-card.active {
    border-color: var(--text-color);
    box-shadow: 0 0 0 2px var(--text-color);
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--map-primary);
}

.summary-change {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.summary-change.up {
    color: var(--map-red);
}

.summary-change.down {
    color: var(--map-green);
}

/* Map Container */
.map-container {
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--map-radius);
    padding: 2rem;
    position: relative;
    max-width: 960px;
    margin: 0 auto;
}

#us-map {
    width: 100%;
    height: auto;
    display: block;
}

#us-map svg {
    width: 100%;
    height: auto;
}

#us-map path {
    transition: all 0.25s ease;
    cursor: pointer;
    stroke: var(--white);
    stroke-width: 1;
}

#us-map path:hover {
    opacity: 0.85;
    stroke-width: 2;
    filter: brightness(1.1);
}

/* Tooltip */
.state-tooltip {
    position: fixed;
    background: var(--text-color);
    color: var(--white);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.state-tooltip.visible {
    opacity: 1;
}

.tooltip-state {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tooltip-value {
    opacity: 0.9;
    color: var(--accent-color);
    font-weight: 600;
}

/* Legend */
.map-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 20px;
    height: 10px;
    border-radius: 3px;
}

.legend-low {
    background: var(--map-green);
}

.legend-moderate {
    background: var(--map-yellow);
}

.legend-elevated {
    background: #F97316;
}

.legend-high {
    background: var(--map-red);
}

/* State Detail Panel */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.panel-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.state-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--white);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding: 2rem;
    z-index: 2001;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
}

.state-panel.open {
    right: 0;
}

.panel-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--surface-color);
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.panel-close:hover {
    background: var(--text-color);
    color: var(--white);
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
    color: var(--text-color);
}

.panel-indicators {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-indicator {
    padding: 1rem;
    background: var(--surface-color);
    border-radius: var(--map-radius);
    border-left: 4px solid var(--map-primary);
}

.panel-indicator-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.panel-indicator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-indicator-value {
    font-size: 1.25rem;
    font-weight: 800;
}

.panel-indicator-meta {
    text-align: right;
    font-size: 0.75rem;
}

.panel-rank {
    font-weight: 700;
    color: var(--map-primary);
}

.panel-change {
    color: var(--text-muted);
}

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

    .state-panel {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 500px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .toggle-container {
        gap: 2px;
    }

    .toggle-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }
}


/* --- Suggestion Form Styles (Modern Premium) --- */
#suggest-challenge {
    padding: 100px 0;
    background: linear-gradient(to bottom, var(--white), var(--surface-color));
}

#suggest-challenge h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    text-align: center;
    letter-spacing: -0.02em;
    color: var(--black);
}

.intro-text {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* --- CTA Section --- */
#suggest-challenge-cta {
    padding: 60px 0;
    background: var(--surface-color);
}

.cta-card {
    background: var(--white);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

.cta-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.cta-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    /* Scroll if tall */
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.visible .modal-content {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--surface-color);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.modal-close:hover {
    background: var(--text-color);
    color: var(--white);
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.suggestion-form-modal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group.full-width,
.btn-submit {
    grid-column: 1 / -1;
}

.map-header-action {
    text-align: center;
    margin-bottom: 2rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    font-weight: 600;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: var(--text-color);
    color: var(--white);
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid #E5E7EB;
    /* Light gray border */
    border-radius: 12px;
    background: #F9FAFB;
    /* Very light gray background */
    color: var(--text-color);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #9CA3AF;
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: #D1D5DB;
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-color);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
    /* Soft focus ring */
}

.form-group textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.5;
}

.btn-submit {
    width: 100%;
    background: var(--black);
    color: var(--white);
    padding: 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    /* Removed uppercase */
    letter-spacing: normal;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-submit:hover {
    background: #2563EB;
    /* Vibrant Blue on hover */
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--text-muted);
}

/* Success/Error States */
.form-status {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.form-status.success {
    background: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.form-status.error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

@media (max-width: 600px) {
    .suggestion-form {
        padding: 1.5rem;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    #suggest-challenge {
        padding: 60px 0;
    }
}