/**
 * Smart Home Dashboard - Custom Styles
 */

/* Allgemeine Anpassungen */
:root {
    --primary-glow: rgba(13, 110, 253, 0.3);
    --success-glow: rgba(25, 135, 84, 0.4);
    --card-bg: rgba(33, 37, 41, 0.8);
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    min-height: 100vh;
}

/* Navbar */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(33, 37, 41, 0.95) !important;
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Karten */
.card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

/* Statistik-Karten */
.stat-card {
    background: linear-gradient(145deg, rgba(33, 37, 41, 0.9), rgba(25, 28, 31, 0.9));
    border: none;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d6efd, #6610f2);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

/* Geräte-Karten */
.device-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.device-card.device-on {
    border-color: rgba(25, 135, 84, 0.5);
    box-shadow: 0 0 20px var(--success-glow);
}

.device-card.device-on::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #198754;
}

.device-card.device-offline {
    opacity: 0.6;
}

.device-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 1.5rem;
}

.device-on .device-icon {
    background: rgba(25, 135, 84, 0.2);
    color: #198754;
}

/* Switches */
.form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #198754;
    border-color: #198754;
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Raum-Buttons */
.room-btn {
    border-radius: 20px;
    padding: 0.5rem 1.2rem;
    transition: all 0.2s;
}

.room-btn:hover {
    transform: scale(1.05);
}

/* Progress Bars */
.progress {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
}

/* Tabellen */
.table {
    --bs-table-bg: transparent;
}

.table-hover tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Charts */
canvas {
    max-width: 100%;
}

/* Toast */
.toast {
    background: rgba(33, 37, 41, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animationen */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.device-card.switching .device-icon {
    animation: pulse 0.5s infinite;
}

/* Status-Indikatoren */
.status-online {
    color: #198754;
}

.status-offline {
    color: #6c757d;
}

.status-active {
    color: #0dcaf0;
    animation: pulse 2s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-icon {
        font-size: 1.8rem;
    }
    
    .stat-card h3 {
        font-size: 1.3rem;
    }
    
    .device-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Dark Mode Anpassungen */
[data-bs-theme="dark"] {
    --bs-body-bg: transparent;
}

/* Inputs */
.form-control, .form-select {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
}

/* Alert Anpassungen */
.alert {
    border: none;
    border-radius: 12px;
}
