/* ==========================================================================
   Calculadora de Consumo Eléctrico & Precio de la Luz - Estilos Premium
   ========================================================================== */

/* Panel del Precio de la Luz en Tiempo Real */
.live-energy-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.live-energy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.live-energy-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .live-energy-badge {
    color: #fbbf24;
}

.live-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.live-energy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.live-stat-card {
    background: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.live-stat-card:hover {
    border-color: #f59e0b;
    transform: translateY(-2px);
}

.live-stat-card.stat-current {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.04);
}

.live-stat-card.stat-min {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.04);
}

.live-stat-card.stat-max {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.04);
}

.live-stat-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-stat-val {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.live-stat-sub {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.live-btn-apply {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.live-btn-apply:hover {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

/* Gráfico de barras de 24 horas */
.hourly-chart-wrapper {
    margin-top: 1rem;
    background: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
}

.hourly-chart-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hourly-bars-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 90px;
    padding-top: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hour-bar-col {
    flex: 1;
    min-width: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    cursor: pointer;
    position: relative;
}

.hour-bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    transition: height 0.4s ease, opacity 0.2s ease;
    background: #10b981;
}

.hour-bar-fill.bar-valle { background: #10b981; }
.hour-bar-fill.bar-llano { background: #f59e0b; }
.hour-bar-fill.bar-punta { background: #ef4444; }

.hour-bar-col.active .hour-bar-fill {
    outline: 2px solid var(--color-primary);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.hour-bar-label {
    font-size: 0.62rem;
    color: var(--color-text-muted);
    margin-top: 4px;
    text-align: center;
}

/* Filtros de Categorías de Electrodomésticos */
.appliance-categories-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 1.25rem;
    -webkit-overflow-scrolling: touch;
}

.cat-pill-btn {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cat-pill-btn:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}

.cat-pill-btn.active {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

/* Selector de Electrodomésticos Grid */
.appliances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 1.75rem;
    max-height: 290px;
    overflow-y: auto;
    padding: 4px 2px;
}

.appliance-item-btn {
    background: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.appliance-item-btn:hover {
    border-color: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.appliance-item-btn.selected {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    box-shadow: 0 0 0 1px #f59e0b;
}

.appliance-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.appliance-item-power {
    font-size: 0.75rem;
    color: #f59e0b;
    font-weight: 700;
}

/* Formulario Principal de Parámetros */
.calc-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1.5rem;
}

.power-input-group {
    display: flex;
    gap: 6px;
}

.power-unit-btn {
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.power-unit-btn.active {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

/* Tarjetas de Resultados Económicos y Energéticos */
.results-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.res-hero-card {
    background: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1.25rem 1rem;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.res-hero-card.highlight {
    border-color: rgba(245, 158, 11, 0.6);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--color-bg-card) 100%);
}

.res-hero-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.res-hero-val {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.res-hero-kwh {
    font-size: 0.8rem;
    font-weight: 600;
    color: #f59e0b;
    margin-top: 6px;
}

/* Caja de Oportunidad de Ahorro */
.saving-box-card {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.saving-box-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.saving-box-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.saving-box-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.saving-box-desc {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
}

.saving-box-amount {
    font-size: 1.5rem;
    font-weight: 900;
    color: #059669;
    text-align: right;
}

[data-theme="dark"] .saving-box-amount {
    color: #34d399;
}

/* Lista / Cesta del Hogar (Simulador Global de Factura) */
.home-basket-card {
    background: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.home-basket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.table-basket-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table-basket {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-basket th {
    background: var(--color-bg-light);
    color: var(--color-text-secondary);
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}

.table-basket td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.table-basket tr:last-child td {
    border-bottom: none;
}

.btn-del-item {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-del-item:hover {
    background: rgba(239, 68, 68, 0.1);
}

.basket-total-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
    gap: 10px;
}

.basket-total-label {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--color-text-primary);
}

.basket-total-figures {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.basket-total-eur {
    font-size: 1.6rem;
    font-weight: 900;
    color: #f59e0b;
}

.basket-total-kwh {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-secondary);
}

/* Botones de acción */
.calc-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.btn-electric-primary {
    background: #f59e0b;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-electric-primary:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-electric-secondary {
    background: var(--color-bg-light);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-electric-secondary:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}

.btn-whatsapp-electric {
    background: #25d366;
    color: #ffffff;
    border: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-whatsapp-electric:hover {
    background: #1eb857;
    transform: translateY(-1px);
}

/* Toast de notificación */
.elec-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #10b981;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.elec-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsividad Móvil */
@media (max-width: 640px) {
    .live-energy-card {
        padding: 1.15rem 1rem;
    }
    .live-energy-grid {
        grid-template-columns: 1fr 1fr;
    }
    .results-hero-grid {
        grid-template-columns: 1fr 1fr;
    }
    .res-hero-val {
        font-size: 1.5rem;
    }
    .saving-box-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .saving-box-amount {
        text-align: left;
    }
    .calc-actions-row button {
        width: 100%;
        justify-content: center;
    }
    .basket-total-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}
