/* =========================================================
   GRUNDEINSTELLUNGEN
========================================================= */

* {
    box-sizing: border-box;
}

html {
    background: #07111f;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px 16px;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    color: #f7f9fc;

    background:
        radial-gradient(
            circle at 25% 0%,
            #193a5e 0%,
            #0d1c2e 31%,
            #07111f 72%
        );

    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}


/* =========================================================
   HAUPTBEREICH
========================================================= */

.dashboard {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 28px;
}

.logo {
    width: 62px;
    height: 62px;

    margin: 0 auto 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 20px;

    font-size: 29px;

    background:
        linear-gradient(
            145deg,
            #1b3a5c,
            #0d1d31
        );

    border: 1px solid rgba(255,255,255,.09);

    box-shadow:
        0 18px 40px rgba(0,0,0,.30);
}

h1 {
    margin: 0;
    font-size: 30px;
}

h2 {
    margin: 0;
    text-align: center;
}

.subtitle,
.modal-subtitle {
    margin-top: 6px;
    color: #7890aa;
    font-size: 14px;
    text-align: center;
}


/* =========================================================
   MENÜ
========================================================= */

.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.nav-button {
    min-height: 160px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 8px;

    border: 1px solid rgba(255,255,255,.07);
    border-radius: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(28,55,83,.96),
            rgba(16,29,46,.98)
        );

    box-shadow:
        0 18px 45px rgba(0,0,0,.23);

    color: white;
    cursor: pointer;

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
}

.nav-button:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,.14);

    box-shadow:
        0 24px 55px rgba(0,0,0,.30);
}

.nav-button:active {
    transform: scale(.97);
}

.nav-icon {
    font-size: 40px;
}

.nav-title {
    font-size: 19px;
    font-weight: 700;
}

.nav-subtitle {
    color: #8195ad;
    font-size: 12px;
}


/* =========================================================
   ZURÜCK
========================================================= */

.back-button {
    display: inline-flex;
    align-items: center;

    padding: 9px 13px;
    margin-bottom: 18px;

    border-radius: 12px;

    background: rgba(255,255,255,.06);
    color: #b4c2d1;

    transition:
        background .15s ease,
        transform .15s ease;
}

.back-button:hover {
    background: rgba(255,255,255,.10);
}

.back-button:active {
    transform: scale(.95);
}


/* =========================================================
   KARTEN
========================================================= */

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.card {
    position: relative;

    padding: 24px;
    margin-bottom: 15px;

    overflow: hidden;

    border-radius: 23px;

    background:
        linear-gradient(
            145deg,
            rgba(31,48,69,.96),
            rgba(17,29,45,.98)
        );

    border: 1px solid rgba(255,255,255,.07);

    box-shadow:
        0 20px 55px rgba(0,0,0,.24);
}

.label {
    margin-bottom: 7px;

    color: #8ea2b9;
    font-size: 14px;
}

.temperature {
    font-size: 40px;
    font-weight: 730;
}


/* =========================================================
   SHELLY RELAIS
========================================================= */

.relay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.relay-state {
    padding: 7px 13px;
    border-radius: 30px;

    font-size: 12px;
    font-weight: 750;
}

.state-on {
    color: #3be492;
    background: rgba(39,215,132,.10);
}

.state-off {
    color: #ff6974;
    background: rgba(255,91,104,.10);
}

.power-area {
    display: flex;
    justify-content: center;

    gap: 60px;
    margin-top: 28px;
}

.power-button {
    position: relative;

    width: 100px;
    height: 100px;

    border: none;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
        transform .15s ease,
        box-shadow .20s ease;
}

.power-button:hover {
    transform: scale(1.05);
}

.power-button:active {
    transform: scale(.88);
}

.power-on {
    color: #3ce493;

    background:
        radial-gradient(
            circle,
            rgba(43,220,136,.22),
            rgba(21,61,48,.90)
        );

    box-shadow:
        0 0 30px rgba(43,220,136,.10);
}

.power-off {
    color: #ff6570;

    background:
        radial-gradient(
            circle,
            rgba(255,88,102,.20),
            rgba(66,29,37,.90)
        );

    box-shadow:
        0 0 30px rgba(255,88,102,.08);
}

.power-button:active::after {
    content: "";

    position: absolute;
    inset: -8px;

    border-radius: 50%;
    border: 2px solid currentColor;

    animation: powerFlash .45s ease-out;
}

@keyframes powerFlash {

    0% {
        opacity: 1;
        transform: scale(.80);
    }

    100% {
        opacity: 0;
        transform: scale(1.18);
    }
}

.power-icon {
    position: relative;

    width: 40px;
    height: 40px;

    border: 5px solid currentColor;
    border-top-color: transparent;

    border-radius: 50%;
}

.power-icon::before {
    content: "";

    position: absolute;

    width: 5px;
    height: 23px;

    top: -11px;
    left: 50%;

    transform: translateX(-50%);

    border-radius: 5px;
    background: currentColor;
}

