:root {
    --glass: rgba(16, 20, 32, 0.82);
    --glass-light: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.12);
    --text: #ffffff;
    --text-dim: #94a3b8;
    --accent: #FFD700;
    --accent-rain: #38bdf8;
    --status-green: #22c55e;
    --status-orange: #f59e0b;
    --status-red: #ef4444;
    --info-blue: #3b82f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 15% 20%, #1e293b 0%, #0f172a 60%, #020617 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.dashboard {
    width: 100%;
    max-width: 600px;
    background: var(--glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 2.4rem 2rem;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.08) inset;
    margin-bottom: 80px;
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.header-main {
    display: flex;
    flex-direction: column;
}

.city-title {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.city-title i {
    color: var(--accent);
}

.date-today {
    color: var(--text-dim);
    font-size: 0.9rem;
    text-transform: capitalize;
}

.header-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.badge {
    font-size: 0.72rem;
    background: var(--glass-light);
    padding: 3px 9px;
    border-radius: 10px;
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.header-sun-times {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--text-dim);
    font-weight: 500;
    padding: 1px 0;
}

.header-sun-times .sun-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-sun-times .sun-item i {
    font-size: 0.95rem;
}

.header-sun-times .sun-item:first-child i {
    color: var(--accent);
}

.header-sun-times .sun-item:last-child i {
    color: #f97316;
}

.header-sun-times .sun-item span {
    color: var(--text);
    font-weight: 600;
}

.header-sun-times .sun-sep {
    opacity: 0.35;
    font-size: 0.7rem;
}

/* MONITOR ENERGÉTICO (DSS BANNER PREMIUM) */
.energy-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 1.2rem 1.4rem;
    border-radius: 22px;
    margin-bottom: 2.2rem;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--glass-light);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fadeSlideUp 0.5s ease-out forwards;
}

.energy-box:hover {
    transform: translateY(-3px) scale(1.01);
}

.energy-icon {
    font-size: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.energy-box:hover .energy-icon {
    transform: scale(1.08) rotate(6deg);
}

.energy-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.energy-info p {
    font-size: 0.88rem;
    opacity: 0.92;
    margin: 0;
    line-height: 1.35;
}

/* Estados DSS con Glowing Borders */
.status-ok {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(16, 185, 129, 0.08));
    border-color: rgba(34, 197, 94, 0.45);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.status-ok .energy-icon {
    color: var(--status-green);
    background: rgba(34, 197, 94, 0.22);
}

.status-ok h3 {
    color: #4ade80;
}

.status-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.20), rgba(217, 119, 6, 0.10));
    border-color: rgba(245, 158, 11, 0.50);
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.status-warning .energy-icon {
    color: var(--status-orange);
    background: rgba(245, 158, 11, 0.22);
}

.status-warning h3 {
    color: #fbbf24;
}

.status-critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.24), rgba(185, 28, 28, 0.12));
    border-color: rgba(239, 68, 68, 0.65);
    box-shadow: 0 8px 35px rgba(239, 68, 68, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    animation: pulse-border 2s infinite;
}

.status-critical .energy-icon {
    color: var(--status-red);
    background: rgba(239, 68, 68, 0.25);
    animation: pulse-icon 1s infinite alternate;
}

.status-critical h3 {
    color: #f87171;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

@keyframes pulse-icon {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

/* GRÁFICO BATERÍA */
.battery-section {
    background: var(--glass-light);
    border-radius: 22px;
    padding: 1.25rem 1.6rem;
    margin-bottom: 2.2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
}

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

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.last-read-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 8px;
    margin-left: 10px;
}

.toggle-chart-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.chart-header:hover .toggle-chart-btn {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.chart-content {
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out, margin-top 0.4s;
    max-height: 500px;
    opacity: 1;
    margin-top: 1rem;
}

.chart-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

#solarChart {
    pointer-events: none;
    touch-action: pan-y;
    user-select: none;
}

.chart-note {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 10px;
    text-align: center;
    font-style: italic;
}

/* SECCIÓN SOLAR API */
.solar-section {
    background: linear-gradient(145deg, rgba(28, 33, 49, 0.75), rgba(18, 22, 35, 0.85));
    border: 1px solid rgba(255, 215, 0, 0.18);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.solar-summary-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.2rem;
}

.solar-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 10px 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.solar-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.35);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.08);
}

.solar-pill-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.solar-pill-val {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.solar-pill-val strong {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent);
}

/* SMART WIDGETS */
.smart-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 2.2rem;
    animation: fadeSlideUp 0.6s ease-out forwards;
}

