/* 
   ==========================================================================
   CLIMA INTELIGENTE - MODERN DESIGN SYSTEM
   ==========================================================================
*/

:root {
    /* Color Palette - Premium Slate & Emerald */
    --primary: #1a3a2d;
    --primary-light: #2d5a45;
    --brand-dark: #1a3a2d;
    --brand-light: #f2f3ee;
    --accent: #10b981;
    --background: #f9f9ff;

    /* Layout & Spacing */
    --radius-xl: 32px;
    --radius-lg: 24px;
    --shadow-premium: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', sans-serif;
    scroll-behavior: smooth;
}

.view-screen {
    transition: opacity 0.3s ease-in-out;
}

.screen-hidden {
    display: none !important;
}

/* Home Screen Specifics */
.bg-brand-dark {
    background-color: var(--brand-dark);
}

.bg-brand-light {
    background-color: var(--brand-light);
}

.text-brand-dark {
    color: var(--brand-dark);
}

.home-card {
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-card:hover {
    box-shadow: var(--shadow-premium);
    transform: translateY(-8px);
}

/* Analysis Report Styling */
.analysis-report-wrapper {
    /* Neutro layout container */
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}

.report-inner {
    padding: 0;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
}

.mini-map-container {
    position: relative;
    width: 200px;
    height: 130px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    background: #eee;
}

.mini-map {
    width: 100%;
    height: 100%;
}

.mini-map-attribution {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--brand-dark);
    z-index: 400;
    border-top-left-radius: 4px;
}

.premium-card {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid #eef2f7;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    padding: 2rem;
}

.intelligent-card {
    background: linear-gradient(135deg, #ffffff 0%, #f9fffb 100%);
    border-left: 6px solid var(--accent);
}

/* Autocomplete Premium Styling */
.suggestion-item {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f8fafc;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f1f5f9;
    padding-left: 1.75rem;
}

.suggestion-item span.match {
    font-weight: 900;
    color: var(--brand-dark);
}

/* Print Overrides */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .analysis-report-wrapper {
        box-shadow: none;
        border: none;
        border-radius: 0;
    }

    .report-inner {
        padding: 0;
    }
}

/* Smart Analysis Bullets Grid */
.findings-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .findings-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.summary-bullet-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-bullet-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--accent);
}

/* National Average Card - Neutral Version */
.national-average-card {
    display: inline-flex;
    flex-direction: column;
    background: #F4F6F5;
    border: 1px solid #eef2f7;
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    gap: 0.25rem;
}

.national-average-card .metric-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b; /* slate-500 */
}

.national-average-card .metric-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #0f172a; /* slate-900 */
    line-height: 1;
}

.national-average-card .metric-help {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b; /* slate-500 */
    opacity: 0.7;
}

/* Anomalies Summary Badges */
#anomalies-summary-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .analysis-header {
        flex-direction: column;
    }

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

    .report-inner {
        padding: 1.5rem;
    }

    .premium-card {
        padding: 1.5rem;
    }
}

/* Layering & Z-index Fixes */
#analysis-modal, 
#comparison-modal {
    z-index: 99999 !important;
}

#modal-overlay, 
#comparison-modal-overlay {
    z-index: 99998 !important;
}

.mini-map-container {
    z-index: 10;
}

.mini-map {
    z-index: 1;
}

/* Force Leaflet elements to stay in lower layer */
.mini-map .leaflet-pane {
    z-index: 1 !important;
}

.mini-map .leaflet-top,
.mini-map .leaflet-bottom {
    z-index: 2 !important;
}

/* Ensure modal content is above overlay */
#comparison-modal > div:last-child,
#analysis-modal > div:last-child {
    position: relative;
    z-index: 99999;
}

/* Collapsible Sections Logic */
.collapsible-card {
    padding: 0 !important;
    transition: all 0.3s ease;
}

.collapsible-summary {
    padding: 1rem 2rem !important; /* Compact vertical padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
    outline: none;
    user-select: none;
}

.collapsible-summary::-webkit-details-marker {
    display: none;
}

.collapsible-summary:hover {
    background-color: #f8fafc;
}

.expand-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.4;
    font-weight: 300;
}

.collapsible-card[open] .expand-icon {
    transform: rotate(180deg);
    opacity: 1;
}

.collapsible-card[open] .collapsible-summary {
    padding-bottom: 0.5rem !important;
}

.collapsible-body {
    padding: 1.25rem 2rem 2rem 2rem !important;
    border-top: 1px solid #f1f5f9;
}

/* Variable Analysis Chips */
.variable-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px; /* Pill shape */
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.variable-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Responsive Modal Adjustment */
@media (max-width: 768px) {
    .analysis-purpose-modal {
        max-height: 90vh !important;
        display: flex;
        flex-direction: column;
        margin: 1rem !important;
    }

    .analysis-purpose-modal-body {
        overflow-y: auto;
        padding: 1.5rem !important;
        -webkit-overflow-scrolling: touch;
    }

    .analysis-purpose-modal-body h2 {
        font-size: 1.875rem !important; /* 3xl instead of 4xl */
        line-height: 2.25rem !important;
    }

    .analysis-purpose-modal-body .analysis-option {
        padding: 1rem !important;
    }
}