.button-label {
    margin-top: 9px;

    text-align: center;

    color: #8397ae;
    font-weight: 600;
}


/* =========================================================
   PASSWORT FENSTER
========================================================= */

.modal {
    display: none;

    position: fixed;
    inset: 0;

    z-index: 1000;

    justify-content: center;
    align-items: center;

    padding: 20px;

    background: rgba(3,8,14,.82);

    backdrop-filter: blur(10px);
}

.modal.show {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 390px;

    padding: 28px;

    border-radius: 24px;

    background:
        linear-gradient(
            145deg,
            #1c2e43,
            #111d2d
        );

    border: 1px solid rgba(255,255,255,.09);

    box-shadow:
        0 30px 80px rgba(0,0,0,.45);
}

.password-input {
    width: 100%;

    margin-top: 20px;
    padding: 15px;

    border-radius: 13px;
    border: 1px solid rgba(255,255,255,.10);

    outline: none;

    background: rgba(5,12,21,.48);

    color: white;

    font-size: 20px;

    text-align: center;
    letter-spacing: 6px;
}

.password-input:focus {
    border-color: rgba(64,147,255,.70);

    box-shadow:
        0 0 0 3px rgba(64,147,255,.10);
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 10px;
    margin-top: 17px;
}

.modal-btn {
    border: none;

    padding: 14px;

    border-radius: 12px;

    cursor: pointer;
}

.cancel-btn {
    color: #a5b3c2;

    background: rgba(255,255,255,.06);
}

.confirm-btn {
    color: white;

    background:
        linear-gradient(
            135deg,
            #2876e8,
            #4093ff
        );
}

.error {
    min-height: 20px;

    margin-top: 10px;

    color: #ff6974;

    text-align: center;

    font-size: 13px;
}


/* =========================================================
   WETTER
========================================================= */

.weather-dashboard {
    width: 100%;
    max-width: 1100px;

    margin: 0 auto;
}

.weather-panel {
    display: flex;
    justify-content: center;

    width: 100%;

    padding: 24px 10px 30px;

    border-radius: 24px;

    background:
        linear-gradient(
            145deg,
            rgba(31,48,69,.96),
            rgba(17,29,45,.98)
        );

    border: 1px solid rgba(255,255,255,.07);

    box-shadow:
        0 20px 55px rgba(0,0,0,.24);
}

.weather-scale {
    width: 667px;
    height: 760px;

    overflow: hidden;

    border-radius: 20px;
}

.weather-frame {
    display: block;

    width: 430px;
    height: 500px;

    border: none;

    transform: scale(1.55);
    transform-origin: top left;

    background: transparent;
}


/* =========================================================
   SONOS
========================================================= */

.sonos-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 15px;
}

.sonos-room-name {
    font-size: 21px;
    font-weight: 720;
}

.sonos-status {
    margin-top: 5px;

    color: #8195ad;

    font-size: 12px;
}

.track-title {
    min-height: 22px;

    margin-top: 18px;

    font-size: 17px;
    font-weight: 650;
}

.track-artist {
    min-height: 19px;

    margin-top: 4px;

    color: #8fa2b8;

    font-size: 13px;
}

.sonos-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;

    gap: 12px;

    margin-top: 22px;
}

.control-btn {
    width: 54px;
    height: 54px;

    border: none;
    border-radius: 50%;

    cursor: pointer;

    color: white;

    font-size: 20px;

    background: rgba(255,255,255,.07);

    transition:
        transform .15s ease,
        background .15s ease;
}

.control-btn:hover {
    background: rgba(255,255,255,.12);
}

.control-btn:active {
    transform: scale(.88);
}

.play-btn {
    background:
        linear-gradient(
            135deg,
            #2876e8,
            #4093ff
        );
}

.stop-btn {
    background:
        linear-gradient(
            135deg,
            #c93643,
            #ff5965
        );
}

.volume-row {
    display: grid;

    grid-template-columns:
        auto 1fr auto;

    gap: 10px;

    align-items: center;

    margin-top: 22px;
}

.volume-slider {
    width: 100%;
    cursor: pointer;
}

.mute-btn {
    width: 100%;

    margin-top: 15px;
    padding: 11px;

    border: none;
    border-radius: 12px;

    cursor: pointer;

    color: #d1d9e2;

    background: rgba(255,255,255,.06);
}

.logout-button {
    float: right;

    padding: 9px 13px;

    border: none;
    border-radius: 12px;

    color: #ff9ba2;

    background: rgba(255,91,104,.08);

    cursor: pointer;
}


/* =========================================================
   DALY
========================================================= */

.daly-main-value {
    margin-top: 7px;

    font-size: 38px;
    font-weight: 730;
}

.daly-summary {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 12px;

    margin-top: 18px;
}

.daly-summary > div {
    padding: 15px;

    border-radius: 15px;

    background: rgba(255,255,255,.045);

    text-align: center;

    border: 1px solid rgba(255,255,255,.045);
}

