/* ==========================================================================
   HOMEDECK — STYLESHEET
   ========================================================================== */

:root {
  /* Colors */
  --bg-color: #05070f;
  --bg-glow-1: #0e1e38;
  --bg-glow-2: #1c0a35;
  
  --panel-bg: rgba(10, 15, 30, 0.18);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-glow: rgba(0, 0, 0, 0.5);
  
  --text-primary: #f0f4f8;
  --text-secondary: #8a99ad;
  --text-muted: #52637a;
  
  /* Brand Accents */
  --color-cyan: hsl(187, 85%, 53%);
  --color-purple: hsl(270, 80%, 65%);
  --color-amber: hsl(38, 92%, 60%);
  --color-green: hsl(142, 70%, 50%);
  --color-red: hsl(0, 85%, 60%);
  
  --accent-primary: var(--color-cyan);
  --accent-secondary: var(--color-purple);

  /* Fonts */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Dimensions */
  --header-height: 70px;
  --scenes-bar-height: 64px;
  --card-radius: 16px;
  --btn-radius: 12px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ==========================================================================
   RESET & SYSTEM STYLES
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

.custom-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.22; /* Make it slightly more visible, but still dark enough */
  z-index: -1;
  pointer-events: none;
  transition: background-image 1.5s ease-in-out; /* Smooth transition for cycling */
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   AMBIENT BACKGROUND
   ========================================================================== */

.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--bg-glow-1) 0%, var(--bg-color) 100%);
}

.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.35;
  mix-blend-mode: screen;
  will-change: transform;
}

.glow-cyan {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--color-cyan) 0%, transparent 70%);
  top: -10vw;
  left: -10vw;
  animation: floatSphere1 25s infinite alternate ease-in-out;
}

.glow-purple {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--color-purple) 0%, transparent 70%);
  bottom: -20vw;
  right: -10vw;
  animation: floatSphere2 30s infinite alternate ease-in-out;
}

.glow-amber {
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, var(--color-amber) 0%, transparent 70%);
  top: 30vh;
  left: 45vw;
  opacity: 0.15;
  animation: floatSphere3 20s infinite alternate ease-in-out;
}

@keyframes floatSphere1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8vw, 12vh) scale(1.1); }
}
@keyframes floatSphere2 {
  0% { transform: translate(0, 0) scale(1.1); }
  100% { transform: translate(-10vw, -8vh) scale(0.9); }
}
@keyframes floatSphere3 {
  0% { transform: translate(0, 0) scale(0.9); }
  100% { transform: translate(-5vw, 5vh) scale(1.15); }
}

/* ==========================================================================
   APP STRUCTURE & CONTAINERS
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  padding: 0 16px;
}

/* Glassmorphism utility */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 32px var(--panel-glow);
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  min-height: var(--header-height);
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 8px;
}

.header-left .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 0 8px rgba(0, 180, 216, 0.3));
}

.logo-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, #8a99ad 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-center {
  display: flex;
  align-items: center;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid var(--panel-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  will-change: opacity, transform;
}

.status-dot.connected {
  background-color: var(--color-green);
  box-shadow: 0 0 10px var(--color-green);
}

.status-dot.disconnected {
  background-color: var(--color-red);
  box-shadow: 0 0 10px var(--color-red);
  animation: pulseDot 1.5s infinite;
}

.connection-status .status-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.header-btn:active {
  transform: translateY(0);
}

.header-btn svg {
  width: 20px;
  height: 20px;
}

/* Floating Settings Button — fixed bottom-right, always reachable */
.fab-settings {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.fab-settings:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: rotate(45deg) scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
}

.fab-settings:active {
  transform: rotate(45deg) scale(0.96);
}

.header-clock {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-primary);
  text-shadow: 0 0 8px rgba(0, 180, 216, 0.2);
}

@keyframes pulseDot {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0.5; }
}

/* ==========================================================================
   ADAPTER STATUS STRIP
   ========================================================================== */

.adapter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding: 2px 0;
}

