/* =========================================
   1. Importación de Fuentes
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* =========================================
   2. Variables y Reset Global
   ========================================= */

main {
    --crebi-purple: #9B7CA8;
    --crebi-teal: #4ECDC4;
    --crebi-purple-dark: #7A5E8A;
    --crebi-teal-dark: #2EAAA3;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --border: rgba(155, 124, 168, 0.15);
    --gradient-purple: linear-gradient(135deg, #9B7CA8 0%, #7A5E8A 100%);
    --gradient-teal: linear-gradient(135deg, #4ECDC4 0%, #2EAAA3 100%);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(155, 124, 168, 0.2);
}


/* =========================================
   3. Cabecera (Titulo Zona)
   ========================================= */
.titulo-zona {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    animation: slideDown 0.8s ease-out;
}

.zone-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header-meta {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-meta .date {
    display: block;
    margin-bottom: 0.25rem;
}

.header-meta .update {
    color: var(--crebi-teal-dark);
    font-weight: 500;
}

/* =========================================
   4. Componentes Principales
   ========================================= */

/* Hero Image (por si se descomenta en el futuro) */
.hero-image-section {
    margin-bottom: 2.5rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: fadeIn 0.8s ease-out;
}

.hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.hero-image:hover {
    transform: scale(1.02);
}

/* Disclaimer Card */
.disclaimer-card {
    background: rgba(78, 205, 196, 0.08);
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    animation: fadeIn 0.8s ease-out;
}

.disclaimer-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.disclaimer-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.disclaimer-content strong {
    color: var(--crebi-teal-dark);
    font-weight: 600;
}

/* Context Card */
.context-card {

    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
    animation: fadeIn 0.9s ease-out;
}

.context-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.context-content {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    overflow: visible;
}

.context-content p {
    margin-bottom: 1rem;
}

/* CTA Section */
.cta-section {
    margin-bottom: 2.5rem;
    animation: fadeIn 1s ease-out;
}

.cta-button {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--gradient-purple);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(155, 124, 168, 0.3);
}

.cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(155, 124, 168, 0.4);
    color: white; /* Bootstrap override */
}

.cta-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.cta-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cta-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.cta-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
}

.cta-arrow {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.cta-button:hover .cta-arrow {
    transform: translateX(5px);
}

/* =========================================
   5. Indicadores (KPIs)
   ========================================= */
.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.kpi-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.6s ease-out backwards;
    box-shadow: var(--shadow);
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: var(--crebi-purple);
    box-shadow: var(--shadow-hover);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-purple);
    opacity: 0;
    transition: opacity 0.3s;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-header {
    margin-bottom: 1rem;
}

.kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 600;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    color: var(--crebi-purple);
}

.kpi-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =========================================
   6. Gráficos y Demografía
   ========================================= */
.chart-section-simple {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out backwards;
    box-shadow: var(--shadow);
}

.chart-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chart-header {
    margin-bottom: 2rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chart-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chart-body {
  position: relative;
  flex: 1;              /* 🔥 CLAVE */
  max-height: 300px;
}

.chart-body canvas {
  width: 100% !important;
  height: 100% !important;
}

/* =========================================
   7. Tráfico y Crecimiento (Métricas grandes)
   ========================================= */
.traffic-growth-section {
    margin-bottom: 3rem;
}

.traffic-growth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    gap: 1.5rem;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: var(--crebi-teal);
    box-shadow: var(--shadow-hover);
}

.metric-icon {
    font-size: 3rem;
    line-height: 1;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.metric-value-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--crebi-purple);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.metric-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.metric-trend-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.trend-fill {
    height: 100%;
    background: var(--gradient-teal);
    transition: width 1s ease-out;
}

.metric-note {
    font-size: 0.8rem;
    color: var(--crebi-teal-dark);
    font-weight: 500;
}

.growth-indicators {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.growth-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.growth-dot {
    width: 8px;
    height: 8px;
    background: var(--crebi-teal);
    border-radius: 50%;
    flex-shrink: 0;
}

/* =========================================
   8. Animaciones
   ========================================= */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Delays escalonados para las animaciones */
.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }
.kpi-card:nth-child(5) { animation-delay: 0.5s; }
.kpi-card:nth-child(6) { animation-delay: 0.6s; }

.chart-card:nth-child(1) { animation-delay: 0.7s; }
.chart-card:nth-child(2) { animation-delay: 0.8s; }

/* =========================================
   9. Responsive
   ========================================= */
@media (max-width: 1200px) {
    .chart-section-simple {
        grid-template-columns: 1fr;
    }
    .traffic-growth-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
  .chart-body {
    min-height:60px
  }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .titulo-zona {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .header-meta {
        text-align: center;
    }

    .zone-title {
        font-size: 2rem;
    }
    
    .cta-button {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .cta-arrow {
        transform: rotate(90deg);
    }
    
    .cta-button:hover .cta-arrow {
        transform: rotate(90deg) translateY(5px);
    }

    .size-btn {
        width: 100%;
    }
}

.context-content {
    max-height: none;
    overflow: visible;
    transition: max-height 0.4s ease;
    position: relative;
}

.context-content .collapsed {
    max-height: 250px;
    overflow: hidden;
}


.context-content .collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, transparent, white);
    pointer-events: none;
}

.context-content .expanded {
    max-height: none;
}

        .size-btn {
            padding: 0.875rem 1.5rem;
            border: 2px solid var(--border);
            background: var(--bg-secondary);
            border-radius: 12px;
            font-size: small;
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.25rem;
        }

        .size-btn:hover {
            border-color: var(--crebi-purple);
            background: white;
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }

        .size-btn.active {
            background: var(--gradient-purple);
            border-color: var(--crebi-purple);
            color: white;
            box-shadow: 0 4px 12px rgba(155, 124, 168, 0.3);
        }

        .filter-card {
            background: var(--card-bg);
            border: 2px solid var(--border);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 2.5rem;
            box-shadow: var(--shadow);
            animation: slideDown 0.8s ease-out;
        }

        /* Traffic and Growth Section */
        .traffic-growth-section {
            margin-bottom: 3rem;
        }

        .filter-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 1.5rem;
            color: var(--text-primary);
        }

        .size-filters {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
        }
