/* Design Tokens & Theme Variables */
:root {
  --bg-color: #0b0c16;
  --panel-bg: rgba(20, 22, 37, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  
  /* Neon & Active Accents */
  --accent-ac: #00f2fe;
  --accent-ac-glow: rgba(0, 242, 254, 0.35);
  --accent-tv: #8b5cf6;
  --accent-tv-glow: rgba(139, 92, 246, 0.35);
  --accent-pc: #3b82f6;
  --accent-pc-glow: rgba(59, 130, 246, 0.35);
  --accent-lights: #eab308;
  --accent-lights-glow: rgba(234, 179, 8, 0.35);
  
  --success: #10b981;
  --danger: #ef4444;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset and Core Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-image: url('https://images.unsplash.com/photo-1506318137071-a8e063b4bec0?q=80&w=1920');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-primary);
  overflow: hidden; /* Fit within iPad screen */
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Stunning Ambient Glow Background */
.background-glows {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  mix-blend-mode: screen;
}

.glow-1 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--accent-ac) 0%, transparent 70%);
  top: -10%;
  left: -10%;
}

.glow-2 {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--accent-tv) 0%, transparent 70%);
  bottom: -20%;
  right: -10%;
}

.glow-3 {
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, var(--accent-lights) 0%, transparent 70%);
  top: 30%;
  left: 45%;
}

/* Layout container */
.dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px;
}

/* Header styling */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  height: 70px;
  flex-shrink: 0;
}

#greeting {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#dashboard-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.clock-display {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1;
}

.clock-display .seconds {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 400;
  vertical-align: super;
  margin-left: 2px;
}

.date-display {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-top: 4px;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.status-dot.online {
  background-color: var(--success);
  color: var(--success);
}

.status-dot.offline {
  background-color: var(--danger);
  color: var(--danger);
}

.status-dot.checking {
  background-color: #f59e0b;
  color: #f59e0b;
  animation: pulse-glow 1s infinite alternate;
}

@keyframes pulse-glow {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.icon-button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.icon-button:hover, .icon-button:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Banner Notificação */
.notification-banner {
  background: rgba(239, 68, 68, 0.85);
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--danger);
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  z-index: 10;
}

.notification-banner.hidden {
  display: none;
}

.notification-banner .close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* Grid Layout (Targeting 1024x768 iPad Mini 2 screen) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 20px;
  flex-grow: 1;
  height: calc(100vh - 138px); /* total height minus header & gap margins */
  min-height: 0; /* allows children to use overflow hidden properly */
}

/* Premium Card Architecture */
.grid-card {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.grid-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.45);
}

.double-height {
  grid-row: 1 / span 2;
}

#card-ac {
  grid-column: 1;
}

#card-tv {
  grid-column: 2;
}

#card-pc {
  grid-column: 2;
}

#card-lights {
  grid-column: 3;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.header-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.header-titles {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.header-titles h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 6px;
  width: fit-content;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

/* Rocker Switch (Physical Wall Switch style - Upgraded) */
.rocker-switch {
  position: relative;
  display: inline-block;
  width: 58px;
  height: 78px;
  background: linear-gradient(135deg, #18192d 0%, #0c0d1b 100%);
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.5), 
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  perspective: 200px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.rocker-switch:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 
    0 8px 18px rgba(0, 0, 0, 0.6), 
    inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

.rocker-switch:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.4), 
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

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

.rocker-switch-btn {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  background: linear-gradient(to bottom, #2b2e4c 0%, #151624 100%);
  border-radius: 9px;
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.4), 
    inset 0 1px 1px rgba(255, 255, 255, 0.12);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform-style: preserve-3d;
}

/* Horizontal tactile division line on the physical switch key */
.rocker-switch-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 12%;
  right: 12%;
  height: 2px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 1.5px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-50%);
}