.adapter-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.adapter-pill .status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.adapter-pill.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.adapter-pill.unifi-protect .status-indicator {
  background-color: var(--color-cyan);
  box-shadow: 0 0 6px var(--color-cyan);
}

.adapter-pill.tapo .status-indicator {
  background-color: var(--color-amber);
  box-shadow: 0 0 6px var(--color-amber);
}

.adapter-pill.alexa .status-indicator {
  background-color: var(--color-green);
  box-shadow: 0 0 6px var(--color-green);
}

.adapter-pill.disabled .status-indicator {
  background-color: var(--text-muted);
  box-shadow: none;
}

/* ==========================================================================
   DEVICE GRID
   ========================================================================== */

.device-grid {
  flex-grow: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 24px;
  align-content: start;
}

/* Room section divider styles if grouped */
.room-header {
  grid-column: 1 / -1;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 12px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-header::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent);
}

/* ==========================================================================
   DEVICE CARDS (BASE & TYPE-SPECIFIC)
   ========================================================================== */

.device-card {
  border-radius: var(--card-radius);
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  transition: all var(--transition-normal);
  overflow: hidden;
}

.device-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  border-color: rgba(255, 255, 255, 0.12);
}

.card-header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
  margin-bottom: 12px;
}

.card-title-group {
  display: flex;
  flex-direction: column;
}

.device-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.device-room {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.device-icon-pill {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.device-card.online {
  /* Dynamic indicator */
}

.device-card.offline {
  opacity: 0.55;
  filter: grayscale(0.5);
}

.device-card.offline::before {
  content: 'OFFLINE';
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.65);
  color: var(--color-red);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 0, 0, 0.2);
  z-index: 10;
}

/* Hotkey Badge */
.hotkey-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.6);
  border: 1.5px solid var(--accent-primary);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

/* Card Controls Base */
.card-controls {
  z-index: 2;
  margin-top: auto;
}

/* --------------------------------------------------------------------------
   CAMERA CARD
   -------------------------------------------------------------------------- */

.device-card.type-camera {
  min-height: 180px;
  padding: 0;
  cursor: pointer;
}

.camera-preview-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.65;
  transition: opacity var(--transition-normal);
}

.device-card.type-camera:hover .camera-preview {
  opacity: 0.85;
}

.camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(5,7,15,0.9) 0%, rgba(5,7,15,0.3) 50%, rgba(5,7,15,0.6) 100%);
  z-index: 2;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.camera-status-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
}

.camera-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.06);
}

.camera-badge.recording {
  color: var(--color-red);
}

.camera-badge.recording .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-red);
  animation: pulseDot 1s infinite;
}

.camera-motion-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-red);
  color: #fff;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(255,0,0,0.4);
}

.camera-motion-indicator .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #fff;
  animation: pulseDot 0.8s infinite;
}

.camera-action-hint {
  font-size: 0.75rem;
  color: var(--color-cyan);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition-normal);
}

.device-card.type-camera:hover .camera-action-hint {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   PLUG CARD
   -------------------------------------------------------------------------- */

.device-card.type-plug {
  --accent-primary: var(--color-amber);
}

.power-btn-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

/* Large satisying round power toggle button */
.power-toggle-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
  transition: all var(--transition-normal);
}

.power-toggle-btn svg {
  width: 28px;
  height: 28px;
  transition: transform var(--transition-normal);
}

.device-card.on .power-toggle-btn {
  color: #fff;
  border-color: var(--accent-primary);
  background: radial-gradient(circle, var(--accent-primary) 0%, rgba(243, 156, 18, 0.1) 100%);
  box-shadow: 0 0 20px rgba(243, 156, 18, 0.25), inset 0 2px 2px rgba(255,255,255,0.2);
}

