/* Tablet Landscape Layout - Starting Fresh */

html, body {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #333333;
    overflow: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    scrollbar-gutter: stable;
}

/* IFRAME MODE - Optimize for embedding in v0 app (index.html) */
/* Add .iframe-mode class to body via JavaScript when in iframe */
body.iframe-mode {
    padding: 0;
    background: transparent;
    min-height: auto;
    height: 100%;
    overflow: auto;
}

body.iframe-mode > header.global-nav {
    margin: 0;
    width: 100%;
    max-width: none;
    align-self: auto;
}

body.iframe-mode > main.main-content {
    margin: 0;
    width: 100%;
    max-width: none;
    flex: 1;
    overflow: auto;
    scrollbar-width: none;
}

body.iframe-mode > main.main-content::-webkit-scrollbar {
    display: none;
}

body.iframe-mode {
    scrollbar-width: none;
}

body.iframe-mode::-webkit-scrollbar {
    display: none;
}

/* For layouts with .tablet-frame (tablet-index.html), center it */
body > .tablet-frame {
    margin: auto;
}

/* For layouts without .tablet-frame (index.html), make header and main stack vertically */
/* Only apply max-width on larger screens (desktop/tablet) */
@media (min-width: 1024px) {
    body > header.global-nav {
        margin: 0;
        width: 100%;
        max-width: 1120px;
        align-self: center;
    }

    body > main.main-content {
        margin: 0 auto;
        width: 100%;
        max-width: 1120px;
    }
}