/* LED Indicator Dot */
.rocker-switch-btn::before {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-50%);
  box-shadow: inset 0 1.5px 2px rgba(0, 0, 0, 0.6);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* OFF State: button tilted down towards the bottom */
.rocker-switch input:not(:checked) + .rocker-switch-btn {
  transform: rotateX(20deg);
  background: linear-gradient(to bottom, #2c2f4a 0%, #121320 100%);
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.5), 
    inset 0 1.5px 0 rgba(255, 255, 255, 0.1);
}

/* ON State: button tilted down towards the top, LED active */
.rocker-switch input:checked + .rocker-switch-btn {
  transform: rotateX(-20deg);
  background: linear-gradient(to bottom, #121320 0%, #2c2f4a 100%);
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.6), 
    inset 0 1.5px 0 rgba(255, 255, 255, 0.05);
}

/* Card Glow Themes when Powered ON */
/* Air Conditioner */
.card-ac.on {
  border-color: rgba(0, 242, 254, 0.3);
  box-shadow: 0 8px 32px 0 rgba(0, 242, 254, 0.15);
}
.card-ac.on .header-icon {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-ac);
  border-color: rgba(0, 242, 254, 0.25);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}
.card-ac .rocker-switch {
  border-color: rgba(0, 242, 254, 0.15);
}
.card-ac.on .rocker-switch {
  border-color: var(--accent-ac);
  box-shadow: 0 0 12px var(--accent-ac-glow);
}
.card-ac .rocker-switch input:checked + .rocker-switch-btn::before {
  background-color: var(--accent-ac);
  box-shadow: 0 0 10px 2px var(--accent-ac), 0 0 16px 4px var(--accent-ac-glow);
}

/* TV */
.card-tv.on {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.15);
}
.card-tv.on .header-icon {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-tv);
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}
.card-tv .rocker-switch {
  border-color: rgba(139, 92, 246, 0.15);
}
.card-tv.on .rocker-switch {
  border-color: var(--accent-tv);
  box-shadow: 0 0 12px var(--accent-tv-glow);
}
.card-tv .rocker-switch input:checked + .rocker-switch-btn::before {
  background-color: var(--accent-tv);
  box-shadow: 0 0 10px 2px var(--accent-tv), 0 0 16px 4px var(--accent-tv-glow);
}

/* PC */
.card-pc.on {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 8px 32px 0 rgba(59, 130, 246, 0.15);
}
.card-pc.on .header-icon {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-pc);
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}
.card-pc .rocker-switch {
  border-color: rgba(59, 130, 246, 0.15);
}
.card-pc.on .rocker-switch {
  border-color: var(--accent-pc);
  box-shadow: 0 0 12px var(--accent-pc-glow);
}
.card-pc .rocker-switch input:checked + .rocker-switch-btn::before {
  background-color: var(--accent-pc);
  box-shadow: 0 0 10px 2px var(--accent-pc), 0 0 16px 4px var(--accent-pc-glow);
}

/* Lights */
.card-lights.on {
  border-color: rgba(234, 179, 8, 0.3);
  box-shadow: 0 8px 32px 0 rgba(234, 179, 8, 0.15);
}
.card-lights.on .header-icon {
  background: rgba(234, 179, 8, 0.15);
  color: var(--accent-lights);
  border-color: rgba(234, 179, 8, 0.25);
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.2);
}
.card-lights .rocker-switch {
  border-color: rgba(234, 179, 8, 0.15);
}
.card-lights.on .rocker-switch {
  border-color: var(--accent-lights);
  box-shadow: 0 0 12px var(--accent-lights-glow);
}
.card-lights .rocker-switch input:checked + .rocker-switch-btn::before {
  background-color: var(--accent-lights);
  box-shadow: 0 0 10px 2px var(--accent-lights), 0 0 16px 4px var(--accent-lights-glow);
}

/* ==================================================== */
/* WIDGET CONTENT: AIR CONDITIONER                      */
/* ==================================================== */
.ac-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  flex-grow: 1;
  width: 100%;
}