.device-card.on .power-toggle-btn svg {
  transform: rotate(90deg);
  filter: drop-shadow(0 0 6px #fff);
}

.device-card.on {
  border-color: rgba(243, 156, 18, 0.18);
  box-shadow: inset 0 0 20px rgba(243, 156, 18, 0.03);
}

.plug-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.power-consumption {
  font-family: var(--font-mono);
  color: var(--color-amber);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   LIGHT CARD
   -------------------------------------------------------------------------- */

.device-card.type-light {
  --accent-primary: var(--color-purple);
}

.device-card.type-light.on {
  border-color: rgba(162, 90, 240, 0.22);
}

.light-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

/* Color Circle indicator */
.light-color-preview {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  background: var(--text-muted);
}

.light-brightness-slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.light-brightness-slider-group svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* Slider Style */
.slider-input {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
  transition: transform var(--transition-fast);
}

.slider-input::-webkit-slider-thumb:active {
  transform: scale(1.3);
}

/* --------------------------------------------------------------------------
   SPEAKER CARD
   -------------------------------------------------------------------------- */

.device-card.type-speaker {
  --accent-primary: var(--color-green);
  min-height: 190px;
}

.speaker-now-playing {
  background: rgba(255,255,255,0.02);
  border: 1.5px dashed rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 8px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  min-height: 38px;
}

.speaker-now-playing .scroll-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.speaker-now-playing.playing {
  color: var(--color-green);
  border-color: rgba(46, 204, 113, 0.15);
}

.speaker-now-playing.playing svg {
  animation: spinSlow 4s linear infinite;
}

@keyframes spinSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.speaker-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.speaker-action-row {
  display: flex;
  gap: 8px;
}

.btn-speaker-action {
  flex-grow: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: var(--btn-radius);
  padding: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-speaker-action:hover {
  background: rgba(255,255,255,0.08);
}

.btn-speaker-action.speak-trigger {
  border-color: rgba(46, 204, 113, 0.2);
}

.btn-speaker-action.speak-trigger:hover {
  background: rgba(46, 204, 113, 0.1);
}

.speaker-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speaker-volume-row svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* ==========================================================================
   SCENES BAR (BOTTOM DOCK)
   ========================================================================== */

.scenes-bar {
  height: var(--scenes-bar-height);
  min-height: var(--scenes-bar-height);
  border-top: 1px solid var(--panel-border);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.scene-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.scene-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.scene-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.01);
}

.scene-btn svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

/* ==========================================================================
   OVERLAYS & INTERACTIVE DIALOGS
   ========================================================================= */

.modal-overlay,
.hotkey-overlay,
.stream-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: opacity;
}

.modal-overlay[hidden],
.hotkey-overlay[hidden],
.stream-modal[hidden] {
  display: none !important;
}

/* Backdrop */
.modal-overlay::before,
.hotkey-overlay-backdrop,
.stream-modal-backdrop {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 4, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
}

/* --------------------------------------------------------------------------
   SETTINGS MODAL CARD
   -------------------------------------------------------------------------- */

.modal-card {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter var(--transition-normal);
}

@keyframes modalEnter {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--panel-border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.modal-title svg {
  color: var(--accent-primary);
}

.modal-close,
.stream-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.modal-close:hover,
.stream-close:hover {
  color: #fff;
}

/* Modal Navigation Tabs */
.modal-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--panel-border);
}

.modal-tab {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.modal-tab:hover {
  color: #fff;
}

.modal-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: rgba(255,255,255,0.02);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

/* --------------------------------------------------------------------------
   FORM FIELDS & UI COMPONENTS
   -------------------------------------------------------------------------- */

.form-group {
  margin-bottom: 16px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(0, 180, 216, 0.15);
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

/* Toggles */
.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  background-color: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  border-radius: 34px;
  transition: all var(--transition-fast);
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.switch-input:checked + .switch-slider {
  background-color: var(--accent-primary);
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(22px);
  background-color: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.35);
}

.btn-secondary {
  background: rgba(255,255,255,0.04);
  border-color: var(--panel-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
}

.btn-danger {
  background: var(--color-red);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.25);
}

.btn:active {
  transform: translateY(0);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--panel-border);
  padding-top: 16px;
}