/* Mobile and Tablet - full width */
@media (max-width: 1023px) {
    body > header.global-nav {
        margin: 0;
        width: 100%;
        max-width: 100%;
        align-self: center;
    }

    body > main.main-content {
        margin: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* Hide scrollbar but keep scrolling functionality */
body::-webkit-scrollbar {
    display: none;
}

body {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;      /* Firefox */
}

/* Loading Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

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

.splash-logo {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: splash-fade-in 0.8s ease-in-out;
}

@keyframes splash-fade-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Light theme splash screen */
.splash-screen.light-theme {
    background: #ffffff;
}

/* Tablet Frame - Simple Grey Bezel */
.tablet-frame {
    width: 90vw;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    margin: auto;
    background: #2a2a2a;
    border: 20px solid #3a3a3a;
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Tablet frame is not scrollable - all scrolling happens inside the iframe */

/* Scroll Down Hint Overlay */
.scroll-hint {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.scroll-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.scroll-hint-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.scroll-text {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.7;
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    height: 50px;
}

.scroll-chevron {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    font-size: 50px;
    color: #fbbf24 !important;
    opacity: 0.8;
    animation: scroll-bounce 2s infinite;
    stroke-width: 1.5 !important;
    flex-shrink: 0;
    margin: -12px 0;
}

.scroll-chevron:nth-child(2) {
    animation-delay: 0.15s;
}

.scroll-chevron:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes scroll-bounce {
    0% {
        opacity: 0.3;
        transform: translateY(-10px);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.3;
        transform: translateY(5px);
    }
}

/* Global Navigation Header */
.global-nav {
    width: 100%;
    height: 100px;
    background: #000000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid #222222;
}

/* Navigation Left Side */
.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.nav-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: contain;
    display: block;
    background-color: #ffffff;
    padding: 4px;
    box-sizing: border-box;
}

.device-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.device-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.device-name {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
}

.device-dropdown-btn {
    background: none;
    border: none;
    color: #820000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    transition: transform 0.2s ease;
}

.device-dropdown-btn:hover {
    opacity: 0.7;
}

.device-dropdown-btn.open {
    transform: rotate(180deg);
}

.device-dropdown-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.device-type {
    font-size: 18px;
    color: #820000;
    font-weight: 500;
    line-height: 1;
}

/* Device Dropdown Menu */
.device-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50px;
    margin-top: 8px;
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 1000;
    min-width: 180px;
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: #2a2a2a;
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.dropdown-item:last-child {
    border-top: 1px solid #333333;
    color: #820000;
}

.dropdown-item:last-child:hover {
    background: rgba(130, 0, 0, 0.1);
}

/* Light mode dropdown styles */
html[style*="white"] .device-dropdown-menu,
html[style*="light"] .device-dropdown-menu {
    background: #ffffff;
    border-color: #cccccc;
}

html[style*="white"] .dropdown-item,
html[style*="light"] .dropdown-item {
    color: #000000;
}

html[style*="white"] .dropdown-item:hover,
html[style*="light"] .dropdown-item:hover {
    background: #f5f5f5;
}

/* Navigation Right Side */
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #820000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.nav-icon-btn:hover {
    background: rgba(130, 0, 0, 0.1);
}

.bluetooth-btn {
    color: #3b82f6;
}

.bluetooth-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* Active green state for voice button */
.voice-btn.active {
    color: #10b981;
}

.voice-btn.active:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Main Content Area */
.main-content {
    width: 100%;
    flex: 1;
    background: #000000;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar for main-content but keep scrolling functionality */
.main-content::-webkit-scrollbar {
    display: none;
}

.main-content {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;      /* Firefox */
}

/* Control Center Header Section */
.control-center-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #222222;
}

.control-center-title {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.header-buttons {
    display: flex;
    gap: 12px;
}

.edit-layout-btn,
.cancel-layout-btn,
.save-layout-btn {
    padding: 10px 24px;
    border: 1px solid #000000;
    border-radius: 8px;
    background: transparent;
    color: #820000;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-layout-btn:hover {
    background: #820000;
    color: #ffffff;
    border-color: #820000;
}

.cancel-layout-btn:hover {
    background: #666666;
    color: #ffffff;
    border-color: #666666;
}

.save-layout-btn {
    background: #10b981;
    border-color: #10b981;
    color: #000000;
}

.save-layout-btn:hover {
    background: #059669;
    border-color: #059669;
}

/* Edit Layout Drawer */
.edit-layout-drawer {
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.drawer-content {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.drawer-message {
    font-size: 14px;
    color: #cccccc;
    margin: 0;
    flex: 1;
}

.add-widget-btn {
    padding: 8px 16px;
    background: #10b981;
    border: none;
    border-radius: 6px;
    color: #000000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-widget-btn:hover {
    background: #059669;
}

/* Voice Commands Section */
.voice-commands-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 24px;
    cursor: pointer;
    border-bottom: 1px solid #222222;
}

.voice-commands-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.voice-commands-icon {
    color: #820000;
    width: 20px;
    height: 20px;
}

.voice-commands-text {
    color: #ffffff;
    font-size: 16px;
    font-weight: 400;
}

.voice-commands-chevron {
    color: #ffffff;
    width: 20px;
    height: 20px;
}

/* Widget Grid */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(4, 255px);
    gap: 16px;
    padding: 0;
}

/* Turn Signals Widget - spans 2 columns */
.turn-signals-widget {
    grid-column: span 2;
}

/* Widget Base Styles */
.widget {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 240px;
    border: 2px solid #000000;
    transition: all 0.2s ease;
}

.widget.edit-mode {
    background: rgba(26, 26, 26, 0.4);
    border-color: rgba(58, 58, 58, 0.4);
}

.widget.edit-mode .widget-title {
    color: rgba(255, 255, 255, 0.5);
}

.widget.edit-mode .relay-badge {
    color: rgba(153, 153, 153, 0.5);
}

/* Dragging clone visual */
.dragging-clone {
    border: 2px solid #000000 !important;
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.3) !important;
    border-radius: 12px !important;
}

.widget-title {
    font-size: 20px;
    font-weight: 600;
    color: #000000;
    text-align: center;
    margin: 0 0 16px 0;
}

.relay-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 11px;
    color: #777777;
    background: transparent;
    padding: 2px 6px;
    border-radius: 4px;
    border: none;
}

/* Widget Action Icons */
.widget-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 4px;
    z-index: 10;
}

.widget.edit-mode .widget-actions {
    display: flex;
}

.widget-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: #2a2a2a;
    color: #cccccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.widget-action-btn:hover {
    background: #3a3a3a;
    color: #ffffff;
}

.widget-action-btn.drag-handle {
    cursor: grab;
}

.widget-action-btn.drag-handle:active {
    cursor: grabbing;
}

.widget-action-btn.edit-name-btn {
    background: #d4af37;
    color: #000000;
}

.widget-action-btn.edit-name-btn:hover {
    background: #e5c158;
    color: #000000;
}

