:root {
    --bg: #09090b;
    --card-bg: rgba(24, 24, 27, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --text-main: #fafafa;
    --text-muted: #a1a1aa;
    --success: #22c55e;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.05), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.05), transparent 30%);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.app-container {
    display: flex;
    width: 100%;
}

/* Navigation / Sidebar */
aside {
    width: 280px;
    padding: 30px;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 40px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    letter-spacing: 0.5px;
}
.logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

nav a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
    transform: translateX(4px);
}

nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.sidebar-bottom {
    margin-top: auto;
}
.auth-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    border-radius: 16px;
}
.auth-box img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}
.auth-box h4 { font-size: 14px; font-weight: 600; }
.auth-box p { font-size: 12px; color: var(--text-muted); }


/* Main Header */
.main-content {
    flex: 1;
    padding: 40px 50px;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

header h1 {
    font-size: 34px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-muted);
    font-size: 15px;
    display: flex;
    align-items: center;
}

.status-badge {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.1);
}

/* Devices Grid & Cards */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 28px;
}

.device-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 28px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.device-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 19px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* UI Switch/Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.15);
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Thermostat */
.temp-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 10px 0;
}
.btn-temp {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.btn-temp:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}
.btn-temp:active {
    transform: scale(0.95);
}
.current-temp {
    font-size: 64px;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: flex-start;
}
.current-temp .degree {
    font-size: 24px;
    margin-top: 8px;
    color: var(--text-muted);
}
.mode-selector {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 6px;
    gap: 6px;
}
.mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 10px;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.mode-btn:hover {
    color: #fff;
}
.mode-btn.active {
    background: rgba(255,255,255,0.1);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Lights Range Slider */
.brightness-control p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: none;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: 0.2s;
}
input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Colors */
.color-presets {
    display: flex;
    gap: 14px;
}
.color-dot {
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { 
    border-color: white; 
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

/* Camera */
.camera-feed {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    height: 180px;
    background: url('https://images.unsplash.com/photo-1558036117-15d82a90b9b1?auto=format&fit=crop&q=80&w=600') center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.6);
}
.camera-feed::after {
    content: '';
    position: absolute;
    top:0; left:0; right:0; bottom:0;
    background: radial-gradient(circle, transparent 50%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
}
.camera-feed .overlay {
    position: absolute;
    bottom: 12px; left: 12px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    letter-spacing: 0.5px;
    z-index: 2;
}
.play-icon {
    font-size: 24px;
    color: white;
    background: rgba(255,255,255,0.2);
    width: 60px; height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: 0.3s;
    z-index: 2;
    border: 1px solid rgba(255,255,255,0.3);
}
.play-icon:hover {
    background: var(--primary);
    transform: scale(1.1);
}
.live-indicator {
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 1px;
}
.live-indicator .dot {
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}
@keyframes blink {
    0% { opacity: 1; box-shadow: 0 0 8px var(--danger); }
    50% { opacity: 0.3; box-shadow: none; }
    100% { opacity: 1; box-shadow: 0 0 8px var(--danger); }
}

/* Nest Speaker / Hub */
.now-playing {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: 16px;
}
.now-playing img {
    border-radius: 12px;
    width: 60px; height: 60px;
    object-fit: cover;
}
.now-playing h4 { font-weight: 500; font-size: 16px; margin-bottom: 4px; }
.now-playing p { font-size: 13px; color: var(--text-muted); }

.media-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-top: 10px;
}
.btn-media {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-media:hover { color: white; }
.btn-media.play-pause {
    font-size: 24px;
    color: white;
    width: 50px; height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-media.play-pause:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.playing-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 14px;
}
.playing-bars .bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    animation: sound 1s infinite alternate ease-in-out;
}
.playing-bars .bar:nth-child(1) { height: 100%; animation-delay: 0.1s;}
.playing-bars .bar:nth-child(2) { height: 60%; animation-delay: 0.3s;}
.playing-bars .bar:nth-child(3) { height: 80%; animation-delay: 0.5s;}

@keyframes sound {
    0% { height: 20%; }
    100% { height: 100%; box-shadow: 0 0 5px var(--primary); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}
.toast {
    background: rgba(24, 24, 27, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    color: white;
    padding: 16px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    font-weight: 500;
    font-size: 14px;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast i { font-size: 18px; }
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