/* --------------------------------------------------------------------------
   ADAPTER MANAGEMENT TAB
   -------------------------------------------------------------------------- */

.adapter-config-card {
  background: rgba(255,255,255,0.01);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

.adapter-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.adapter-config-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   HOTKEY OVERLAY GRID
   -------------------------------------------------------------------------- */

.hotkey-overlay-content {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 580px;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
  animation: modalEnter var(--transition-normal);
}

.hotkey-overlay-title {
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 14px;
}

.hotkey-overlay-title svg {
  color: var(--color-cyan);
}

.hotkey-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: 45vh;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 4px;
}

.hotkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1.5px solid rgba(255,255,255,0.04);
}

.hotkey-key-cap {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 3px 0 rgba(255,255,255,0.05);
  color: var(--color-cyan);
  padding: 4px 10px;
  border-radius: 6px;
  min-width: 32px;
  text-align: center;
}

.hotkey-mapping-details {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 0.9rem;
}

.hotkey-target-name {
  color: var(--text-primary);
}

.hotkey-target-action {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  background: rgba(255,255,255,0.03);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.hotkey-dismiss {
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   CAMERA STREAM FULLSCREEN VIEW
   -------------------------------------------------------------------------- */

.stream-modal-content {
  position: relative;
  z-index: 2;
  width: 95%;
  max-width: 800px;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  animation: modalEnter var(--transition-normal);
}

.stream-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 100%);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 3;
}

.stream-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stream-camera-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.stream-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.stream-status .recording-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-green);
  animation: pulseDot 1s infinite;
}

.stream-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stream-motion-badge {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: var(--color-red);
  color: #fff;
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(255,0,0,0.4);
  z-index: 3;
}

.stream-motion-badge .motion-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #fff;
  animation: pulseDot 0.6s infinite;
}

/* --------------------------------------------------------------------------
   SPEAK DIALOG
   -------------------------------------------------------------------------- */

.modal-speak-card {
  max-width: 440px;
}

.speak-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-speak-send {
  justify-content: center;
  background: var(--color-green);
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.25);
}

.btn-speak-send:hover {
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.35);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
}

.toast {
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  padding: 14px 20px;
  border-radius: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  animation: toastIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  will-change: transform;
}

@keyframes toastIn {
  to { transform: translateX(0); }
}

.toast.toast-motion {
  border-left: 4px solid var(--color-red);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast.toast-motion .toast-icon {
  color: var(--color-red);
  animation: pulseDot 1s infinite;
}

.toast-message {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}

/* ==========================================================================
   EMPTY STATE & LOADING SKELETONS
   ========================================================================== */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  text-align: center;
  padding: 40px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 320px;
}

/* Loading Skeleton Shimmer */
.skeleton-card {
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--panel-border);
  border-radius: var(--card-radius);
  min-height: 160px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.02), transparent);
  transform: translateX(-100%);
  animation: skeletonShimmer 1.8s infinite;
}

@keyframes skeletonShimmer {
  to { transform: translateX(100%); }
}

/* ==========================================================================
   MEDIA QUERIES (TABLET LANDSCAPE & PORTRAIT OPTIMIZATIONS)
   ========================================================================== */