.widget-action-btn i {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* New Widget Action Buttons (Configure/Remove) */
.widget-drag-handle-top-left {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #999999;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.widget.edit-mode .widget-drag-handle-top-left {
    opacity: 1;
}

.widget-drag-handle-top-left:hover {
    color: #cccccc;
}

.widget-drag-handle-top-left:active {
    cursor: grabbing;
}

.widget-drag-handle-top-left i {
    width: 20px;
    height: 20px;
}

.widget-action-buttons {
    display: none;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    opacity: 1;
}

.widget.edit-mode .widget-action-buttons {
    display: flex;
    opacity: 1;
}

.widget-config-btn,
.widget-remove-btn {
    width: 120px;
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-config-btn {
    background: #0ea5e9;
    color: #ffffff;
}

.widget-config-btn:hover {
    background: #0284c7;
}

.widget-remove-btn {
    background: #ef4444;
    color: #ffffff;
}

.widget-remove-btn:hover {
    background: #dc2626;
}

/* Drag and Drop States */
.widget.dragging {
    opacity: 0.5;
    border: 2px dashed #d4af37;
}

.widget.drag-over {
    border: 2px dashed #10b981;
    background: #232323;
}

/* Turn Signals Widget */

.turn-signals-buttons {
    display: flex;
    gap: 12px;
    flex: 1;
    align-items: stretch;
}

.turn-signal-btn {
    flex: 1;
    background: #000000;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #820000;
    transition: all 0.2s ease;
}

.turn-signal-btn svg {
    width: 60px !important;
    height: 60px !important;
    stroke-width: 2.5 !important;
}

.turn-signal-btn:hover {
    background: #1a1a1a;
}

/* Toggle Widget */
.toggle-widget {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 30px;
}

.toggle-widget .widget-title {
    margin: 0 0 20px 0;
    order: 2;
}

.toggle-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    order: 3;
}

.toggle-btn {
    width: 95px;
    height: 95px;
    border-radius: 50%;
    background: #000000;
    border: 3px solid #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #820000;
    transition: all 0.2s ease;
    position: relative;
}

.toggle-btn svg {
    width: 44px !important;
    height: 44px !important;
    stroke-width: 2 !important;
}

.toggle-btn:hover {
    border-color: #888888;
}

.toggle-btn.active {
    background: #5eead4!important;
    border-color: #666666;
    box-shadow: none;
}

/* Green active state for lightbulb buttons and widgets */
.widget.active-green {
    background: #a7f3d0!important;
    border-color: #6ee7b7!important;
    transition: all 0.2s ease;
}

.widget.active-green .widget-title {
    color: #374151;
}

.widget.active-green .relay-badge {
    color: #6b7280;
}

.widget:not(.active-green) {
    background: #ffffff!important;
    border-color: #000000!important;
    transition: all 0.2s ease;
}

.toggle-btn.active-green {
    background: #5eead4!important;
    box-shadow: none;
}

.toggle-btn.active-green svg {
    color: #ffffff;
}

.glow-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: none;
}
/* Weather Widget */
.weather-widget {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.weather-location {
    font-size: 20px;
    font-weight: 600;
    color: #000000;
    margin: 0 0 20px 0;
}

.weather-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.weather-icon {
    width: 60px;
    height: 60px;
    color: #ef4444;
    stroke-width: 2;
}

.weather-temp {
    font-size: 48px;
    font-weight: 700;
    color: #000000;
    line-height: 1;
}

.weather-condition {
    font-size: 18px;
    font-weight: 400;
    color: #333333;
    margin: 0;
}

/* Single Toggle Widget (Light Bar) */
.single-toggle-widget {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.single-toggle-widget .widget-title {
    margin: 0 0 20px 0;
}

.single-toggle-button {
    display: flex;
    justify-content: center;
    align-items: center;
}

.single-toggle-button .toggle-btn {
    width: 140px;
    height: 140px;
}

.single-toggle-button .toggle-btn svg {
    width: 56px !important;
    height: 56px !important;
}

/* Pulse animation for shuffle button */
@keyframes pulse-yellow {
    0%, 100% {
        background: #d97706;
        border-color: #b45309;
        transform: scale(1);
    }
    50% {
        background: #f59e0b;
        border-color: #d97706;
        transform: scale(1.05);
    }
}

.toggle-btn.pulse-yellow {
    animation: pulse-yellow 1s ease-in-out infinite;
}

.toggle-btn.pulse-yellow svg {
    color: #ffffff;
}

/* Pulse animation for hazard buttons */
@keyframes pulse-red {
    0%, 100% {
        background: #dc2626;
        border-color: #991b1b;
        transform: scale(1);
    }
    50% {
        background: #ef4444;
        border-color: #dc2626;
        transform: scale(1.05);
    }
}

.turn-signal-btn.pulse-red {
    animation: pulse-red 1s ease-in-out infinite;
}

.turn-signal-btn.pulse-red svg {
    color: #ffffff;
}

/* Turn signal countdown display */
.turn-signal-countdown {
    position: absolute;
    bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 24px;
    text-align: center;
}

/* Turn signal button with animation */
.turn-signal-btn.pulse-yellow {
    animation: pulse-yellow 1s ease-in-out infinite;
}

.turn-signal-btn.pulse-yellow svg {
    color: #ffffff;
}

/* Timer Widget */
.timer-widget {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    overflow: hidden;
}

.timer-widget .star-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #820000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-widget .star-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.timer-widget .widget-title {
    margin: 0 0 10px 0;
}

.timer-icon-wrapper {
    margin-bottom: 10px;
}

.timer-clock-icon {
    width: 80px;
    height: 80px;
    color: #820000;
    stroke-width: 2;
}

.timer-text {
    font-size: 18px;
    font-weight: 400;
    color: #777777;
    margin: 0;
    text-align: center;
}

/* Green pulse animation for timer */
@keyframes pulse-green {
    0%, 100% {
        background: #374151;
        border-color: #4b5563;
        transform: scale(1);
    }
    50% {
        background: #5eead4;
        border-color: #2dd4bf;
        transform: scale(1.02);
    }
}

/* Timer widget active state */
.timer-widget.active-timer {
    animation: pulse-green 1.5s ease-in-out infinite;
}

.timer-widget.active-timer .widget-title {
    color: #000000;
}

.timer-widget.active-timer .timer-text {
    font-size: 32px;
    font-weight: 700;
    color: #22c55e;
    font-family: 'Courier New', monospace;
}

.timer-widget.active-timer .timer-clock-icon {
    display: none;
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: none;
    display: none;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    display: block;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 1;
    pointer-events: auto;
}

/* Modal Container */
.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 85%;
    z-index: 1000;
    display: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-container.active {
    display: block;
}

/* Modal Title */
.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin: 0 0 16px 0;
}

