/* ===== PALETA CORPORATIVA ===== */
:root {
    --bg-body: #0b132b;
    --bg-card: #1c2541;
    --bg-card-hover: #232d4d;
    --text-primary: #ffffff;
    --text-secondary: #9aa8c3;
    --border-light: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
    --radius-card: 24px;
    --radius-btn: 40px;
    --brand-gold: #f5a623;
    --brand-gold-hover: #d98e19;
    --blue-accent: #3a86ff;
    --blue-hover: #2563eb;
    --green-accent: #10b981;
    --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: "Playfair Display", serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 24px 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* ===== HEADER ===== */
.header {
    margin-bottom: 28px;
}

.header-left h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.header-left h1 i {
    color: var(--brand-gold);
}

.header-left p {
    color: var(--text-secondary);
    font-size: 0.98rem;
    margin-top: 4px;
}

.header a {
    color: var(--blue-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 8px;
}

.header a:hover {
    color: var(--brand-gold);
}

/* ===== FORMULARIO ===== */
#calculator {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 32px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-group label .material-icons {
    font-size: 1.2rem;
    color: var(--brand-gold);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

.form-group select[multiple] {
    min-height: 100px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2);
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-accent), var(--blue-hover));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(58, 134, 255, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background: linear-gradient(
        135deg,
        var(--brand-gold),
        var(--brand-gold-hover)
    );
    color: #0b132b;
    font-weight: 700;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 166, 35, 0.4);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== FORM ACTIONS (Botones) ===== */
.form-actions {
    display: flex;
    gap: 16px; /* El espacio vital entre los botones */
    margin-top: 32px; /* Separación respecto a los campos de arriba */
}

/* Como .btn ya tiene width: 100%, flexbox hará que ambos ocupen 50% en escritorio */

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-outline:hover {
    border-color: var(--brand-gold);
    color: var(--brand-gold);
    background: rgba(245, 166, 35, 0.05);
    transform: translateY(-2px);
}

/* ===== RESULTADOS ===== */
#resultados {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 2px solid var(--border-light);
}

.resultado-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.resultado-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

.badge {
    background: var(--brand-gold);
    color: #0b132b;
    padding: 4px 16px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.8rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.metric-card .value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
}

.metric-card .value.blue {
    color: var(--blue-accent);
}

.metric-card .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.total-row.total-final {
    border-top: 2px solid var(--border-light);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.total-row.total-final span {
    color: var(--text-primary);
}

.total-row.total-final #resultTotal {
    color: var(--brand-gold);
}

.recomendaciones {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 20px;
    border-radius: 16px;
    border-left: 4px solid var(--brand-gold);
    margin-bottom: 16px;
}

.recomendaciones h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.recomendaciones ul {
    margin: 0;
    padding-left: 20px;
}

.recomendaciones li {
    margin-bottom: 4px;
    color: var(--text-secondary);
}

/* ===== SPINNER ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 40px;
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

.footer a {
    color: var(--brand-gold);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* =========================================
   TABLA DE PRESUPUESTO (Respiración y diseño)
========================================= */
.contenedor-tabla {
    background: rgba(255, 255, 255, 0.03); /* Fondo sutil que agrupa los datos */
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tabla-presupuesto {
    width: 100%;
    border-collapse: collapse;
}

/* Aire entre las filas */
.tabla-presupuesto td {
    padding: 1rem 0.5rem; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.05rem;
}

/* Alineación de iconos y texto */
.col-concepto {
    display: flex;
    align-items: center;
    gap: 12px; /* Separación exacta entre el icono y el texto */
    color: #e2e8f0;
}

.col-concepto .material-icons {
    color: #60a5fa; /* Azul profesional para los iconos, cámbialo si tu tema es distinto */
    font-size: 22px;
}

/* Alineación de precios */
.col-monto {
    text-align: right;
    font-family: 'Courier New', Courier, monospace; /* Ayuda a que los números se vean tabulados */
    letter-spacing: 0.5px;
}

/* Fila del total */
.fila-total td {
    border-bottom: none;
    padding-top: 1.8rem; /* Más separación antes del total */
}

.total-destacado {
    color: #10b981; /* Verde éxito */
    font-weight: 700;
    font-size: 1.35rem !important;
}

/* =========================================
   ESPACIADO PARA LISTAS Y RECOMENDACIONES
========================================= */
.espaciado-seccion {
    margin-bottom: 2.5rem; /* Separación amplia entre bloques */
}

/* Darle respiro a los items de las listas */
#detallesList li, 
#recomendacionesList li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    padding-left: 8px;
}

/* Opcional: darle un fondo distintivo a las recomendaciones */
#recomendacionesContainer {
    background: rgba(245, 158, 11, 0.05);
    border-left: 4px solid #f59e0b;
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .header-left h1 {
        font-size: 1.8rem;
    }
    #calculator {
        padding: 20px;
    }
    
    /* Añade esto: */
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 12px;
    }
    .header-left h1 {
        font-size: 1.4rem;
    }
    #calculator {
        padding: 16px;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