/* Landscape Mode (mostly default 10-inch) */
@media (min-width: 1024px) {
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

/* Portrait / Mobile / 7-inch adjustments */
@media (max-width: 768px) {
  .logo-title {
    font-size: 1.2rem;
  }
  .header-clock {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .device-card {
    padding: 14px;
    min-height: 150px;
  }
  .power-toggle-btn {
    width: 58px;
    height: 58px;
  }
  .power-toggle-btn svg {
    width: 24px;
    height: 24px;
  }
}

/* Small smartphone screens */
@media (max-width: 480px) {
  .dashboard-header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 0;
    gap: 10px;
  }
  .header-left, .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .header-center {
    display: none; /* Hide status to save space */
  }
  .device-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   WALL KIOSK DASHBOARD THEME (MIMICKING REFERENCE PHOTO)
   ========================================================================== */

.dashboard-kiosk-layout {
  display: grid;
  grid-template-columns: 310px 1fr 300px;
  gap: 20px;
  flex-grow: 1;
  padding: 10px 0 20px 0;
  height: calc(100vh - 90px);
  overflow: hidden;
}

.kiosk-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

/* Center area wraps device grid + camera row beneath it */
.kiosk-center-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  overflow: hidden;
}

.kiosk-column.col-middle {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 240px;
}

/* Camera row: centered, fixed height below the device grid */
.camera-bottom-row {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  margin-top: -8px; /* Pull the card up more */
}

.camera-bottom-row .card-camera-switcher {
  width: min(300px, 100%);
}

/* Matte glass card style */
.kiosk-card {
  background: rgba(20, 23, 32, 0.18);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ─── COLUMN 1: LEFT CARD (WEATHER) ──────────────────────────────────────── */
.card-weather {
  flex-grow: 0;
}

.ios-weather-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ios-weather-main {
  display: flex;
  flex-direction: column;
}

.ios-weather-city {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

.ios-weather-temp {
  font-size: 3.5rem;
  font-weight: 200;
  color: #fff;
  line-height: 1;
  margin-top: 4px;
}

.ios-weather-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.ios-weather-clock {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.ios-weather-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-bottom: 6px;
}

.ios-weather-cond {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}

.ios-cond-icon {
  font-size: 0.95rem;
}

.ios-weather-hl {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.ios-weather-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 0;
}

.ios-weather-hourly {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hourly-time {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.hourly-icon {
  font-size: 1.1rem;
}

.hourly-temp {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

/* Forecast list with bars */
.weather-forecast-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.temp-min-lbl {
  width: 32px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 8px;
}

.forecast-row {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  padding: 4px 0;
}

.day-lbl {
  width: 35px;
  color: var(--text-secondary);
  font-weight: 600;
}

.day-icon {
  width: 25px;
  text-align: center;
}

.temp-bar-wrapper {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  position: relative;
  margin: 0 12px;
  overflow: hidden;
}

.temp-bar-fill {
  position: absolute;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #4ea8de 0%, #ffd166 100%);
}

.temp-range {
  width: 35px;
  text-align: right;
  font-weight: 700;
  color: #fff;
}

/* Scene buttons left column */
.card-quick-scenes {
  flex-grow: 1;
  gap: 12px;
}

.kiosk-scene-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kiosk-scene-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255,255,255,0.08);
}

.scene-icon {
  font-size: 1.4rem;
}

.scene-label {
  display: flex;
  flex-direction: column;
}

.scene-label strong {
  font-size: 0.85rem;
  color: #fff;
}

.scene-label span {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Garage Panel */
.kiosk-garage-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px 16px;
  border-radius: 14px;
}

.garage-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.garage-icon {
  font-size: 1.4rem;
}

.garage-label {
  display: flex;
  flex-direction: column;
}

.garage-label strong {
  font-size: 0.85rem;
  color: #fff;
}

.garage-status {
  font-size: 0.7rem;
  color: var(--color-green);
}

.garage-actions {
  display: flex;
  gap: 6px;
}

.garage-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.garage-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ─── COLUMN 2: MIDDLE CARDS (ROOMS GRID) ────────────────────────────────── */
.kiosk-room-card {
  background: rgba(20, 23, 32, 0.18);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  padding-bottom: 8px;
}

.room-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.room-card-temp {
  font-size: 0.75rem;
  font-weight: 700;
  color: hsl(38, 92%, 60%);
  background: rgba(255, 209, 102, 0.06);
  padding: 2px 8px;
  border-radius: 12px;
}

.room-card-devices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Override Device Cards for compact vertical column placement */
.kiosk-room-card .device-card {
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 10px;
}

.kiosk-room-card .device-card.type-light,
.kiosk-room-card .device-card.type-plug {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.kiosk-room-card .device-card .brightness-slider {
  display: none; /* Hide sliders to keep room view compact */
}

/* ─── COLUMN 3: RIGHT CARDS (WIDGETS & CAMERA SWITCHER) ──────────────────── */

/* Calendar Card with Blur lock overlay */
.card-calendar {
  flex-grow: 1;
}

.calendar-header-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.calendar-link-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.calendar-blur-overlay {
  position: relative;
  flex-grow: 1;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-blur-overlay::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  backdrop-filter: blur(16px);
  background: rgba(20, 23, 32, 0.55);
  z-index: 2;
}

.blur-lock-icon {
  position: absolute;
  font-size: 1.8rem;
  z-index: 3;
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.6));
}

.calendar-mock-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 10px;
  opacity: 0.45;
}

.mock-event {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mock-event strong {
  font-size: 0.75rem;
  color: #fff;
}

.mock-event span {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

/* Energy Card */
.card-energy {
  flex-grow: 0.8;
  gap: 12px;
}

.energy-title-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.energy-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.energy-value-large {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
}

.energy-value-large .unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.energy-chart-container {
  height: 45px;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.energy-sparkline {
  width: 100%;
  height: 100%;
}

.quick-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.quick-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.quick-pill:hover, .quick-pill.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255,255,255,0.12);
  color: #fff;
}

/* Camera Switcher Card */
.card-camera-switcher {
  flex-grow: 1.2;
  padding: 10px;
  gap: 8px;
}

.camera-switcher-viewport {
  position: relative;
  flex-grow: 1;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.switcher-frame-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-switcher-overlay {
  position: absolute;
  bottom: 0; left: 0; width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switcher-camera-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.switcher-motion-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--color-red);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  animation: pulseDot 1.5s infinite;
}

.camera-switcher-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.switcher-btn {
  flex: 0 1 auto;
  width: 150px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.switcher-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}
}

/* Spotify Cast Popup Modal & Quick Controls Styling */
.spotify-modal-card {
  max-width: 650px !important;
  width: 90% !important;
  border: 1px solid rgba(30, 215, 96, 0.3) !important;
}

.spotify-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 10px 0;
}

.spotify-track-view {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 12px;
}

.spotify-art-disc {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  background: rgba(30, 215, 96, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotateDisc 8s linear infinite;
}

@keyframes rotateDisc {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spotify-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spot-track-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.spot-track-artist {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.spotify-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.spot-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.spot-btn:hover {
  background: rgba(30, 215, 96, 0.15);
  border-color: rgba(30, 215, 96, 0.4);
  color: #1ed760;
  transform: scale(1.05);
}

.spot-btn.play {
  width: 54px;
  height: 54px;
  background: #1ed760;
  color: #000;
  font-size: 1.3rem;
  border: none;
}

.spot-btn.play:hover {
  background: #1db954;
  color: #000;
  transform: scale(1.05);
}

.spotify-cast-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 14px;
}

.card-quick-controls {
  flex-grow: 0.6;
}

.quick-controls-header {
  margin-bottom: 12px;
}

.controls-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Monthly Calendar Layout CSS */
.calendar-monthly-view {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px;
}

.calendar-month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cal-nav-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

.cal-nav-btn:active {
  transform: scale(0.92);
}

.calendar-upcoming-title-bar {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--color-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 18px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-upcoming-title-bar::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 242, 254, 0.15), transparent);
}

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  text-align: center;
}