/* Modal Body */
.modal-body {
    margin-bottom: 16px;
}

.modal-subtitle {
    font-size: 18px;
    font-weight: 400;
    color: #cccccc;
    text-align: center;
    margin: 0 0 16px 0;
}

.modal-time {
    font-size: 32px;
    font-weight: 700;
    color: #5eead4;
    text-align: center;
    font-family: 'Courier New', monospace;
    margin: 0 0 16px 0;
}

.modal-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
    margin-bottom: 12px;
}

.modal-textarea {
    width: 100%;
    height: 80px;
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid #444444;
    border-radius: 8px;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.modal-textarea::placeholder {
    color: #808080;
}

.modal-textarea:focus {
    outline: none;
    border-color: #5eead4;
    box-shadow: 0 0 8px rgba(94, 234, 212, 0.2);
}

/* Modal Input for Name Editing */
.modal-input {
    width: 100%;
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid #444444;
    border-radius: 8px;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    box-sizing: border-box;
}

.modal-input::placeholder {
    color: #808080;
}

.modal-input:focus {
    outline: none;
    border-color: #5eead4;
    box-shadow: 0 0 8px rgba(94, 234, 212, 0.2);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-cancel {
    background: #374151;
    color: #ffffff;
    flex: 0 1 120px;
}

.modal-btn-cancel:hover {
    background: #4b5563;
}

.modal-btn-primary {
    background: #5eead4;
    color: #1a1a1a;
    flex: 1;
    min-width: 200px;
}

.modal-btn-primary:hover {
    background: #2dd4bf;
}

/* Battery Voltage Widget */
.battery-widget {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 24px;
}

.battery-widget.edit-mode {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.6);
}

.battery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 20px;
    margin-left: 0;
}

.battery-header .widget-title {
    margin: 0;
    flex: 1;
    text-align: left;
}

.battery-icon {
    width: 32px;
    height: 32px;
    stroke-width: 2;
    color: #f59e0b;
    flex-shrink: 0;
}

.battery-voltage {
    font-size: 28px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 24px 0;
    font-family: 'Courier New', monospace;
    line-height: 1;
    padding-left: 0;
}

/* Battery health states */
.battery-widget.battery-healthy {
    background: #ffffff;
}

.battery-widget.battery-healthy.edit-mode {
    background: rgba(255, 255, 255, 0.6);
}

.battery-widget.battery-healthy .battery-icon {
    color: #10b981;
}

.battery-widget.battery-healthy .battery-voltage {
    color: #10b981;
}

.battery-widget.battery-degrading {
    background: #ffffff;
}

.battery-widget.battery-degrading.edit-mode {
    background: rgba(255, 255, 255, 0.6);
}

