@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

:root {
    --primary-color: #256380;
    --primary-glow: #256380aa;
    --accent-color: #00d2ff;
    --bg-color: #050b14;
    --text-color: #e0e6ed;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.15);
    --font-heading: 'Inter', system-ui, sans-serif;
    --font-ui: system-ui, -apple-system, sans-serif;
}

html,
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-ui);
    margin: 0;
    padding: 0;
    height: 100%;
    /* Oder min-height: 100vh, aber 100% ist oft besser für mobile web apps */
    overflow-y: auto;
    /* Scrollen erlauben! */
    background-image: radial-gradient(circle at 50% 0%, #172a3a 0%, #02060a 80%);
    background-attachment: fixed;
    /* Damit der Hintergrund beim Scrollen stehen bleibt */
    cursor: auto;
}



.dashboard-container {
    padding: 0 40px;
    /* Erzeugt den gewünschten Abstand zum Bildschirmrand */
    width: 100%;
    box-sizing: border-box;
}

.top-bar {
    background: rgba(5, 11, 20, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    /* Logo nach links, Uhr nach rechts */
    align-items: center;
    z-index: 10;
}

.settings-icon {
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.curo-logo {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 0 5px var(--primary-glow));
}

/* CARD & BACKGROUND GLOW FIX */
.tado-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    /* transition: transform 0.2s;  REMOVED HOVER SCALING FOR DESKTOP TO AVOID CONFUSION */
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    /* Desktop: Nicht klickbar aussehen */
    overflow: hidden;
}

/* Das blaue Leuchten im Hintergrund der Karten */
.tado-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: var(--primary-color);
    opacity: 0.15;
    filter: blur(60px);
    z-index: -1;
    border-radius: 50%;
}

.tado-card.heating-active::before {
    background: #ff6b00;
    opacity: 0.25;
}

.current-temp {
    font-family: var(--font-heading);
    font-size: 4rem !important;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 20px var(--primary-glow);
    margin: 1rem 0 0.5rem 0;
}

.humidity-text {
    font-size: 0.8rem;
    color: #a0aab5;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
}

.target-temp {
    background: rgba(0, 210, 255, 0.1) !important;
    border: 1px solid var(--accent-color) !important;
    color: var(--accent-color) !important;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

.zones-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2.5rem !important;
    justify-content: center;
}

/* Card Design Fix für den Original-Look */
.tado-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.8rem 1.2rem !important;
    /* Etwas mehr Höhe für die Pille */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.tado-card h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #fff;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.8rem;
    width: 100%;
    text-align: center;
}

.current-temp {
    font-size: 4.2rem !important;
    /* Schön fett wie im Bild */
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 20px var(--primary-glow);
    line-height: 1;
    margin: 1.5rem 0 0.5rem 0;
}

/* Luftfeuchtigkeit direkt unter die Temperatur */
.humidity-text {
    font-size: 0.8rem !important;
    color: #a0aab5 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem !important;
}

/* Der SOLL-Wert als markante blaue Pille */
.target-temp {
    background: rgba(0, 210, 255, 0.1) !important;
    border: 1px solid var(--accent-color) !important;
    color: var(--accent-color) !important;
    padding: 6px 18px !important;
    border-radius: 20px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    display: inline-block !important;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5) !important;
    letter-spacing: 1px;
}

.slider-container {
    width: 100%;
    padding: 1rem 0;
}

.futuristic-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    background-image: linear-gradient(90deg, #00d2ff, #007aff);
    background-repeat: no-repeat;
    cursor: pointer;
}

.futuristic-slider::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.temp-control {
    display: flex;
    gap: 3rem;
    margin-top: 1.5rem;
}

.temp-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.schedule-info {
    margin-top: 1.5rem;
    color: #888;
    font-size: 0.8rem;
}

.status {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--accent-color);
    /* Das wichtige Leuchten: */
    text-shadow: 0 0 10px var(--accent-color), 0 0 20px rgba(0, 210, 255, 0.5);
    font-size: 1.2rem;
}

/* 3. WETTER MITTIG FIX */
.weather-banner {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.weather-banner h2 {
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
}

.override-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 2rem !important;
    margin-bottom: 1.5rem !important;
}

.switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 15px;
    /* Erzeugt den Abstand zwischen Text und Switch */
}

.switch-label span {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    display: none;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    transition: 0.3s;
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: #888;
    border-radius: 50%;
    transition: 0.3s;
}

/* Der entscheidende Teil: Absolut sichere Positionierung */
input:checked+.slider-round {
    background-color: rgba(0, 210, 255, 0.2);
    border-color: var(--accent-color);
}

input:checked+.slider-round:before {
    /* Wir nutzen KEIN Translate, sondern setzen den Punkt direkt */
    left: 22px;
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

/* =========================================
   ZEITPLANER STYLES (Glassmorphism / Dark)
   ========================================= */

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}

.tado-card h3 {
    border-bottom: none;
    /* Border wird jetzt von card-header-row gehandhabt */
    padding-bottom: 0;
    margin-bottom: 0;
    text-align: left;
    flex-grow: 1;
}