.widget-card {
    background: var(--glass-light);
    border-radius: 20px;
    padding: 18px 10px 34px 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.widget-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 215, 0, 0.35);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 15px rgba(255, 215, 0, 0.08);
}

.w-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.w-icon.sun {
    color: var(--accent);
}

.w-icon.wash {
    color: var(--accent-rain);
}

.w-data span {
    display: block;
}

.w-data span:first-child {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    line-height: 1.1;
}

.w-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    /* Absolute position */
    bottom: 10px;
    left: 0;
    width: 100%;
}

/* SECCIÓN HOY + SEMÁFORO */
.today-section {
    position: relative;
    margin-bottom: 2.5rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    top: 15px;
    right: 15px;
    box-shadow: 0 0 10px currentColor;
    display: none;
}

.dot-green .status-dot {
    display: block;
    background-color: var(--status-green);
    color: var(--status-green);
}

.dot-orange .status-dot {
    display: block;
    background-color: var(--status-orange);
    color: var(--status-orange);
}

.dot-red .status-dot {
    display: block;
    background-color: var(--status-red);
    color: var(--status-red);
    animation: pulse-dot 1s infinite alternate;
}

@keyframes pulse-dot {
    from {
        opacity: 0.6;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* RESTO */
.current-summary {
    text-align: center;
    margin-bottom: 2rem;
}

.big-icon {
    font-size: 5rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
}

.big-temp {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
}

.weather-desc {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    color: var(--text-dim);
    text-transform: capitalize;
}

.min-max {
    margin-top: 0.6rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.feels-like-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.feels-like-pill strong {
    color: #fff;
    font-weight: 700;
}

.hourly-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 2rem;
}

.today-section .hourly-grid {
    margin-bottom: 0;
}

.today-section .curated-grid {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hour-card {
    background: var(--glass-light);
    border-radius: 18px;
    padding: 1.1rem 0.6rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hour-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.hour-card.active {
    border-color: var(--accent);
    background: rgba(255, 215, 0, 0.12);
    box-shadow: 0 4px 18px rgba(255, 215, 0, 0.15);
}

.hour-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    display: block;
}

.hour-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    display: block;
    transition: transform 0.3s ease;
}

.hour-card:hover .hour-icon {
    transform: scale(1.12);
}

.hour-temp {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.divider {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2.5rem;
}

.day-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.3rem;
    background: var(--glass-light);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.day-row:hover {
    transform: translateX(4px) scale(1.01);
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.bad-solar-day {
    background: rgba(231, 76, 60, 0.1) !important;
    border-color: rgba(231, 76, 60, 0.3);
}

.bad-solar-day .row-icon {
    color: var(--status-red);
}

.row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.row-day {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 35px;
    flex-shrink: 0;
}

.row-icon {
    font-size: 1.8rem;
    color: var(--text);
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.row-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: capitalize;
    white-space: normal;
    line-height: 1.2;
    overflow: hidden;
}

.row-rain {
    width: auto;
    min-width: 45px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--accent-rain);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.row-temps {
    text-align: right;
    min-width: 65px;
    font-weight: 600;
    flex-shrink: 0;
}

.row-temps span {
    color: var(--text-dim);
    font-weight: 400;
    margin-left: 5px;
}

/* MODAL & FAB */
.fab-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
    color: #1a1a1a;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.5s;
    opacity: 0.5;
}

.fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(30, 35, 50, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px 25px 0 0;
    padding: 1.5rem;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

@media(min-width: 600px) {
    .modal-overlay {
        align-items: center;
    }

    .modal-content {
        border-radius: 25px;
        transform: translateY(20px);
        max-height: 85vh;
    }
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.5rem;
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--accent);
}

.modal-body p {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* VISTAS MODAL */
.view-section {
    display: none;
    animation: fadeIn 0.3s;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* CONFIG GRID */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 2rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-group.full-width {
    grid-column: span 2;
}

.setting-group label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.setting-group small {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-style: italic;
    opacity: 0.7;
}

.setting-group input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.setting-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

/* CONTROLES DIARIOS */
.control-label-row {
    text-align: center;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.voltage-control-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 1.5rem;
}

.adjust-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    transition: background 0.2s, transform 0.1s;
}

.adjust-btn:active {
    transform: scale(0.95);
}

.adjust-btn.plus {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.adjust-btn.minus {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.input-wrapper-modal {
    flex: 1;
    text-align: center;
}

.input-wrapper-modal input {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1.8rem;
    font-family: 'Outfit', sans-serif;
    text-align: center;
    font-weight: 700;
}

.input-wrapper-modal input:focus {
    outline: none;
    border-color: var(--accent);
}

/* GRÁFICO PREVISIÓN INTEGRADO EN MODAL */
.modal-battery-section {
    background: rgba(18, 22, 34, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 0.9rem 1.1rem;
    margin-top: 0.5rem;
    margin-bottom: 1.2rem;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.modal-battery-section .chart-header {
    padding: 0.2rem 0;
}

.modal-battery-section .chart-header h3 {
    font-size: 1rem;
    color: var(--text);
}

.modal-chart-container {
    height: 175px !important;
    position: relative;
    width: 100%;
}

.modal-actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.modal-actions-row .save-btn {
    flex: 2;
    margin: 0;
    padding: 13px;
    font-size: 0.95rem;
    border-radius: 14px;
}

.modal-close-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-dim);
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

/* HISTORIAL */
.history-section {
    margin-bottom: 1rem;
}

.history-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    align-items: stretch;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 95px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.history-val {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    line-height: 1;
    margin-bottom: 2px;
}

.history-perc {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.history-delta {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.2);
}

.delta-neg {
    color: var(--status-red);
    background: rgba(231, 76, 60, 0.1);
}

.delta-pos {
    color: var(--status-green);
    background: rgba(46, 204, 113, 0.1);
}

.delta-neutral {
    color: var(--text-dim);
}

.history-time {
    font-size: 0.6rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-style: italic;
}

.no-history {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

/* BOTÓN INFO */
.info-trigger-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.2);
    color: var(--info-blue);
    border: 1px solid var(--info-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: transform 0.2s;
    align-self: center;
    margin-left: 5px;
}

.info-trigger-btn:active {
    transform: scale(0.9);
}

/* LEYENDA */
.legend-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    overflow: hidden;
    transition: max-height 0.4s ease-out, margin-bottom 0.4s;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-panel.collapsed {
    max-height: 0;
    margin-bottom: 0;
    border: none;
}

.legend-content-inner {
    padding: 1rem;
}

.legend-content-inner h4 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-table {
    margin-bottom: 1rem;
}

.l-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.l-row:last-child {
    border-bottom: none;
}

.l-row.total {
    color: var(--accent);
    font-weight: 700;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 5px;
    padding-top: 5px;
}

.legend-detail {
    font-size: 0.7rem;
    color: var(--text-dim);
    line-height: 1.3;
    font-style: italic;
}

.save-btn {
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: #1a1a1a;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

@media (max-width: 450px) {
    .dashboard {
        padding: 1.5rem 1rem;
    }

    .day-row {
        padding: 0.8rem;
        gap: 8px;
    }

    .row-icon {
        font-size: 1.5rem;
    }
}

/* =========================================
   MODIFICACIONES VISUALES (Iconos y Alertas)
   ========================================= */

/* 1. ICONOS CLIMÁTICOS CON COLOR */
/* Sol y Nubes y Claros -> Amarillo */
i.ph-sun,
i.ph-cloud-sun,
i.ph-cloud-moon {
    color: var(--accent) !important;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.4));
}

/* Nuboso / Niebla -> Gris Claro */
i.ph-cloud,
i.ph-cloud-fog {
    color: #cfd8dc !important;
    /* Gris perla */
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

/* Lluvia / Tormenta -> Gris Oscuro */
i.ph-cloud-rain,
i.ph-cloud-lightning,
i.ph-snowflake {
    color: #78909c !important;
    /* Gris azulado */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Ajuste para el icono grande de cabecera */
.big-icon i.ph-sun,
.big-icon i.ph-cloud-sun {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.3));
}


/* 2. DÍAS MALOS (ALERTA ROJA INTENSA) */
/* Sobrescribe la clase .bad-solar-day original para darle más fuerza */
.bad-solar-day {
    background: rgba(231, 76, 60, 0.25) !important;
    /* Rojo más visible */
    border: 1px solid rgba(231, 76, 60, 0.6) !important;
    box-shadow: inset 0 0 20px rgba(231, 76, 60, 0.1);
}

/* Forzar texto blanco para que se lea bien sobre el rojo */
.bad-solar-day .row-day,
.bad-solar-day .row-desc,
.bad-solar-day .row-temps,
.bad-solar-day .row-temps span {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: 600;
}

/* El icono de lluvia dentro de un día malo se mantendrá gris oscuro (definido arriba) */

/* =========================================
   MICRO-ANIMACIONES Y EFECTOS DINÁMICOS
   ========================================= */
@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(18px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Optimización para Pantallas Murales / Tablet de pared (alta legibilidad) */
@media (min-width: 900px) {
    .dashboard {
        max-width: 660px;
        padding: 2.6rem;
    }
    .energy-info h3 {
        font-size: 1.15rem;
    }
    .energy-info p {
        font-size: 0.95rem;
    }
    .w-data span:first-child {
        font-size: 1.25rem;
    }
}

/* FROM TEST_OPENMETEO.HTML */

/* TARJETA DE RADIACIÓN SOLAR (SOLAR HERO) */
        .solar-hero-card {
            background: linear-gradient(135deg, rgba(38, 43, 63, 0.85), rgba(22, 26, 38, 0.9));
            border: 1px solid rgba(255, 215, 0, 0.28);
            border-radius: 24px;
            padding: 24px 22px;
            box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 215, 0, 0.08);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            margin-bottom: 1.5rem;
        }

        .solar-hero-card:hover {
            transform: translateY(-3px);
        }

        .solar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
            gap: 8px;
        }

        .solar-badge {
            font-size: 0.72rem;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.8px;
            padding: 4px 10px;
            border-radius: 12px;
            background: rgba(255, 215, 0, 0.15);
            color: var(--accent);
            white-space: nowrap;
        }

        .solar-time-sync {
            font-size: 0.75rem;
            color: var(--text-dim);
            white-space: nowrap;
        }

        .solar-body {
            display: flex;
            align-items: baseline;
            gap: 10px;
            margin-bottom: 14px;
        }

        .solar-val {
            font-size: 3.2rem;
            font-weight: 800;
            line-height: 1;
            color: #fff;
            letter-spacing: -1.5px;
            font-variant-numeric: tabular-nums;
        }

        .solar-unit {
            font-size: 1.1rem;
            color: var(--accent);
            font-weight: 700;
        }

        /* Barra de Potencial Solar */
        .solar-progress-bar {
            width: 100%;
            height: 8px;
            background: rgba(255, 255, 255, 0.08);
            border-radius: 6px;
            overflow: hidden;
            margin-bottom: 10px;
        }

        .solar-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #f39c12, #FFD700);
            border-radius: 6px;
            width: 0%;
            transition: width 0.8s ease-out;
            box-shadow: 0 0 10px var(--accent);
        }

        .solar-footer {
            display: flex;
            justify-content: space-between;
            font-size: 0.78rem;
            color: var(--text-dim);
        }

        /* TARJETA METEO ACTUAL (AMBIENTE) */
        .weather-hero-card {
            background: var(--glass);
            border: var(--card-border);
            border-radius: 20px;
            padding: 16px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            backdrop-filter: blur(14px);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        }

        .w-left {
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .w-icon-container {
            font-size: 2.8rem;
            filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.2));
            display: flex;
        }

        .w-temp {
            font-size: 2rem;
            font-weight: 800;
            line-height: 1;
        }

        .w-desc {
            font-size: 0.85rem;
            color: var(--text-dim);
            margin-top: 3px;
        }

        .w-feels {
            text-align: right;
            font-size: 0.78rem;
            color: var(--text-dim);
        }

        .w-feels strong {
            display: block;
            font-size: 1.1rem;
            color: #fff;
            margin-top: 2px;
        }

        /* GRID CURADO DE RELEVANCIA FOTOVOLTAICA */
        .curated-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 14px;
        }

        .metric-card {
            background: var(--glass);
            border: var(--card-border);
            border-radius: 20px;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
            backdrop-filter: blur(12px);
        }

        .metric-card:hover {
            transform: translateY(-3px);
            border-color: rgba(255, 255, 255, 0.2);
            background: rgba(255, 255, 255, 0.08);
        }

        .metric-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .metric-label {
            font-size: 0.72rem;
            text-transform: uppercase;
            font-weight: 600;
            color: var(--text-dim);
            letter-spacing: 0.5px;
        }

        .metric-icon {
            font-size: 1.3rem;
        }

        .metric-value {
            font-size: 1.4rem;
            font-weight: 800;
            color: #fff;
            display: flex;
            align-items: baseline;
            gap: 4px;
        }

        .metric-sub {
            font-size: 0.72rem;
            color: var(--text-dim);
        }

        .metric-unit {
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--text-dim);
        }

        .btn-reload {
            background: var(--accent);
            color: #12151f;
            border: none;
            padding: 14px;
            border-radius: 16px;
            cursor: pointer;
            font-weight: 800;
            font-size: 0.88rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            width: 100%;
            box-shadow: 0 6px 20px rgba(255, 215, 0, 0.22);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .btn-reload:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(255, 215, 0, 0.35);
        }

        .btn-reload:active {
            transform: scale(0.98);
        }

        #loading {
            margin: 60px 0;
            text-align: center;
            color: var(--text-dim);
        }

        .hidden {
            display: none !important;
        }