body {
    font-family: 'Poppins', sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    transition: background 0.3s ease, color 0.3s ease;
    margin: 0;
}

body[data-bs-theme="light"] {
    background: #f6f8fa;
    color: #24292e;
}

/* Sidebar */
.sidebar {
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid #21262d;
}

body[data-bs-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid #d0d7de;
}

.offcanvas {
    width: 250px !important;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

body[data-bs-theme="light"] .offcanvas {
    background: rgba(255, 255, 255, 0.95);
}

.nav-link {
    color: #c9d1d9 !important;
    border-radius: 8px;
    transition: background 0.3s ease, transform 0.3s ease;
}

body[data-bs-theme="light"] .nav-link {
    color: #24292e !important;
}

.nav-link:hover {
    background: #21262d;
    transform: translateX(5px);
}

body[data-bs-theme="light"] .nav-link:hover {
    background: #e6edf3;
}

.nav-link.active {
    background: #58a6ff;
    color: #ffffff !important;
}

/* Navbar */
.navbar {
    background: rgba(22, 27, 34, 0.95) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid #21262d;
}

body[data-bs-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #d0d7de;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(90deg, #58a6ff, #1f6feb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

/* Glassmorphism Cards */
.glass-card {
    background: rgba(22, 27, 34, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid #21262d;
}

body[data-bs-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #d0d7de;
}

.glass-card .card-header {
    background: transparent;
    border-bottom: none;
}

/* Neumorphic Buttons */
.neumorphic-btn {
    background: rgba(22, 27, 34, 0.7);
    border: none;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3), -5px -5px 10px rgba(50, 58, 70, 0.2);
    transition: box-shadow 0.3s ease;
    color: #c9d1d9;
}

body[data-bs-theme="light"] .neumorphic-btn {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.1), -5px -5px 10px rgba(255, 255, 255, 0.5);
    color: #24292e;
}

.neumorphic-btn:hover {
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.3), inset -5px -5px 10px rgba(50, 58, 70, 0.2);
}

body[data-bs-theme="light"] .neumorphic-btn:hover {
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.1), inset -5px -5px 10px rgba(255, 255, 255, 0.5);
}

.btn-primary {
    background-color: #58a6ff;
    border-color: #58a6ff;
}

.btn-primary:hover {
    background-color: #1f6feb;
    border-color: #1f6feb;
}

/* Video Feed */
#video-feed {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#video-feed:not([src]) + #video-loading {
    display: block;
}

#video-feed[src] + #video-loading {
    display: none;
}

/* Sensor Cards */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3) !important;
}

/* Pulsing Badge Animation */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.badge.alert-pulse {
    animation: pulse 1.5s infinite;
}

.badge.bg-success {
    background-color: #238636 !important;
}

body[data-bs-theme="light"] .badge.bg-success {
    background-color: #2ea44f !important;
}

.badge.bg-danger {
    background-color: #f85149 !important;
}

body[data-bs-theme="light"] .badge.bg-danger {
    background-color: #da3633 !important;
}

/* Footer */
footer {
    border-top: 1px solid #21262d;
    padding: 1rem 0;
}

body[data-bs-theme="light"] footer {
    border-top: 1px solid #d0d7de;
}

.text-muted {
    color: #8b949e !important;
}

body[data-bs-theme="light"] .text-muted {
    color: #57606a !important;
}

.text-success {
    color: #238636 !important;
}

body[data-bs-theme="light"] .text-success {
    color: #2ea44f !important;
}

.text-danger {
    color: #f85149 !important;
}

body[data-bs-theme="light"] .text-danger {
    color: #da3633 !important;
}

/* Chart Styles */
#temperatureChart {
    max-height: 350px;
}

/* Page Styles */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Loading States */
.card.loading {
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }

    .card-header h5 {
        font-size: 1rem;
    }

    .card-body h4 {
        font-size: 1.25rem;
    }

    .badge {
        font-size: 0.75rem;
    }

    footer {
        font-size: 0.875rem;
    }

    #temperatureChart {
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .card {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 576px) {
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    padding: 15px;
    border-radius: 5px;
    animation: fadeInOut 5s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(100%); }
    10% { opacity: 1; transform: translateX(0); }
    90% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(100%); }
}