.day-header-cell {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-cell {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-cell:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.05);
}

.day-cell:active {
  transform: scale(0.92);
}

.day-cell.trailing {
  color: var(--text-muted);
  opacity: 0.25;
  cursor: default;
}

.day-cell.trailing:hover {
  background: none;
  transform: none;
}

.day-cell.today {
  background: var(--color-cyan);
  color: var(--bg-color) !important;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.35);
}

.day-cell.selected {
  box-shadow: 0 0 0 2px var(--color-cyan);
  background: rgba(0, 242, 254, 0.05);
  color: #fff;
}

.day-cell.has-event {
  background: rgba(0, 242, 254, 0.06);
  border: 1px solid rgba(0, 242, 254, 0.15);
}

.event-indicator-dot {
  width: 4px;
  height: 4px;
  background-color: var(--color-cyan);
  border-radius: 50%;
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.calendar-upcoming-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--color-cyan);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 10px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.calendar-upcoming-alert:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.alert-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.08);
  color: var(--color-cyan);
  flex-shrink: 0;
}

.alert-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
  min-width: 0;
}

.alert-text strong {
  font-size: 0.78rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.alert-text span {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

/* Header Spotify Music Pill */
.header-music-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 215, 96, 0.08);
  border: 1px solid rgba(30, 215, 96, 0.15);
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
  margin-left: 16px;
  transition: all 0.2s ease;
  height: 32px;
}

