* {
    box-sizing: border-box;
    font-family: "Segoe UI", Arial, sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    color: #ffffff;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1250px;
    padding: 20px;
}


/*HEADER & TABS */
.header {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-text h1 {
    margin: 0;
}

.header-text p {
    margin: 0;
    font-size: 14px;
    color: rgba(255,255,255,0.75);
}

.logo {
    width: 200px;
    margin-bottom: 10px;
}

.intro {
    margin: 20px auto 30px;
    max-width: 900px;
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255,255,255,0.85);
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.tab-btn {
    padding: 12px 25px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    white-space: nowrap; 
}

.tab-btn.active {
    background: #00c6ff;
    color: #000000;
    border-color: #00c6ff;
}


/*LAYOUT GENERAL*/
.card-layout {
    display: flex;
    justify-content: center;
    gap: 24px;
    width: 100%;
    flex-wrap: wrap; 
}

.section-guide {
    margin-bottom: 25px;
    text-align: center;
}

.section-guide p {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}

.grid-manual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
}

.card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%; 
}


/*FORMULARIOS*/
form label {
    display: block;
    margin-top: 15px;
    color: #00c6ff;
    font-weight: bold;
    font-size: 14px;
}

form input,
form select,
#clientId {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    border-radius: 8px;
    border: none;
    background: #ffffff;
    color: #333333;
}


/*ESTADÍSTICAS*/

.stats-title {
    max-width: 70%;
}

.stats-title h2 {
    margin-bottom: 0;
    color: #ffffff;
}

.stats-title .helper-text {
    margin-top: 20px;
    color: rgba(255,255,255,0.8);
}

.stats-wrapper {
    background: rgba(0, 0, 0, 0.2);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    text-align: center;
    color: #00c6ff;
    margin-bottom: 25px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 25px;
}

.chart-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 12px;
    height: auto; 
    min-height: 400px; /* CAMBIADO: reducido de 500px a 400px */
    display: flex;
    flex-direction: column;
}

.chart-card canvas {
    flex: 1; 
    min-height: 200px; /* CAMBIADO: reducido de 250px a 200px */
    max-height: 300px; 
    width: 100% !important; 
    height: auto !important;
} 


.chart-description {
    margin-top: auto; 
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0; 
}

.chart-description h4 {
    margin-bottom: 5px;
    font-weight: 600;
}

.chart-description p {
    margin: 4px 0;
}

.chart-description .insight,
.chart-description .implication {
    font-size: 0.85rem;
}

.chart-label {
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}



/*RESULTADOS & API*/
.resultado {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    background: rgba(0, 198, 255, 0.1);
    border: 1px solid #00c6ff;
}

#resultadoBusqueda p {
    margin: 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.api-box {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    color: #00ffcc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    font-size: 14px; 
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
}


/*BOTONES & UTILIDADES*/
button {
    margin-top: 25px;
    width: 100%;
    padding: 15px;
    background: #00c6ff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 198, 255, 0.4);
}

/* Botón pequeño en esquina para exportar */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 15px; 
    flex-wrap: wrap; 
}

.export-btn {
    width: auto;
    padding: 8px 12px;
    background: #00c6ff;
    border-radius: 6px;
    color: #0f130c;
    font-weight: bold;
    border: none;
    align-self: flex-start;
    margin-top: 0; 
}

.export-btn:hover {
    background: #2ecc71;
}

.hidden {
    display: none;
}

.error {
    color: #ff6b6b;
    font-weight: bold;
}

/*FOOTER*/
.footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-small {
    font-size: 12px;
    opacity: 0.6;
}


/*RESPONSIVE*/

/* TABLET GRANDE (≤1024px) */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr; /* Una columna en tablets */
    }
    
    .chart-card {
        min-height: 350px; /* Altura menor en tablets */
    }
}

/* TABLET Y MOBILE (≤900px) */
@media (max-width: 900px) {

    .grid-manual,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card-layout {
        flex-direction: column;
    }

    .header-left {
        flex-direction: column;
        text-align: center;
    }
    
    .logo {
        width: 150px;
    }
    
    .container {
        padding: 15px;
    }
}


/*MOBILE PEQUEÑO (≤700px)*/
@media (max-width: 700px) {

    .tabs {
        flex-wrap: wrap;
    }

    .stats-header {
        flex-direction: column;
        gap: 15px;
    }

    .stats-title {
        max-width: 100%;
        text-align: center;
    }

    .export-btn {
        align-self: center;
        width: 100%; 
    }

    .helper-text {
        font-size: 13px;
    }
    
    .card {
        padding: 20px;
    }
    
    .chart-card {
        min-height: 300px;
        padding: 15px;
    }
    
    .chart-card canvas {
        min-height: 150px;
    }
    
    .logo {
        width: 120px;
    }
    
    .header-text h1 {
        font-size: 1.5rem;
    }
    
    .header-text h3 {
        font-size: 1rem;
    }
}

/* MOBILE MUY PEQUEÑO (≤480px) */
@media (max-width: 480px) {
    .tabs {
        gap: 8px;
        padding: 8px;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .api-box {
        font-size: 12px;
        padding: 10px;
    }
}