.battery-widget.battery-degrading .battery-icon {
    color: #f59e0b;
}

.battery-widget.battery-degrading .battery-voltage {
    color: #f59e0b;
}

.battery-widget.battery-critical {
    background: #ffffff;
}

.battery-widget.battery-critical.edit-mode {
    background: rgba(255, 255, 255, 0.6);
}

.battery-widget.battery-critical .battery-icon {
    color: #ef4444;
}

.battery-widget.battery-critical .battery-voltage {
    color: #ef4444;
}

/* Battery bar container */
.battery-bar-container {
    width: 100%;
    height: 56px;
    background: #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #444444;
}

.battery-bar {
    height: 100%;
    background: #10b981;
    border-radius: 16px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Battery icon display states */
#battery-icon-container .battery-icon {
    display: none;
}

#battery-icon-container.battery-full .battery-icon-full,
#battery-icon-container.battery-half .battery-icon-half,
#battery-icon-container.battery-empty .battery-icon-empty {
    display: block;
}

/* Default to full if no class */
#battery-icon-container:not(.battery-half):not(.battery-empty) .battery-icon-full {
    display: block;
}

/* Delete Menu Dropdown */
.delete-menu {
    position: fixed;
    background: #2a2a2a;
    border: 1px solid #444444;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 180px;
}

.delete-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    width: 100%;
    background: transparent;
    border: none;
    color: #ff4444;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease;
}

.delete-menu-item:hover {
    background: #3a3a3a;
}

.delete-menu-item i {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Edit Widget Name Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #444444;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 16px 0;
}

.widget-name-input {
    width: 100%;
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid #444444;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    margin: 0 0 20px 0;
    box-sizing: border-box;
}

.widget-name-input::placeholder {
    color: #888888;
}

.widget-name-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.modal-cancel {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444444;
}

.modal-cancel:hover {
    background: #3a3a3a;
}

.modal-save {
    background: #0ea5e9;
    color: #ffffff;
}

.modal-save:hover {
    background: #0284c7;
}

/* Demo Feature Popup */
.demo-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.demo-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a1a 0%, #2a1a1a 100%);
    border: 1px solid #333333;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(130, 0, 0, 0.2);
    z-index: 2001;
    max-width: 420px;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.demo-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #333333;
}

.demo-popup-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fbbf24;
    margin: 0;
}

.demo-popup-close {
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: color 0.2s ease;
}

.demo-popup-close:hover {
    color: #ffffff;
}

.demo-popup-close svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.demo-popup-content {
    padding: 24px;
    text-align: center;
}

.demo-popup-content p {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.5;
}

.demo-popup-content p:first-child {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 8px;
}

.demo-popup-subtitle {
    color: #cccccc;
    font-size: 14px;
    margin-top: 12px !important;
    font-weight: 400;
}

.demo-popup-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: center;
}

.demo-popup-btn {
    background: #fbbf24;
    color: #000000;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.demo-popup-btn:hover {
    background: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(251, 191, 36, 0.3);
}

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

/* Settings Page */
.settings-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0 auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid #222222;
    margin-bottom: 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.settings-back-btn {
    background: none;
    border: none;
    color: #0ea5e9;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.settings-back-btn:hover {
    opacity: 0.7;
}

.settings-back-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.settings-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 12px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Hide scrollbar for settings content but keep scrolling functionality */
.settings-content::-webkit-scrollbar {
    display: none;
}

.settings-content {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;      /* Firefox */
}

.settings-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #222222;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #820000;
    margin: 0 0 8px 0;
}

.settings-section-subtitle {
    font-size: 14px;
    color: #cccccc;
    margin: 0 0 16px 0;
}

.settings-form-group {
    margin-bottom: 20px;
}