.header-music-btn:hover {
  background: rgba(30, 215, 96, 0.15);
  border-color: rgba(30, 215, 96, 0.3);
  transform: translateY(-1px);
}

.music-icon-note {
  font-size: 0.9rem;
}

.music-text-group {
  display: block;
  max-width: 140px;
  overflow: hidden;
  position: relative;
  white-space: nowrap;
}

.music-track-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1ed760;
  white-space: nowrap;
  display: inline-block;
  transform: translateX(0);
}

.music-track-title.scroll-active {
  animation: scroll-header-text 10s linear infinite alternate;
}

@keyframes scroll-header-text {
  0% { transform: translateX(0); }
  25% { transform: translateX(0); } /* pause briefly at start */
  100% { transform: translateX(calc(-100% + 140px)); }
}

/* Header Plex Movie Pill */
.header-plex-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(229, 160, 13, 0.08);
  border: 1px solid rgba(229, 160, 13, 0.15);
  padding: 6px 14px;
  border-radius: 12px;
  margin-left: 10px;
  height: 32px;
}

.plex-icon-note {
  font-size: 0.9rem;
}

.plex-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 160px;
  overflow: hidden;
}

.plex-track-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e5a00d;
  white-space: nowrap;
  display: inline-block;
  transform: translateX(0);
}

.plex-track-title.plex-scroll-active {
  animation: scroll-plex-text var(--plex-scroll-duration, 8s) linear infinite alternate;
}

@keyframes scroll-plex-text {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(0); }
  100% { transform: translateX(calc(-100% + 160px)); }
}

/* ==========================================================================
   TABLET / SMALLER SCREEN RESPONSIVE — Kiosk Layout
   ========================================================================== */

/* Tablet landscape (~1024px) — drop right calendar column */
@media (max-width: 1100px) {
  .dashboard-kiosk-layout {
    grid-template-columns: 280px 1fr;
    height: auto;
    overflow: visible;
  }

  .kiosk-column.col-right {
    display: none; /* Hide calendar on tablet to make room */
  }

  .kiosk-center-area {
    height: auto;
    overflow: visible;
  }

  .kiosk-column.col-middle {
    max-height: none;
    overflow-y: visible;
  }

  .camera-bottom-row .card-camera-switcher {
    width: min(300px, 100%);
  }
}

/* Tablet portrait / small tablet (~768px) — single column stack */
@media (max-width: 800px) {
  .dashboard-kiosk-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
    height: auto;
    padding-bottom: 40px;
  }

  .kiosk-column.col-left {
    display: none; /* Collapse weather/scenes sidebar on small tablets */
  }

  .kiosk-center-area {
    height: auto;
    overflow: visible;
  }

  .kiosk-column.col-middle {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    overflow-y: visible;
    max-height: none;
  }

  /* Camera always visible and full width on small screens */
  .camera-bottom-row {
    padding: 0 4px;
  }

  .camera-bottom-row .card-camera-switcher {
    width: 100%;
    max-width: 440px;
  }
}

/* Kiosk Group Card Button */
.kiosk-group-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(20, 23, 32, 0.18);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.kiosk-group-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.kiosk-group-card:active {
  transform: translateY(0);
}

.group-card-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.group-card-icon {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.group-card-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.group-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.group-card-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.group-card-action {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.kiosk-group-card:hover .group-card-action {
  color: #fff;
}

