body { min-height: 100vh; overflow-x: hidden; }

/* ===== FOOTER ===== (la base está en /css/footer.css; aquí solo se sube de capa) */
.footer { position: relative; z-index: 1; }

/* ===== MAIN LAYOUT ===== */
.main {
    padding-top: 5rem;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    padding: 3rem 2rem 2rem;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.page-header h1 .gold { color: var(--gold); }

.page-header p {
    color: var(--cream);
    opacity: 0.55;
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
    font-weight: 300;
}

.calculator-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* ===== INPUT PANEL ===== */
.input-panel {
    background: rgba(42, 16, 21, 0.7);
    border: 1px solid rgba(123, 45, 53, 0.25);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 5rem;
}

.input-panel-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.input-panel-sub {
    font-size: 0.85rem;
    color: var(--cream);
    opacity: 0.55;
    margin-bottom: 1.8rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.form-label label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--cream);
    opacity: 0.8;
}

.form-label .current-val {
    font-family: var(--font-num); font-variant-numeric: tabular-nums;
    font-size: 0.88rem;
    color: var(--gold);
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(201, 168, 76, 0.3);
    outline: none;
    text-align: right;
    width: 80px;
    padding: 0 2px 2px;
    cursor: text;
    transition: border-color 0.2s;
}

.form-label .current-val:focus {
    border-bottom-color: var(--gold);
}

.input-wrapper { display: none; }

.input-wrapper .prefix,
.input-wrapper .suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--cream);
    opacity: 0.55;
    pointer-events: none;
}

.input-wrapper .prefix { left: 1rem; }
.input-wrapper .suffix { right: 1rem; }

.form-input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(26, 10, 14, 0.6);
    border: 1px solid rgba(123, 45, 53, 0.3);
    border-radius: 10px;
    color: var(--cream);
    font-size: 1rem;
    font-family: var(--font-num); font-variant-numeric: tabular-nums;
    font-weight: 500;
    outline: none;
    transition: all 0.3s;
}

.form-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.form-input.has-prefix { padding-left: 2rem; }
.form-input.has-suffix { padding-right: 2.5rem; }

/* Range slider */
.range-container {
    margin-top: 0.5rem;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(123, 45, 53, 0.3);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(201, 168, 76, 0.4);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(201, 168, 76, 0.4);
}

/* Toggle / Select */
.toggle-group {
    display: flex;
    gap: 0.5rem;
    background: rgba(26, 10, 14, 0.5);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid rgba(123, 45, 53, 0.2);
}

.toggle-option {
    flex: 1;
    padding: 0.65rem 0.5rem;
    text-align: center;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--cream);
    opacity: 0.55;
    transition: all 0.3s;
    font-family: var(--font-sans);
}

.toggle-option.active {
    background: var(--burgundy);
    opacity: 1;
    color: var(--white);
    box-shadow: 0 2px 10px rgba(123, 45, 53, 0.3);
}

.toggle-option:hover:not(.active) {
    opacity: 0.8;
}

.toggle-option .toggle-icon {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

/* Preset buttons */
.presets {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(123, 45, 53, 0.3);
    background: transparent;
    color: var(--cream);
    opacity: 0.6;
    transition: all 0.3s;
    font-family: var(--font-sans);
}

.preset-btn:hover {
    border-color: var(--gold);
    opacity: 1;
    color: var(--gold);
}

/* Calculate button */
.btn-calculate {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.3);
    margin-top: 0.5rem;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(201, 168, 76, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* ===== RESULTS PANEL ===== */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.summary-card {
    background: rgba(42, 16, 21, 0.7);
    border: 1px solid rgba(123, 45, 53, 0.2);
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s;
}

.summary-card:hover {
    border-color: rgba(201, 168, 76, 0.3);
}

.summary-card.highlight {
    border-color: var(--gold);
    background: rgba(42, 16, 21, 0.9);
}

.summary-card .sc-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cream);
    opacity: 0.55;
    margin-bottom: 0.5rem;
}

.summary-card .sc-value {
    font-family: var(--font-num); font-variant-numeric: tabular-nums;
    font-size: 1.3rem;
    font-weight: 700;
}

.summary-card .sc-value.gold { color: var(--gold); }
.summary-card .sc-value.green { color: var(--success); }
.summary-card .sc-value.cream { color: var(--cream); }