.daly-summary span {
    display: block;

    margin-bottom: 6px;

    color: #8297ae;

    font-size: 12px;
}

.daly-summary strong {
    font-size: 17px;
}

.daly-cells-grid {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 10px;

    margin-top: 18px;
}

.daly-cell {
    padding: 14px;

    border-radius: 14px;

    background: rgba(255,255,255,.045);

    border: 1px solid rgba(255,255,255,.05);
}

.daly-cell-name {
    color: #8297ae;

    font-size: 12px;
}

.daly-cell-value {
    margin-top: 5px;

    font-size: 18px;
    font-weight: 700;
}

.daly-offline {
    color: #ff6974;

    text-align: center;

    font-weight: 700;
}


/* =========================================================
   DALY SOC TACHO
========================================================= */

.soc-gauge {
    width: 100%;
    max-width: 420px;

    margin: 18px auto 0;

    text-align: center;
}


/*
   Der Ring wird später über JavaScript mit --soc gesetzt.

   Beispiel:
   --soc: 69;

   69 % bedeutet:
   69 % des Kreises werden gefüllt.
*/

.soc-gauge-ring {
    --soc: 0;

    position: relative;

    width: 260px;
    height: 260px;

    margin: 0 auto;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        conic-gradient(
            #3ce493 0%,
            #3ce493 calc(var(--soc) * 1%),
            rgba(255,255,255,.08)
                calc(var(--soc) * 1%),
            rgba(255,255,255,.08) 100%
        );

    box-shadow:
        0 0 40px rgba(60,228,147,.08);

    transition:
        background .5s ease;
}


/* Loch in der Mitte */

.soc-gauge-ring::before {
    content: "";

    position: absolute;

    width: 205px;
    height: 205px;

    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            #18283b,
            #101c2b
        );

    box-shadow:
        inset 0 0 25px rgba(0,0,0,.30);
}


.soc-gauge-inner {
    position: relative;

    z-index: 2;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


.soc-gauge-value {
    font-size: 55px;
    line-height: 1;

    font-weight: 750;

    letter-spacing: -2px;
}


.soc-gauge-percent {
    margin-left: 2px;

    font-size: 24px;

    color: #9aafc4;

    letter-spacing: 0;
}


.soc-gauge-text {
    margin-top: 10px;

    color: #8297ae;

    font-size: 13px;

    text-transform: uppercase;

    letter-spacing: 2px;
}


.soc-gauge-scale {
    width: 260px;

    margin: 10px auto 0;

    display: flex;
    justify-content: space-between;

    color: #6f849b;

    font-size: 11px;
}


/* =========================================================
   TABLET / HANDY
========================================================= */

@media (max-width: 900px) {

    .nav-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }
}


@media (max-width: 700px) {

    body {
        padding: 14px 10px;
    }

    .grid,
    .nav-grid,
    .sonos-grid {
        grid-template-columns: 1fr;
    }

    .header {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 25px;
    }

    .logo {
        width: 56px;
        height: 56px;

        font-size: 26px;
    }

    .nav-button {
        min-height: 110px;
    }

    .nav-icon {
        font-size: 34px;
    }

    .card {
        padding: 18px;

        border-radius: 19px;
    }

    .temperature,
    .daly-main-value {
        font-size: 35px;
    }

    .power-area {
        gap: 25px;
    }

    .power-button {
        width: 90px;
        height: 90px;
    }

    .modal {
        align-items: flex-end;

        padding: 10px;
    }

    .modal-box {
        max-width: none;

        border-radius:
            24px 24px 18px 18px;
    }

    .logout-button {
        float: none;

        position: absolute;

        right: 10px;
        top: 14px;
    }

    .daly-summary {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .daly-cells-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }


    /* SOC Tacho Handy */

    .soc-gauge-ring {
        width: 220px;
        height: 220px;
    }

    .soc-gauge-ring::before {
        width: 172px;
        height: 172px;
    }

    .soc-gauge-value {
        font-size: 47px;
    }

    .soc-gauge-scale {
        width: 220px;
    }
}


/* =========================================================
   WETTER HANDY
========================================================= */

@media (max-width: 600px) {

    .weather-panel {
        padding: 14px 4px 18px;

        border-radius: 19px;
    }

    .weather-scale {
        width: 366px;
        max-width: 100%;

        height: 430px;
    }

    .weather-frame {
        width: 430px;
        height: 500px;

        transform: scale(.85);

        transform-origin: top left;
    }
}


@media (max-width: 390px) {

    .weather-scale {
        width: 344px;
        height: 400px;
    }

    .weather-frame {
        transform: scale(.80);
    }

    .daly-cells-grid {
        grid-template-columns: 1fr;
    }

    .soc-gauge-ring {
        width: 200px;
        height: 200px;
    }

    .soc-gauge-ring::before {
        width: 156px;
        height: 156px;
    }

    .soc-gauge-value {
        font-size: 43px;
    }

    .soc-gauge-scale {
        width: 200px;
    }
}