/* Globales Styling */
body {
    font-family: sans-serif;
    background: #121212;
    color: #fff;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Login Box */
.login-box {
    background: #1e1e1e;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    text-align: center;
    width: 300px;
}

input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #333;
    background: #252525;
    color: #fff;
    box-sizing: border-box;
    font-size: 16px;
}

button {
    width: 100%;
    padding: 12px;
    background: #007bff;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
    font-size: 16px;
}

/* Dashboard Grid */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h2 {
    font-size: 28px;
    margin-bottom: 5px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 600px;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Card Header für Name und Batterie-Icon nebeneinander */
.device-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.device-name {
    font-size: 18px; 
    font-weight: bold;
    word-break: break-word;
}

/* Dashboard Cards (Feste Höhe für perfekte Symmetrie) */
.card {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 210px; 
    box-sizing: border-box;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.card.offline {
    opacity: 0.35;
    pointer-events: none;
    transform: scale(0.98);
}

/* Reines CSS Batterie-Icon */
.battery-icon {
    width: 20px;
    height: 10px;
    border: 2px solid #555;
    border-radius: 2px;
    position: relative;
    flex-shrink: 0;
}
.battery-icon::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 2px;
    width: 2px;
    height: 4px;
    background: #555;
    border-radius: 0 1px 1px 0;
}
.bat-full { border-color: #00e676; background: linear-gradient(to right, #00e676 100%, transparent 0); }
.bat-full::after { background: #00e676; }
.bat-half { border-color: #ffb300; background: linear-gradient(to right, #ffb300 50%, transparent 0); }
.bat-half::after { background: #ffb300; }
.bat-empty { border-color: #ff5252; background: linear-gradient(to right, #ff5252 20%, transparent 0); }
.bat-empty::after { background: #ff5252; }

/* Dashboard Buttons */
.btn {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: none;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.on {
    background: #00e676;
    color: #000;
    box-shadow: 0 0 18px #00e676;
}

.off {
    background: #333;
    color: #888;
}

/* Messwerte-Anzeige für Shelly 1PM */
.measurement-box {
    display: flex; 
    justify-content: space-between; 
    width: 100%; 
    font-size: 14px; 
    margin-top: 10px; 
    color: #00e676; 
    font-family: monospace; 
}

/* GESTAPELTES VERTIKALES SENSOR LAYOUT FÜR SHELLY H&T */
.sensor-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
    margin: auto 0;
}

.sensor-badge {
    width: 100%;
    background: #252525;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column; /* Label oben, Wert unten */
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    gap: 2px;
}

.sensor-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sensor-value {
    font-size: 16px;
    font-weight: bold;
    color: #00e676;
    font-family: monospace;
    white-space: nowrap;
}

/* Symmetrie-Halter */
.spacer-box {
    height: 16px; 
    width: 100%;
    visibility: hidden;
}

.logout {
    margin-top: 40px;
    display: inline-block;
    color: #aaa;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.2s ease;
}

.logout:hover {
    color: #ff5252;
}