.summary-card .sc-sub {
    font-size: 0.75rem;
    color: var(--cream);
    opacity: 0.55;
    margin-top: 0.25rem;
}

/* Chart area */
.chart-card {
    background: rgba(42, 16, 21, 0.7);
    border: 1px solid rgba(123, 45, 53, 0.25);
    border-radius: 16px;
    padding: 1.5rem;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.chart-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--cream);
    opacity: 0.6;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.chart-canvas-wrap {
    position: relative;
    height: 220px;
}

.chart-canvas-wrap canvas {
    width: 100%;
    height: 100%;
}

/* Breakdown table */
.breakdown-card {
    background: rgba(42, 16, 21, 0.7);
    border: 1px solid rgba(123, 45, 53, 0.25);
    border-radius: 16px;
    overflow: hidden;
}

.breakdown-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(123, 45, 53, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.breakdown-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
}

.breakdown-toggle {
    font-size: 0.8rem;
    color: var(--gold);
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-sans);
    opacity: 0.7;
    transition: opacity 0.3s;
}

.breakdown-toggle:hover { opacity: 1; }

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.breakdown-table thead th {
    padding: 0.8rem 1.5rem;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cream);
    opacity: 0.55;
    font-weight: 500;
    border-bottom: 1px solid rgba(123, 45, 53, 0.15);
}

.breakdown-table tbody td {
    padding: 0.7rem 1.5rem;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(123, 45, 53, 0.08);
    font-family: var(--font-num); font-variant-numeric: tabular-nums;
}

.breakdown-table tbody tr {
    transition: background 0.2s;
}

.breakdown-table tbody tr:hover {
    background: rgba(123, 45, 53, 0.1);
}

.breakdown-table .year-col {
    color: var(--cream);
    opacity: 0.6;
}

.breakdown-table .pos { color: var(--success); }
.breakdown-table .gold-text { color: var(--gold); }

.breakdown-scroll {
    max-height: 280px;
    overflow-y: auto;
}

/* ===== INFO SECTION ===== */
.info-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.info-card {
    background: rgba(42, 16, 21, 0.5);
    border: 1px solid rgba(123, 45, 53, 0.2);
    border-radius: 14px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.info-card:hover {
    border-color: rgba(201, 168, 76, 0.3);
}

.info-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.info-card h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    font-size: 0.85rem;
    color: var(--cream);
    opacity: 0.55;
    line-height: 1.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .calculator-container {
        grid-template-columns: 1fr;
    }
    .input-panel {
        position: static;
    }
    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    .navbar { padding: 0.8rem 1rem; }
    .calculator-container { padding: 0 1rem 3rem; }
}

/* ===== ANIMATIONS ===== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s ease-out forwards;
}

.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.2s; }
.fade-in:nth-child(4) { animation-delay: 0.3s; }

@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-animate {
    animation: countUp 0.5s ease-out forwards;
}

/* Tooltip */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(123, 45, 53, 0.3);
    font-size: 0.6rem;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 0.3rem;
}

.tooltip-trigger:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid rgba(123, 45, 53, 0.4);
    color: var(--cream);
    font-size: 0.75rem;
    font-weight: 400;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
/* ===== NAVBAR SCROLL ===== (la base está en /css/navbar.css; aquí el fondo es algo más opaco) */
.navbar.scrolled { background: rgba(26, 10, 14, 0.97) !important; }

/* ===== SLIDER-ONLY INPUT STYLE ===== */

.slider-section-label {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 2px;
    color: var(--gold); font-weight: 600; margin: 1.5rem 0 1rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.slider-section-label::before { content: '—'; opacity: 0.6; }

.form-label {
    margin-bottom: 0.8rem;
}
.form-label label {
    font-size: 0.88rem;
}
.form-label .current-val {
    font-size: 0.95rem;
    font-weight: 600;
}

/* ===== MAIN z-index ===== */
.main { position: relative; z-index: 1; }
.info-section { position: relative; z-index: 1; }

/* Móvil: que los paneles no se salgan de la pantalla (antes la tabla de desglose los ensanchaba y se cortaban). */
.calculator-container > * { min-width: 0; }
.breakdown-scroll { overflow-x: auto; }
