/* =========================================
   VARIABLES & CONFIGURACIÓN BASE
   ========================================= */
:root {
    --primary: #009c78;
    --primary-dark: #007e61;
    --accent: #ffdc00;
    --red: #88201e;
    --bg-body: #f0f4f3;
    --white: #ffffff;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 15px 35px rgba(0, 156, 120, 0.15);
    --radius: 20px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    background-image: radial-gradient(circle at 10% 20%, rgba(0, 156, 120, 0.05) 0%, transparent 20%);
    color: #333;
    margin: 0;
    padding: 0; /* Removido para que el footer toque los bordes */
    display: flex;
    flex-direction: column; /* CORRECCIÓN: Apila los elementos verticalmente */
    min-height: 100vh;
}

/* =========================================
   CONTENEDOR PRINCIPAL
   ========================================= */
.main-container {
    background: var(--white);
    max-width: 1000px;
    width: 90%; /* CORRECCIÓN: Mejor adaptabilidad */
    margin: 50px auto; /* CORRECCIÓN: Centra el contenedor y lo separa del top/bottom */
    padding: 50px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.8s ease-out;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    margin-bottom: 40px;
    text-align: center; /* CORRECCIÓN: Centrar el header se ve más limpio */
}

header h1 {
    color: var(--primary);
    margin: 0;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.5px;
}

header p {
    color: #777;
    font-size: 1.1rem;
    margin-top: 5px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
    align-items: start;
}

/* =========================================
   SECCIÓN: FORMULARIO
   ========================================= */
.input-section {
    background: #fafafa;
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid #eee;
}

.input-section h2 {
    font-size: 1.1rem;
    color: var(--red);
    margin: 0 0 25px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 3px solid var(--accent);
    display: inline-block;
    padding-bottom: 5px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
}

input, select {
    width: 100%;
    padding: 14px;
    border: 2px solid #e1e1e1;
    border-radius: 12px;
    font-size: 1rem;
    background: var(--white);
    transition: var(--transition);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 156, 120, 0.1);
}

#grupoBaterias {
    padding-left: 15px;
    border-left: 3px solid var(--accent);
    margin-top: 15px;
    background: #fff9db;
    border-radius: 0 10px 10px 0;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

button {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 156, 120, 0.3);
}

button:active {
    transform: translateY(0);
}

/* =========================================
   SECCIÓN: RESULTADOS
   ========================================= */
.results-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 20px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 18px;
    text-align: center;
    border: 1px solid #f0f0f0;
    border-left: 6px solid var(--primary);
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card:hover {
    transform: translateY(-7px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.icon { 
    font-size: 2.2rem; 
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.card:hover .icon {
    transform: scale(1.2) rotate(5deg);
}

.card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
    margin: 0;
    font-weight: 600;
}

.card p {
    font-size: 1.4rem; /* Ligeramente reducido para que quepan los MWh */
    font-weight: 700;
    margin: 8px 0;
    color: #333;
}

.card small {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    color: #999;
}

/* Tarjetas ROI (Rojas) */
.card.roi-card { border-left-color: var(--red); }
.card.roi-card p { color: var(--red); }

/* CORRECCIÓN: Aplicar estilo a todos los span de ahorro, no a un ID único */
.card.roi-card span {
    font-size: 0.9rem;
    color: #666;
    background: #fff5f5;
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 5px;
    display: inline-block;
}

/* Tarjeta Ecológica (Amarilla) */
.card.env-card { 
    border-left-color: var(--accent); 
    grid-column: span 2; 
    background: linear-gradient(to right, #ffffff, #fffff0);
    flex-direction: row; 
    justify-content: space-between;
    padding: 20px 40px;
    align-items: center;
}

.card.env-card h3 {
    text-align: left;
    margin-right: 20px;
}

.env-data {
    display: flex;
    gap: 30px;
}

.env-data p { 
    font-size: 1.1rem; 
    color: #555; 
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 50px 20px 20px 20px;
    margin-top: auto; /* CORRECCIÓN: Empuja el footer siempre al fondo */
    font-family: 'Poppins', sans-serif;
    width: 100%;
    box-sizing: border-box;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 30px;
}

.footer-column h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #f1c40f;
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column ul li {
    margin-bottom: 12px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-column ul li a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-column ul li a:hover {
    color: #f1c40f;
}

.footer-logo {
    max-width: 180px; 
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.footer-brand {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* =========================================
   RESPONSIVE (MÓVIL)
   ========================================= */
@media (max-width: 900px) {
    .main-container { padding: 30px; width: 95%; }
    .calculator-grid { 
        grid-template-columns: 1fr; 
        gap: 40px;
    }
    
    .card.env-card {
        flex-direction: column; 
        text-align: center;
        gap: 15px;
    }
    .card.env-card h3 { margin-right: 0; text-align: center; }
}

@media (max-width: 768px) {
    .footer-container { text-align: center; }
    .footer-brand { align-items: center; }
}

@media (max-width: 600px) {
    .main-container { margin: 20px auto; padding: 20px; border-radius: 15px; }
    header h1 { font-size: 1.6rem; }
    
    .results-section { grid-template-columns: 1fr; }
    .card.env-card { grid-column: span 1; padding: 20px; }
    
    .env-data {
        flex-direction: column;
        gap: 10px;
    }
}