.schedule-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    /* Gleiche Farbe wie switch-label span */
    transition: color 0.2s, transform 0.2s;
    padding: 5px;
}

.emoji-btn {
    filter: grayscale(100%);
    /* Optional: Farbigkeit reduzieren für einheitlichen Look */
    opacity: 0.7;
}

.schedule-btn:hover {
    color: #fff;
    transform: scale(1.1);
    opacity: 1;
    filter: none;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Zentriert vertikal und horizontal */
}

/* Modal Content (Glassmorphism) */
.modal-content {
    background: rgba(25, 25, 35, 0.85);
    /* Etwas dunklerer Hintergrund */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    color: #fff;
    position: relative;
    /* Entferne margin-top oder feste Positionierung, da Flexbox zentriert */
    max-height: 90vh;
    /* Verhindert, dass es höher als der Screen ist */
    overflow-y: auto;
    /* Scrollen wenn Inhalt zu lang */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 0 0 10px var(--primary-glow);
}

.close-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #fff;
}

.modal-subtitle {
    color: #a0aab5;
    margin-bottom: 2rem;
    text-align: center;
}

/* Timeline Visualisierung */
.schedule-timeline-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
}

.timeline-placeholder {
    display: flex;
    height: 80px;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
}

.timeline-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-right: 1px solid rgba(0, 0, 0, 0.5);
    position: relative;
}

.timeline-block:last-child {
    border-right: none;
}

.timeline-block.active {
    box-shadow: inset 0 0 20px var(--primary-glow);
    border: 1px solid var(--accent-color);
}

.time-label {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.temp-label {
    font-weight: bold;
    font-size: 1.2rem;
}

/* Weekly View Styles */
.weekly-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 5px;
}

.day-row {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.day-name {
    font-weight: 600;
    color: #e0e0e0;
}

.day-actions {
    display: flex;
    gap: 5px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 5px;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: #fff;
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.mini-timeline {
    height: 25px;
    /* Etwas flacher als die Single-View */
    border-radius: 4px;
    display: flex;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

.timeline-placeholder.mini-timeline .timeline-block {
    display: flex;
    justify-content: center;
    align-items: center;
}

.temp-label-mini {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

.timeline-empty {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    padding-top: 4px;
}

.schedule-actions-top {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

.action-btn.small {
    font-size: 0.85rem;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-btn.small:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Actions */
.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.action-btn {
    background: var(--primary-color);
    border: 1px solid var(--accent-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px var(--primary-glow);
    /* Default Glow */
}

.action-btn:hover {
    background: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-color);
    /* Stronger Glow */
    transform: scale(1.05);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =========================================
   MOBILE RESPONSIVENESS (bis 1200px erweitert zum Testen)
   ========================================= */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 0 15px;
        /* Weniger Rand auf Mobile */
    }

    /* 1. Einspaltiges Raster */
    .zones-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* 2. Kompakte Karten (Lese-Modus) */
    .tado-card {
        padding: 1.2rem 1rem !important;
        cursor: pointer !important;
        /* WICHTIG für iOS */
        /* Zeigt an, dass sie klickbar sind */
        transition: transform 0.2s;
        z-index: 5;
        position: relative;
    }

    .tado-card:active {
        transform: scale(0.98);
    }

    /* Verstecke interaktive oder "große" Elemente auf der Übersichtskarte */
    .tado-card .slider-container,
    .tado-card .temp-control,
    .tado-card .override-control,
    .tado-card .schedule-info {
        display: none !important;
    }

    /* Mache die Temperatur etwas kleiner für Übersicht */
    .current-temp {
        font-size: 3rem !important;
        margin: 0.5rem 0;
    }

    /* Settings Icon auch per CSS sicherheitshalber weg */
    .settings-icon {
        display: none !important;
    }
}

/* Default state for overlay on desktop */


/* 
   Maximized Card Modal Styles
   Das nutzen wir, wenn eine Karte im "Vollbild" geöffnet wird 
*/
.maximized-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* Scrollen ermöglichen */
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    /* Über allem anderen */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Oben starten, damit man scrollen kann */
    padding: 40px 20px;
    /* Mehr Platz oben/unten */
    box-sizing: border-box;
}

.maximized-card {
    /* Sieht aus wie eine große Tado Card, aber mit Controls sichtbar */
    background: rgba(25, 25, 35, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    /* Smartphone Breite */
    box-shadow: 0 0 50px rgba(0, 210, 255, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.maximized-card .close-btn-abs {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Im Maximized Mode erzwingen wir, dass Controls sichtbar sind, auch auf Mobile */
.maximized-card .slider-container,
.maximized-card .temp-control,
.maximized-card .override-control,
.maximized-card .schedule-info {
    display: flex !important;
    /* Oder block */
}

/* Layout-Korrekturen für das Modal */
.maximized-card .slider-container {
    display: block !important;
    margin-top: 2rem;
}

.maximized-card .override-control {
    display: flex !important;
}