/* Temperature Dial Styles */
.temp-control-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 15px 0;
}

.dial-outer {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(from 220deg, var(--accent-ac) 0%, rgba(255, 255, 255, 0.05) 50%, var(--accent-ac) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  position: relative;
  transition: all 0.5s ease;
}

/* If AC is off, gray out the dial */
.card-ac:not(.on) .dial-outer {
  background: conic-gradient(from 220deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.dial-inner {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: #111222;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.room-temp-overlay {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dial-temp-display {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin: 4px 0;
  display: flex;
  align-items: flex-start;
}

.dial-temp-display .degree-symbol {
  font-size: 26px;
  font-weight: 400;
  color: var(--accent-ac);
  margin-top: 4px;
}

.card-ac:not(.on) .dial-temp-display .degree-symbol {
  color: var(--text-secondary);
}

.dial-status-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dial-buttons {
  display: flex;
  gap: 30px;
  margin-top: -15px;
  z-index: 2;
}

.dial-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.card-ac.on .dial-btn:hover, .card-ac.on .dial-btn:active {
  background: var(--accent-ac);
  color: #000;
  border-color: var(--accent-ac);
  transform: scale(1.1);
  box-shadow: 0 0 10px var(--accent-ac-glow);
}

.card-ac:not(.on) .dial-btn {
  opacity: 0.4;
  cursor: not-allowed;
}

/* AC Mode Buttons Grid */
.ac-modes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  flex-shrink: 0;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-ac.on .mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.card-ac.on .mode-btn.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-ac);
  color: var(--accent-ac);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.card-ac:not(.on) .mode-btn {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================================================== */
/* WIDGET CONTENT: TV CONTROL                           */
/* ==================================================== */
.tv-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  justify-content: flex-start;
}

.remote-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.volume-control {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 4px;
  justify-content: space-between;
}

.tv-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.card-tv.on .tv-btn:hover, .card-tv.on .tv-btn:active {
  background: var(--accent-tv);
  color: #fff;
  border-color: var(--accent-tv);
  box-shadow: 0 0 8px var(--accent-tv-glow);
}

.card-tv:not(.on) .tv-btn {
  opacity: 0.4;
  cursor: not-allowed;
}

.volume-display {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.mute-and-input {
  justify-content: space-between;
  gap: 12px;
}

.btn-mute {
  flex: 1;
  justify-content: center;
}

.card-tv.on .btn-mute.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.input-select-container {
  flex: 1.2;
  position: relative;
}

.tv-input-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.tv-input-select option {
  background: #151628;
  color: #fff;
}

.card-tv:not(.on) .tv-input-select {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==================================================== */
/* WIDGET CONTENT: COMPUTER (PC)                        */
/* ==================================================== */
.pc-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.pc-status-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

#pc-ping-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 10px 0;
}

.pc-action-buttons {
  width: 100%;
}

.action-btn {
  width: 100%;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 14px;
  padding: 12px;
  color: var(--accent-pc);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.action-btn:hover, .action-btn:active {
  background: var(--accent-pc);
  color: #fff;
  border-color: var(--accent-pc);
  box-shadow: 0 0 12px var(--accent-pc-glow);
}

/* ==================================================== */
/* WIDGET CONTENT: LIGHTS                               */
/* ==================================================== */
.lights-body {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex-grow: 1;
  width: 100%;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 10px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.card-lights.on .control-label span:first-child {
  color: #fff;
}

.card-lights:not(.on) .control-group {
  opacity: 0.4;
  pointer-events: none;
}

/* Premium Range Slider styling */
.slider-wrapper {
  width: 100%;
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  transition: background 0.3s ease;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  border: 2px solid var(--accent-lights);
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

/* Color Presets Grid */
.color-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.color-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.color-dot.active {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 12px currentColor;
}

.color-picker-wrapper {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
}

.color-input {
  position: absolute;
  top: -10%; left: -10%;
  width: 120%; height: 120%;
  border: none;
  opacity: 0;
  cursor: pointer;
}

.custom-color-btn {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #f43f5e, #3b82f6, #10b981, #eab308);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

/* ==================================================== */
/* CONFIGURATION MODAL (SETTINGS)                       */
/* ==================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 6, 12, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
}

.modal-content {
  background: rgba(22, 24, 43, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: modalZoom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalZoom {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: #fff;
}

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

.form-section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.15);
}

.form-section legend {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 0 10px;
  color: var(--text-secondary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group.row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-pc);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
}

.input-with-btn {
  display: flex;
  gap: 10px;
}

.input-with-btn input {
  flex-grow: 1;
}

.action-btn-inline {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent-pc);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.action-btn-inline:hover {
  background: var(--accent-pc);
  color: #fff;
  border-color: var(--accent-pc);
  box-shadow: 0 0 10px var(--accent-pc-glow);
}

.action-btn-inline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.hidden-fields {
  display: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.primary-btn {
  background: var(--accent-pc);
  border: none;
  color: #fff;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-pc-glow);
  transition: all 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-pc-glow);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Animations */
@keyframes slideDown {
  0% { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.ac-secondary-actions {
  width: 100%;
  padding: 0 10px;
  margin-top: 12px;
  flex-shrink: 0;
}

.windfree-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 12px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-ac.on .windfree-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.card-ac.on .windfree-btn.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-ac);
  color: var(--accent-ac);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

.card-ac:not(.on) .windfree-btn {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tv-dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 15px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 18px;
}

.tv-dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 8px;
  justify-content: center;
  align-items: center;
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  border-radius: 50%;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2);
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-tv:not(.on) .dpad-btn {
  opacity: 0.3;
  pointer-events: none;
  cursor: not-allowed;
}

.card-tv.on .dpad-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-tv);
  color: var(--accent-tv);
  box-shadow: 0 0 8px var(--accent-tv-glow);
  transform: scale(1.05);
}

.card-tv.on .dpad-btn:active {
  transform: scale(0.95);
}

.dpad-up {
  grid-column: 2;
  grid-row: 1;
  border-radius: 14px 14px 6px 6px;
}

.dpad-left {
  grid-column: 1;
  grid-row: 2;
  border-radius: 14px 6px 6px 14px;
}

.dpad-ok {
  grid-column: 2;
  grid-row: 2;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.2);
}

.dpad-right {
  grid-column: 3;
  grid-row: 2;
  border-radius: 6px 14px 14px 6px;
}

.dpad-down {
  grid-column: 2;
  grid-row: 3;
  border-radius: 6px 6px 14px 14px;
}

.tv-nav-extra {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.btn-nav-back, .btn-nav-home {
  flex: 1;
  max-width: 110px;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
}

.card-tv:not(.on) .btn-nav-back,
.card-tv:not(.on) .btn-nav-home {
  opacity: 0.3;
  pointer-events: none;
}

.tv-apps-container {
  width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tv-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.app-btn {
  padding: 8px 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-tv:not(.on) .app-btn {
  opacity: 0.3;
  pointer-events: none;
  cursor: not-allowed;
}

.app-netflix {
  background: rgba(229, 9, 20, 0.06);
  border-color: rgba(229, 9, 20, 0.15);
  color: #e50914;
}
.card-tv.on .app-netflix:hover {
  background: #e50914;
  color: #fff;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.3);
}

.app-primevideo {
  background: rgba(0, 168, 225, 0.06);
  border-color: rgba(0, 168, 225, 0.15);
  color: #00a8e1;
}
.card-tv.on .app-primevideo:hover {
  background: #00a8e1;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 168, 225, 0.3);
}

.app-disney {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
.card-tv.on .app-disney:hover {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

.app-appletv {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.card-tv.on .app-appletv:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.app-youtube {
  background: rgba(255, 0, 0, 0.06);
  border-color: rgba(255, 0, 0, 0.15);
  color: #ff0000;
}
.card-tv.on .app-youtube:hover {
  background: #ff0000;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.app-hbomax {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}
.card-tv.on .app-hbomax:hover {
  background: #a855f7;
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.app-crunchyroll {
  background: rgba(244, 117, 33, 0.06);
  border-color: rgba(244, 117, 33, 0.15);
  color: #f47521;
}
.card-tv.on .app-crunchyroll:hover {
  background: #f47521;
  color: #fff;
  box-shadow: 0 0 10px rgba(244, 117, 33, 0.3);
}

/* ==================================================== */
/* TABLET RESPONSIVENESS (iPad Mini 2 Landscape/Tablet)  */
/* ==================================================== */
@media (max-width: 1024px) {
  .dashboard-grid {
    gap: 16px;
    height: auto;
  }
  
  .grid-card {
    padding: 16px;
  }
  
  .tv-apps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==================================================== */
/* RESPONSIVE BREAKPOINTS (Optimized for Mobile/Phones) */
/* ==================================================== */
@media (max-width: 768px) {
  body {
    overflow-y: auto;
    height: auto;
  }
  
  .dashboard-container {
    height: auto;
    padding: 16px;
  }

  .dashboard-header {
    flex-direction: column;
    height: auto;
    gap: 16px;
    align-items: stretch;
    text-align: center;
  }

  .header-right {
    justify-content: center;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 16px;
    height: auto;
  }

  .double-height {
    grid-row: auto;
  }

  #card-ac, #card-tv, #card-pc, #card-lights {
    grid-column: auto;
  }
}

/* ==================================================== */
/* APPLE HOME STYLE UI CONTROLS */
/* ==================================================== */

/* Cards Glassmorphism styling overrides */
.grid-card {
  background: rgba(22, 28, 45, 0.35) !important;
  backdrop-filter: blur(25px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 36px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35) !important;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.grid-card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45) !important;
}

/* Corner Power Button (Apple Style) */
.apple-corner-power {
  position: relative;
  cursor: pointer;
}

.power-btn-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.apple-corner-power input:checked + .power-btn-circle,
.grid-card.on .power-btn-circle {
  background: #34c759;
  color: #fff;
  box-shadow: 0 0 12px rgba(52, 199, 89, 0.4);
  border-color: transparent;
}

/* Large Center Power Circle */
.apple-power-circle {
  display: flex;
  margin: 15px auto 25px auto;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  cursor: pointer;
  justify-content: center;
  align-items: center;
}

.power-circle-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
}

.apple-power-circle input:checked + .power-circle-inner,
.grid-card.on .apple-power-circle .power-circle-inner {
  background: rgba(52, 199, 89, 0.15);
  border-color: #34c759;
  color: #34c759;
  box-shadow: 0 0 24px rgba(52, 199, 89, 0.3), inset 0 2px 4px rgba(52, 199, 89, 0.1);
}

/* Power Circle for PC (Special WOL icon placement) */
.small-pc {
  margin: 10px auto 15px auto !important;
  width: 72px !important;
  height: 72px !important;
}

/* Apple Temperature Dial */
.apple-temp-dial {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin: 5px auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.dial-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.room-temp-display {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

.dial-temp-value {
  font-size: 46px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -1px;
}

.dial-temp-value::after {
  content: "°";
  font-weight: 300;
  opacity: 0.8;
}

.dial-status-label {
  font-size: 11px;
  color: #34c759;
  font-weight: 500;
}

/* Apple Wide Pill Button (Windfree / Mute) */
.apple-wide-pill {
  width: 100%;
  height: 48px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.apple-wide-pill:hover {
  background: rgba(255, 255, 255, 0.12);
}

.apple-wide-pill.active {
  background: rgba(10, 132, 255, 0.15);
  border-color: #0a84ff;
  color: #0a84ff;
  box-shadow: 0 0 12px rgba(10, 132, 255, 0.2);
}

/* Apple Slider Row (Vol / Temp Adjuster) */
.apple-slider-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

.circle-adjust-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.circle-adjust-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Vertical slider */
.apple-vertical-slider {
  width: 72px;
  height: 160px;
  border-radius: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.apple-vertical-slider.dragging {
  cursor: ns-resize;
}

.slider-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  background: rgba(10, 132, 255, 0.22);
  transition: height 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.apple-vertical-slider.dragging .slider-fill {
  transition: none !important;
}

.slider-value {
  position: relative;
  z-index: 2;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}

.slider-value::after {
  content: "°C";
  font-size: 11px;
  font-weight: 400;
  margin-left: 1px;
}

/* Modes row */
.apple-modes-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: auto;
  padding-top: 5px;
}

.circle-mode-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.circle-mode-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.circle-mode-btn.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: #00f2fe;
  color: #00f2fe;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

/* TV Pill Rows */
.apple-pill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 48px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 2px;
  margin-bottom: 12px;
}

.pill-btn {
  width: 44px;
  height: 42px;
  border-radius: 21px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pill-value {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.pill-value::after {
  content: "%";
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
}

/* TV Mute & Input selector */
.mute-and-input-row {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  gap: 12px;
}

.mute-and-input-row .tv-btn {
  flex: 1;
  height: 46px;
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mute-and-input-row .tv-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mute-and-input-row .tv-btn.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.mute-and-input-row .input-select-container {
  flex: 1.3;
}

.mute-and-input-row .tv-input-select {
  width: 100%;
  height: 46px;
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #fff;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  text-align-last: center;
}

/* TV Apps shortcuts apple style grid */
.tv-apps-container {
  margin-top: 15px;
  width: 100%;
}

.tv-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 12px !important;
}

@media (max-width: 1024px) {
  .tv-apps-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

.tv-apps-grid .app-btn {
  aspect-ratio: 1 / 1;
  width: auto;
  height: auto;
  border-radius: 16px !important; /* iOS superellipse radius */
  border: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tv-apps-grid .app-btn:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* Branded Backgrounds & Fonts for Apps */
.app-netflix {
  background: #000 !important;
}
.font-netflix {
  color: #db202c;
  font-size: 26px;
  font-weight: 900;
  font-family: 'Arial Black', sans-serif;
}

.app-crunchyroll {
  background: #f47521 !important;
}
.font-crunchyroll {
  color: #fff;
}

.app-primevideo {
  background: #151a21 !important;
  border: 1px solid #1a92f4 !important;
}
.font-primevideo {
  color: #1a92f4;
  font-size: 11px;
  font-style: italic;
  font-family: 'Trebuchet MS', sans-serif;
  text-transform: lowercase;
}

.app-youtube {
  background: #ff0000 !important;
}
.font-youtube {
  color: #fff;
}

.app-disney {
  background: linear-gradient(135deg, #020024 0%, #090979 50%, #00d4ff 100%) !important;
}
.font-disney {
  color: #fff;
  font-size: 9px;
  letter-spacing: -0.5px;
}

.app-appletv {
  background: #1c1c1e !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
}
.font-appletv {
  color: #fff;
  font-size: 12px;
}

.app-hbomax {
  background: linear-gradient(135deg, #002be7 0%, #9800e0 100%) !important;
}
.font-hbomax {
  color: #fff;
  font-size: 12px;
  font-family: 'Times New Roman', serif;
  text-transform: lowercase;
}

/* Apple Thick Slider (Lights brightness slider) */
.apple-slider-wrapper {
  width: 100%;
  padding: 5px 0;
}

.apple-range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 38px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  outline: none;
  overflow: hidden;
  cursor: pointer;
}

.apple-range-slider::-webkit-slider-runnable-track {
  height: 38px;
  background: transparent;
}

.apple-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0;
  height: 38px;
  background: transparent;
  box-shadow: -100vw 0 0 100vw rgba(234, 179, 8, 0.25);
  transition: all 0.1s ease;
}

.lights-power-toggle-center input:checked + .power-circle-inner,
.grid-card.on .apple-range-slider::-webkit-slider-thumb {
  box-shadow: -100vw 0 0 100vw rgba(234, 179, 8, 0.35) !important;
}

/* Draggable fill glows based on active card state */
.brightness-fill {
  background: rgba(234, 179, 8, 0.22) !important;
}

.grid-card.on .brightness-fill {
  background: rgba(234, 179, 8, 0.45) !important;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.2);
}

.grid-card.on .slider-fill {
  background: rgba(10, 132, 255, 0.35) !important;
  box-shadow: 0 0 15px rgba(10, 132, 255, 0.2);
}

/* Voice HUD Styles */
.voice-hud {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 24px;
  border-radius: 30px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  pointer-events: none;
  width: auto;
  min-width: 320px;
  max-width: 90%;
}

.voice-hud.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.voice-hud-content {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

/* Pulsating microphone design */
.voice-pulse-container {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.voice-mic-icon {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 2;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.voice-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

/* State-specific colors & animations */
.voice-hud.waiting .voice-mic-icon {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}
.voice-hud.waiting .voice-pulse-ring {
  border: 1px solid rgba(59, 130, 246, 0.4);
  animation: voice-pulse 2.5s infinite linear;
}
.voice-hud.waiting .ring-2 {
  animation-delay: 1.25s;
}

.voice-hud.listening .voice-mic-icon {
  background: rgba(168, 85, 247, 0.35);
  color: #c084fc;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.7);
  transform: scale(1.08);
}
.voice-hud.listening .voice-pulse-ring {
  border: 2px solid rgba(168, 85, 247, 0.6);
  animation: voice-pulse 1.2s infinite ease-out;
}
.voice-hud.listening .ring-2 {
  animation-delay: 0.6s;
}

.voice-hud.processing .voice-mic-icon {
  background: rgba(234, 179, 8, 0.35);
  color: #facc15;
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.7);
}
.voice-hud.processing .voice-pulse-ring {
  border: 2px dashed rgba(234, 179, 8, 0.6);
  animation: voice-spin 2s infinite linear;
}

.voice-hud.success .voice-mic-icon {
  background: rgba(16, 185, 129, 0.35);
  color: #34d399;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.7);
  transform: scale(1.05);
}

@keyframes voice-pulse {
  0% {
    width: 36px;
    height: 36px;
    opacity: 0.8;
  }
  100% {
    width: 72px;
    height: 72px;
    opacity: 0;
  }
}

@keyframes voice-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); width: 44px; height: 44px; opacity: 0.8; }
  100% { transform: translate(-50%, -50%) rotate(360deg); width: 44px; height: 44px; opacity: 0.8; }
}

.voice-hud-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.voice-status-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.voice-transcript {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

/* Microphone button in header styling */
#btn-voice-control.voice-active {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.5);
  color: #c084fc;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
  animation: button-pulse-active 2s infinite alternate;
}

@keyframes button-pulse-active {
  0% { box-shadow: 0 0 5px rgba(168, 85, 247, 0.2); }
  100% { box-shadow: 0 0 15px rgba(168, 85, 247, 0.6); }
}

/* Flash animation when wake word is detected */
@keyframes wake-flash {
  0% {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.12);
  }
  50% {
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.8), inset 0 1px 1px rgba(168, 85, 247, 0.4);
    border-color: rgba(168, 85, 247, 0.8);
    transform: translateX(-50%) scale(1.05);
  }
  100% {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.12);
  }
}

.voice-hud.wake-active {
  animation: wake-flash 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}