.settings-label {
    display: block;
    font-size: 14px;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-option-text {
    font-size: 14px;
    color: #999999;
    margin: 0 0 12px 0;
}

.settings-input {
    width: 100%;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.settings-input:focus {
    outline: none;
    border-color: #0ea5e9;
}

.settings-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.settings-btn {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.settings-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.settings-btn-primary {
    background: #0ea5e9;
    color: #ffffff;
}

.settings-btn-primary:hover {
    background: #0284c7;
}

.settings-btn-secondary {
    background: #333333;
    color: #ffffff;
}

.settings-btn-secondary:hover {
    background: #444444;
}

.settings-btn-danger {
    background: #820000;
    color: #ffffff;
    border: 1px solid #610000;
}

.settings-btn-danger:hover {
    background: #a30000;
}

.settings-button-group {
    display: flex;
    gap: 12px;
}

.settings-option-btn {
    flex: 1;
    padding: 10px 16px;
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-option-btn:hover {
    border-color: #0ea5e9;
}

.settings-option-btn-active {
    background: #820000;
    border-color: #820000;
    color: #ffffff;
}

.settings-toggle-btn {
    width: 56px;
    height: 32px;
    background: #333333;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: background 0.2s ease;
    position: relative;
}

.settings-toggle-btn.active {
    background: #ef4444;
}

.toggle-switch {
    width: 28px;
    height: 28px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    position: absolute;
    left: 2px;
}

.settings-toggle-btn.active .toggle-switch {
    transform: translateX(24px);
}

.firmware-info {
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 16px;
}

.firmware-label {
    font-size: 12px;
    color: #999999;
    text-transform: uppercase;
    margin: 0 0 4px 0;
}

.firmware-version {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 12px 0;
}

.warning-box {
    background: rgba(130, 0, 0, 0.1);
    border: 1px solid #820000;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.warning-box svg {
    width: 20px;
    height: 20px;
    color: #ef4444;
    stroke-width: 2;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-box p {
    margin: 0;
    color: #ffffff;
    font-size: 13px;
    line-height: 1.4;
}

/* Info Popup (Firmware & Sign Out) */
.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.info-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a1a 0%, #2a1a1a 100%);
    border: 1px solid #333333;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(130, 0, 0, 0.2);
    z-index: 2001;
    max-width: 420px;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.info-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #333333;
}

.info-popup-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #0ea5e9;
    margin: 0;
}

.info-popup-close {
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: color 0.2s ease;
}

.info-popup-close:hover {
    color: #ffffff;
}

.info-popup-close svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.info-popup-content {
    padding: 24px;
    text-align: left;
}

.info-popup-content p {
    margin: 0 0 12px 0;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.5;
}

.info-popup-content p:last-child {
    margin-bottom: 0;
}

.warning-text {
    color: #ef4444;
    font-weight: 600;
    margin-top: 12px !important;
}

.info-popup-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.info-popup-btn {
    padding: 12px 32px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-popup-btn {
    background: #0ea5e9;
    color: #ffffff;
}

.info-popup-btn:hover {
    background: #0284c7;
}

.info-popup-btn-cancel {
    background: #333333;
    color: #ffffff;
}

.info-popup-btn-cancel:hover {
    background: #444444;
}

.info-popup-btn-danger {
    background: #820000;
    color: #ffffff;
    border: 1px solid #610000;
}

.info-popup-btn-danger:hover {
    background: #a30000;
}

/* Control Panel for Voice Command Testing */
.control-panel {
    margin-top: 24px;
    padding: 20px;
    background: #1a1a1a;
    border: 2px solid #444444;
    border-radius: 12px;
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #0ea5e9;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: #000000;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    color: #0ea5e9;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.control-btn:hover {
    background: #0a3d52;
    border-color: #06b6d4;
    color: #06b6d4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.control-btn:active,
.control-btn.active {
    background: #0ea5e9;
    color: #000000;
    border-color: #0ea5e9;
    transform: translateY(0);
}

/* Responsive button grid */
@media (max-width: 1024px) {
    .button-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .button-grid {
        grid-template-columns: 1fr;
    }
}

/* Voice Control Overlay */
.voice-control-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.voice-control-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.enable-voice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 28px;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    border: 3px solid #ffffff;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
}

.enable-voice-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.6);
    background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
}

.enable-voice-btn:active {
    transform: translateY(-2px);
}

.enable-voice-btn svg {
    width: 40px;
    height: 40px;
    stroke-width: 2;
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================ */
/* MOBILE & IPHONE RESPONSIVE STYLES          */
/* ============================================ */

/* Mobile and Tablet screens (up to 1023px width) */
@media (max-width: 1023px) {
    body {
        padding: 40px 0 0 0;
        background: #1a1a1a;
        max-width: 100%;
    }
    
    body > header.global-nav {
        max-width: 100%;
    }
    
    body > main.main-content {
        max-width: 100%;
    }
    
    /* Compress Global Nav */
    .global-nav {
        height: 70px;
        padding: 55px 8px 25px 8px;
        gap: 4px;
        border-bottom: 1px solid #222222;
        margin-bottom: 10px;
    }
    
    .nav-left {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .device-info {
        min-width: 0;
        flex: 1;
    }
    
    .nav-logo {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .device-name {
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }
    
    .device-type {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .device-name-wrapper {
        display: flex;
        align-items: center;
        gap: 2px;
        min-width: 0;
    }
    
    .device-dropdown-btn {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
    }
    
    .device-dropdown-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .nav-right {
        gap: 4px;
        flex-shrink: 0;
    }
    
    .nav-icon-btn {
        width: 32px;
        height: 32px;
    }
    
    .nav-icon-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    .nav-icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .nav-icon-btn i {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Compress Main Content */
    body > main.main-content {
        max-width: 100%;
        width: 100%;
        padding: 10px;
    }
    
    /* Control Center Header - More Compact */
    .control-center-header {
        padding: 12px 12px;
        gap: 8px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .control-center-title {
        font-size: 18px;
        font-weight: 600;
        margin: 0;
    }
    
    .header-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .edit-layout-btn,
    .cancel-layout-btn {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    /* Scroll Hint - Hide on mobile */
    .scroll-hint {
        display: none;
    }
    
    /* Widget Grid - 2 columns */
    .widget-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
        width: 100%;
        max-width: 100%;
    }
    
    /* Turn signals spans full width on mobile */
    .turn-signals-widget {
        grid-column: span 2;
        height: auto;
        padding: 12px;
    }
    
    /* Reduce widget size */
    .widget {
        height: 160px;
        padding: 12px;
        border-radius: 12px;
        border: 1px solid #333333;
        gap: 8px;
    }
    
    /* Single toggle widget gets more height */
    .single-toggle-widget {
        height: 160px;
    }
    
    /* Widget Titles - Smaller */
    .widget-title {
        font-size: 13px;
        font-weight: 600;
        margin: 0;
        line-height: 1.2;
    }
    
    /* Drag Handle - Hide on mobile */
    .widget-drag-handle-top-left {
        display: none;
    }
    
    /* Turn Signals - Display horizontally side by side */
    .turn-signals-buttons {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
        align-items: stretch;
    }
    
    .signal-button {
        flex: 1;
        padding: 8px 6px;
        font-size: 11px;
        border-radius: 6px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .signal-button i {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* Toggle buttons - Match Light Bar size on mobile */
    .toggle-btn {
        width: 65px !important;
        height: 65px !important;
    }
    
    .toggle-btn i,
    .toggle-btn svg {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Reduce gap between toggle buttons for more space */
    .toggle-buttons {
        gap: 8px;
    }
    
    /* Single toggle widget title - Reduce margin on mobile */
    .single-toggle-widget .widget-title {
        margin: 0 0 5px 0;
    }
    
    /* Single toggle widget button - Smaller to prevent overlap */
    .single-toggle-button .toggle-btn {
        width: 65px !important;
        height: 65px !important;
    }
    
    .single-toggle-button .toggle-btn i,
    .single-toggle-button .toggle-btn svg {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Button Grid */
    .button-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Weather Widget */
    .weather-widget {
        grid-column: span 1;
    }
    
    .weather-location {
        font-size: 12px;
        margin: 0 0 8px 0;
    }
    
    .weather-content {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .weather-icon {
        width: 40px;
        height: 40px;
    }
    
    .weather-temp {
        font-size: 28px;
    }
    
    .weather-condition {
        font-size: 12px;
    }
    
    /* Timer Widget */
    .timer-widget {
        grid-column: span 1;
        height: 160px;
    }
    
    .timer-widget .widget-title {
        margin: 10px 0 0 0;
    }
    
    .timer-icon-wrapper {
        margin-bottom: 5px;
    }
    
    .timer-widget .star-btn {
        width: 24px;
        height: 24px;
        top: 6px;
        right: 6px;
    }
    
    .timer-widget .star-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .timer-clock-icon {
        width: 70px;
        height: 70px;
    }
    
    .timer-text {
        font-size: 13px;
    }
    
    /* Battery Widget */
    .battery-widget {
        grid-column: span 1;
        height: 180px;
        padding: 12px !important;
    }
    
    .battery-header {
        margin-bottom: 8px;
    }
    
    .battery-header .widget-title {
        font-size: 14px;
        margin: 0;
    }
    
    .battery-icon {
        width: 40px;
        height: 40px;
    }
    
    .battery-voltage {
        font-size: 20px;
        margin: 4px 0 8px 0 !important;
    }
    
    .battery-bar-container {
        height: 28px;
        border-radius: 8px;
    }
    
    .battery-bar {
        border-radius: 8px;
    }
    
    .battery-label {
        font-size: 11px;
        margin-top: 4px;
    }
    
    /* Device Dropdown - Reposition */
    .device-dropdown-menu {
        left: 0;
        right: auto;
    }
    
    /* Edit Layout Drawer */
    .edit-layout-drawer {
        padding: 12px;
    }
    
    .drawer-message {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .add-widget-btn {
        font-size: 12px;
        padding: 10px 12px;
    }

    /* Mobile Modal Adjustments */
    .modal-container {
        max-width: 340px;
        width: 92%;
        padding: 18px;
        max-height: 85vh;
    }

    .modal-title {
        font-size: 19px;
        margin: 0 0 14px 0;
    }

    .modal-subtitle {
        font-size: 15px;
        margin: 0 0 14px 0;
    }

    .modal-time {
        font-size: 30px;
        margin: 0 0 14px 0;
    }

    .modal-body {
        margin-bottom: 14px;
    }

    .modal-label {
        font-size: 13px;
        margin-bottom: 9px;
    }

    .modal-textarea {
        height: 75px;
        font-size: 13px;
        padding: 10px;
    }

    .modal-btn {
        padding: 11px 18px;
        font-size: 13px;
    }

    /* Modal Actions - Stack Vertically on Mobile */
    .modal-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        justify-content: center;
    }

    .modal-btn-cancel,
    .modal-btn-save {
        width: 100%;
        flex: none;
    }
}

/* iPhone SE & Small Phones (max 375px) */
@media (max-width: 375px) {
    .global-nav {
        height: 60px;
        padding: 40px 8px 25px 8px;
        border-bottom: 1px solid #222222;
    }
    
    .nav-logo {
        width: 36px;
        height: 36px;
    }
    
    .device-name {
        font-size: 14px;
    }
    
    .device-type {
        font-size: 11px;
    }
    
    body > main.main-content {
        padding: 10px;
    }
    
    .widget-grid {
        gap: 8px;
        padding: 8px;
    }
    
    .widget {
        height: 140px;
        padding: 10px;
        gap: 6px;
    }
    
    .widget-title {
        font-size: 12px;
    }
    
    .toggle-btn {
        width: 50px !important;
        height: 50px !important;
    }
    
    .toggle-btn i,
    .toggle-btn svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    .signal-button {
        padding: 4px 6px;
        font-size: 10px;
        height: 28px;
    }

    /* Mobile Modal Adjustments */
    .modal-container {
        max-width: 320px;
        width: 95%;
        padding: 16px;
        max-height: 90vh;
    }

    .modal-title {
        font-size: 18px;
        margin: 0 0 12px 0;
    }

    .modal-subtitle {
        font-size: 14px;
        margin: 0 0 12px 0;
    }

    .modal-time {
        font-size: 28px;
        margin: 0 0 12px 0;
    }

    .modal-body {
        margin-bottom: 12px;
    }

    .modal-label {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .modal-textarea {
        height: 70px;
        font-size: 12px;
        padding: 8px;
    }

    .modal-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    /* Modal Actions - Stack Vertically on Mobile */
    .modal-actions {
        display: flex;
        flex-direction: column;
        gap: 9px;
        justify-content: center;
    }

    .modal-btn-cancel,
    .modal-btn-save {
        width: 100%;
        flex: none;
    }
}

/* iPad & Tablet (between 768px and 1024px) - Maintain good middle ground */
@media (min-width: 768px) and (max-width: 1024px) {
    .widget-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .turn-signals-widget {
        grid-column: span 2;
    }
    
    .widget {
        height: 200px;
    }
}

/* Landscape Phone */
@media (max-height: 500px) and (orientation: landscape) {
    .global-nav {
        height: 50px;
        padding-top: 35px;
        padding-bottom: 35px;
    }
    
    .device-name {
        font-size: 18px;
    }
    
    .control-center-header {
        padding: 8px;
        margin-top: 0;
        margin-bottom: 12px;
    }
    
    .control-center-title {
        font-size: 20px;
    }
    
    .widget-grid {
        padding: 8px;
        gap: 8px;
    }
    
    .widget {
        height: 160px;
        padding: 10px;
    }
    
    .widget-title {
        font-size: 14px;
    }

    .weather-location {
        font-size: 14px;
    }

    /* Reduce Light Bar and Interior Lights buttons to match Chase Lights size */
    .single-toggle-button .toggle-btn {
        width: 95px;
        height: 95px;
    }

    .single-toggle-button .toggle-btn svg {
        width: 44px !important;
        height: 44px !important;
    }
}
