/* CSS Variables - Figma Design */
:root {
    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-card: #FFFFFF;
    
    /* Text Colors */
    --text-primary: #000000;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    
    /* Accent Colors */
    --accent-pink: #FF6B9D;
    --accent-purple: #8B5CF6;
    --accent-orange: #F97316;
    --accent-blue: #3B82F6;
    
    /* Status Colors */
    --status-on: #FF6B9D;
    --status-off: #9CA3AF;
    
    /* Border */
    --border-color: #E5E7EB;
    --border-radius: 16px;
    --border-radius-small: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Top Header - Updated for Figma Design */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    height: auto;
    min-height: 60px;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    margin-left: 20px;
}

.logout-btn:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-pink);
}

.logout-btn:active {
    transform: scale(0.95);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.current-room {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.room-icon {
    font-size: 20px;
}

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

.mqtt-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-small);
    font-size: 12px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #f44336;
    display: inline-block;
}

.status-indicator.connected {
    background-color: #4caf50;
}

.status-indicator.connecting {
    background-color: #ff9800;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: var(--text-secondary);
    font-size: 11px;
}


.sensor-readings {
    display: flex;
    gap: 20px;
}

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

.sensor-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.sensor-value {
    font-size: 14px;
    font-weight: 500;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Navigation - Removed in new design */
.left-nav {
    display: none;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background-color: rgba(74, 158, 255, 0.2);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--accent-blue);
}

.nav-icon {
    font-size: 18px;
}

.nav-text {
    font-size: 14px;
}

/* Central Content */
.central-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-primary);
    min-height: 0;
}

.screen {
    display: none;
    width: 100%;
    min-height: 100%;
    padding: 20px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.screen.active {
    display: block;
}

/* Main screen should take full height */
.screen-main {
    min-height: 100vh;
    height: auto;
}

/* Room screen should be full screen on mobile */
.room-screen-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    z-index: 10;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.user-greeting {
    flex: 1;
}

.greeting-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.wave-emoji {
    font-size: 28px;
    display: inline-block;
}

.greeting-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.location-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.location-btn:hover {
    background-color: var(--border-color);
}

.dropdown-icon {
    font-size: 10px;
    color: var(--text-secondary);
}

.add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

.add-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.add-btn:active {
    transform: scale(0.95);
}

/* Statistics Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, var(--accent-purple) 0%, #7C3AED 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    color: white;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card-pink {
    background: linear-gradient(135deg, var(--accent-pink) 0%, #EC4899 100%);
}

.stat-card-orange {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #EA580C 100%);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-unit {
    font-size: 20px;
    font-weight: 500;
    opacity: 0.9;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 8px;
}

/* Rooms Section */
.rooms-section {
    margin-top: 32px;
}

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

.rooms-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rooms-count {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.rooms-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.see-all-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-pink);
    text-decoration: none;
    transition: opacity 0.2s;
}

.see-all-link:hover {
    opacity: 0.8;
}

.rooms-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.rooms-scroll::-webkit-scrollbar {
    height: 4px;
}

.rooms-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 2px;
}

.rooms-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.room-card {
    min-width: 200px;
    width: 200px;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    scroll-snap-align: start;
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.room-card-image {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.room-card-pin {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--accent-pink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

.room-card-content {
    padding: 16px;
}

.room-card-icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.room-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.room-card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.room-card-devices {
    font-weight: 500;
}

.room-card-active {
    color: var(--accent-pink);
    font-weight: 600;
}

.room-image {
    width: 100%;
    height: 150px;
    min-height: 150px;
    max-height: 150px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Room Screen with Background Image */
.room-screen-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: 10;
    overflow-y: auto;
}

.room-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
}

.room-screen-content {
    position: relative;
    z-index: 1;
    padding: 20px;
    padding-top: 60px;
    min-height: 100vh;
    padding-bottom: 100px; /* Space for bottom nav */
}

.room-screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.room-screen-back {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-small);
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.room-screen-back:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.room-screen-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.room-screen-edit,
.room-screen-pin {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.room-screen-edit {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
}

.room-screen-pin {
    background-color: var(--accent-pink);
    color: white;
}

.room-screen-title {
    text-align: center;
    margin-bottom: 24px;
}

.room-screen-title h2 {
    font-size: 28px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.room-devices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}

.room-devices-count {
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-devices-count-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.room-devices-count-text {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.room-turn-all {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-pink);
    text-decoration: underline;
    cursor: pointer;
    transition: opacity 0.2s;
}

.room-turn-all:hover {
    opacity: 0.8;
}

/* Device Cards Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.device-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.device-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}

.device-status.on {
    color: var(--accent-pink);
    background-color: rgba(255, 107, 157, 0.1);
}

.device-status.off {
    color: var(--text-light);
    background-color: rgba(156, 163, 175, 0.1);
}

.device-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background-color: var(--text-light);
    cursor: pointer;
    transition: background-color 0.3s;
}

.device-toggle.active {
    background-color: var(--accent-pink);
}

.device-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: white;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.device-toggle.active .device-toggle-slider {
    transform: translateX(20px);
}

.device-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.device-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.device-substatus {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 400;
}

/* Climate Device Card Styles */
.device-card-climate {
    grid-column: 1 / -1; /* Занимает всю ширину сетки */
}

.climate-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.climate-temp-dial {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.temp-dial-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #7C3AED 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.temp-dial-value {
    font-size: 36px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.temp-dial-unit {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
}

.temp-dial-controls {
    display: flex;
    gap: 16px;
    align-items: center;
}

.temp-dial-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-small);
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.temp-dial-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.temp-dial-btn:active {
    transform: scale(0.95);
}

.climate-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.climate-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px;
    border-radius: var(--border-radius-small);
    background-color: var(--bg-secondary);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.climate-mode-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.climate-mode-btn.active {
    background-color: var(--accent-pink);
    border-color: var(--accent-pink);
    color: white;
}

.climate-mode-btn.active .mode-icon,
.climate-mode-btn.active .mode-text {
    color: white;
}

.mode-icon {
    font-size: 24px;
}

.mode-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Placeholder Images using CSS Gradients */
.house-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.house-image::before {
    content: '🏠';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.kitchen-image {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    position: relative;
}

.kitchen-image::before {
    content: '🍳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.bedroom-image {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    position: relative;
}

.bedroom-image::before {
    content: '🛏️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.kids-image {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    position: relative;
}

.kids-image::before {
    content: '🧸';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.study-image {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    position: relative;
}

.study-image::before {
    content: '📚';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.living-room-image {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    position: relative;
}

.living-room-image::before {
    content: '🛋️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.boiler-room-image {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    position: relative;
}

.boiler-room-image::before {
    content: '💧';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
    z-index: 1;
}

.boiler-room-image::before {
    content: '💧';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    opacity: 0.3;
}

/* Right Control Panel - Removed in new design */
.right-panel {
    display: none;
}

.control-panel {
    display: none;
}

.control-panel.active {
    display: block;
}

.control-icons-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.control-icon {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.control-icon:hover {
    opacity: 1;
}

/* Device Controls */
.device-control {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.device-control:last-child {
    border-bottom: none;
}

.device-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 500;
}

.device-icon {
    font-size: 18px;
}

.device-title {
    flex: 1;
}

.device-status {
    color: var(--text-secondary);
    font-size: 12px;
}

.device-input {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: auto;
}

.media-header-icons {
    display: flex;
    gap: 10px;
    margin-left: auto;
    font-size: 16px;
}

/* Temperature Controls */
.temp-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.temp-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.temp-btn:hover {
    background-color: var(--bg-card);
}

.temp-display {
    font-size: 18px;
    min-width: 60px;
    text-align: center;
}

/* Device Buttons */
.device-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.device-btn {
    width: 45px;
    height: 45px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-btn:hover {
    background-color: var(--bg-card);
}

.device-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Climate Dial */
.climate-dial {
    width: 200px;
    height: 200px;
    margin: 20px auto;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dial-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.dial-icon {
    font-size: 24px;
}

.dial-set-temp {
    font-size: 32px;
    font-weight: 600;
}

.dial-current-temp {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Fan Controls */
.fan-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.fan-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 14px;
}

.fan-btn:hover {
    background-color: var(--bg-card);
}

.fan-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Receiver Controls */
.receiver-volume {
    text-align: center;
    font-size: 48px;
    font-weight: 300;
    margin: 20px 0;
    color: var(--text-primary);
}

.receiver-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.receiver-btn {
    width: 50px;
    height: 50px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.receiver-btn:hover {
    background-color: var(--bg-card);
}

.media-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.media-btn {
    width: 45px;
    height: 45px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-btn:hover {
    background-color: var(--bg-card);
}

.play-btn {
    width: 55px;
    height: 55px;
    font-size: 24px;
}

/* Sliders */
.slider-control {
    margin: 20px 0;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-dark);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    border: none;
}

.volume-slider {
    margin-top: 15px;
}

/* Media Player */
.media-cover {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.media-placeholder {
    font-size: 80px;
    opacity: 0.5;
}

.media-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-time {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 60px;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background-color: var(--bg-secondary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--accent-blue);
    transition: width 0.3s;
}

/* Color Pickers */
.color-picker-control {
    margin-bottom: 30px;
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.color-picker-title {
    font-size: 14px;
    font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

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

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

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
    background-color: var(--text-primary);
}

/* Color Wheel */
.color-wheel {
    width: 200px;
    height: 200px;
    margin: 0 auto 15px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #ff0000,
        #ff8000,
        #ffff00,
        #80ff00,
        #00ff00,
        #00ff80,
        #00ffff,
        #0080ff,
        #0000ff,
        #8000ff,
        #ff00ff,
        #ff0080,
        #ff0000
    );
    border: 2px solid var(--border-color);
    cursor: pointer;
    position: relative;
}

.color-wheel.segmented {
    background: conic-gradient(
        from 0deg,
        #ff0000 0deg 30deg,
        #ff8000 30deg 60deg,
        #ffff00 60deg 90deg,
        #80ff00 90deg 120deg,
        #00ff00 120deg 150deg,
        #00ff80 150deg 180deg,
        #00ffff 180deg 210deg,
        #0080ff 210deg 240deg,
        #0000ff 240deg 270deg,
        #8000ff 270deg 300deg,
        #ff00ff 300deg 330deg,
        #ff0080 330deg 360deg
    );
}

.color-slider {
    margin-top: 15px;
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 8px 0;
    position: sticky;
    bottom: 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s;
    position: relative;
    flex: 1;
    max-width: 100px;
}

.nav-item-bottom.active {
    color: var(--accent-pink);
}

.nav-item-bottom.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background-color: var(--accent-pink);
    border-radius: 0 0 3px 3px;
}

.nav-icon-bottom {
    font-size: 24px;
}

.nav-label-bottom {
    font-size: 11px;
    font-weight: 500;
}

/* Bottom Scenarios Panel - Removed in new design */
.bottom-panel {
    display: none;
}
.bottom-panel {
    background-color: var(--bg-card);
    padding: 20px;
    border-top: 1px solid var(--border-color);
    height: 150px;
}

.scenarios-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.scenario-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    border: 2px solid;
    background-color: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.scenario-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.scenario-icon {
    font-size: 24px;
}

.scenario-text {
    font-size: 12px;
    text-align: center;
}

.scenario-red {
    border-color: var(--accent-red);
}

.scenario-green {
    border-color: var(--accent-green);
}

.scenario-orange {
    border-color: var(--accent-orange);
}

.scenario-blue {
    border-color: var(--accent-blue);
}

.scenario-purple {
    border-color: var(--accent-purple);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .right-panel {
        width: 300px;
    }
    
    .left-nav {
        width: 180px;
    }
}

/* Tablet adjustments */
@media (max-width: 1024px) {
    .right-panel {
        width: 280px;
    }
    
    .left-nav {
        width: 160px;
    }
    
    .scenarios-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile devices (iPhone, Android) - Updated */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        overflow-x: hidden;
    }

    .app-container {
        min-height: 100vh;
        height: 100vh;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    .top-header {
        flex-shrink: 0;
        z-index: 10;
    }

    .main-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        position: relative;
        overflow: hidden;
    }

    .central-content {
        flex: 1;
        min-height: 0;
        position: relative;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .screen {
        padding: 16px;
        padding-bottom: 80px; /* Space for bottom nav */
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        box-sizing: border-box;
    }

    .screen.active {
        display: block;
    }

    .screen-main {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .dashboard-container {
        padding: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .greeting-text {
        font-size: 24px;
    }

    .greeting-subtitle {
        font-size: 13px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .rooms-section {
        margin-top: 24px;
    }

    .rooms-scroll {
        gap: 12px;
        display: flex !important; /* Force display */
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        min-height: 200px; /* Ensure it has height */
    }

    .room-card {
        min-width: 160px;
        width: 160px;
        flex-shrink: 0;
    }

    .room-card-image {
        height: 100px;
    }

    /* Room screen full screen on mobile */
    .screen-kitchen,
    .screen-bedroom,
    .screen-living-room,
    .screen-study {
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 100;
    }

    .screen-kitchen .room-screen-container,
    .screen-bedroom .room-screen-container,
    .screen-living-room .room-screen-container,
    .screen-study .room-screen-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 100;
    }

    .room-screen-content {
        padding: 16px;
        padding-top: 50px;
        padding-bottom: 80px;
        min-height: 100vh;
    }

    .devices-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .device-card {
        padding: 16px;
    }

    .device-card-climate {
        grid-column: 1;
    }

    .temp-dial-circle {
        width: 100px;
        height: 100px;
    }

    .temp-dial-value {
        font-size: 32px;
    }

    .climate-modes {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .climate-mode-btn {
        padding: 10px;
    }

    .mode-icon {
        font-size: 20px;
    }

    .mode-text {
        font-size: 11px;
    }

    .bottom-nav {
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background-color: var(--bg-primary);
    }

    .nav-label-bottom {
        font-size: 10px;
    }

    .nav-icon-bottom {
        font-size: 20px;
    }

    /* Hide left navigation on mobile */
    .left-nav {
        display: none !important;
    }

    .right-panel {
        display: none !important;
    }

    .central-content {
        width: 100%;
    }

    .main-content {
        width: 100%;
    }

    .top-header {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 50;
        background-color: var(--bg-primary);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .header-right {
        gap: 8px;
    }

    .sensor-readings {
        display: none; /* Hide on mobile to save space */
    }

    .mqtt-status {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 768px) {
    /* Left Navigation - Horizontal scroll on mobile */
    .left-nav {
        width: 100%;
        height: auto;
        max-height: 200px;
        padding: 10px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        flex-direction: row;
        gap: 0;
    }
    
    .nav-section {
        display: flex;
        flex-direction: row;
        margin-bottom: 0;
        margin-right: 20px;
        min-width: fit-content;
    }
    
    .nav-header {
        display: none; /* Hide headers on mobile, show in nav item */
    }
    
    .nav-item {
        padding: 10px 15px;
        white-space: nowrap;
        min-width: 100px;
        flex-direction: column;
        gap: 5px;
    }
    
    .nav-item.active::after {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 3px;
    }
    
    .nav-icon {
        font-size: 20px;
    }
    
    .nav-text {
        font-size: 12px;
    }
    
    /* Central Content - Full width */
    .central-content {
        width: 100%;
        min-height: 150px;
        max-height: 150px;
    }
    
    .room-image {
        height: 150px;
        min-height: 150px;
        max-height: 150px;
    }
    
    .room-image::before {
        font-size: 30px;
    }
    
    /* Right Panel - Full width, scrollable */
    .right-panel {
        width: 100%;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 15px;
    }
    
    .control-icons-row {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .control-icon {
        font-size: 28px;
        min-width: 50px;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Device Controls - Optimize for touch */
    .device-control {
        margin-bottom: 25px;
        padding-bottom: 25px;
    }
    
    .temp-btn,
    .device-btn,
    .fan-btn {
        min-width: 50px;
        min-height: 50px;
        font-size: 18px;
    }
    
    .climate-dial {
        width: 150px;
        height: 150px;
    }
    
    .dial-set-temp {
        font-size: 24px;
    }
    
    .dial-current-temp {
        font-size: 14px;
    }
    
    .receiver-volume {
        font-size: 36px;
    }
    
    .receiver-btn,
    .media-btn {
        min-width: 50px;
        min-height: 50px;
    }
    
    .play-btn {
        min-width: 60px;
        min-height: 60px;
    }
    
    /* Color Pickers */
    .color-wheel {
        width: 150px;
        height: 150px;
    }
    
    /* Bottom Panel - Optimize scenarios */
    .bottom-panel {
        height: auto;
        padding: 15px;
    }
    
    .scenarios-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .scenario-btn {
        padding: 12px 8px;
        min-height: 80px;
    }
    
    .scenario-icon {
        font-size: 20px;
    }
    
    .scenario-text {
        font-size: 11px;
    }
}

/* Small mobile devices (iPhone SE, small Android) */
@media (max-width: 480px) {
    .top-header {
        padding: 8px 10px;
    }
    
    
    .current-room {
        font-size: 14px;
    }
    
    .room-icon {
        font-size: 18px;
    }
    
    .sensor-readings {
        gap: 5px;
    }
    
    .sensor-label {
        font-size: 9px;
    }
    
    .sensor-value {
        font-size: 11px;
    }
    
    .left-nav {
        max-height: 150px;
    }
    
    .nav-item {
        padding: 8px 12px;
        min-width: 80px;
    }
    
    .nav-icon {
        font-size: 18px;
    }
    
    .nav-text {
        font-size: 11px;
    }
    
    .central-content {
        min-height: 150px;
        max-height: 150px;
    }
    
    .room-image {
        height: 150px;
        min-height: 150px;
        max-height: 150px;
    }
    
    .room-image::before {
        font-size: 30px;
    }
    
    .right-panel {
        padding: 12px;
    }
    
    .device-header {
        font-size: 13px;
    }
    
    .temp-control {
        gap: 10px;
    }
    
    .temp-display {
        font-size: 16px;
    }
    
    .climate-dial {
        width: 120px;
        height: 120px;
    }
    
    .dial-set-temp {
        font-size: 20px;
    }
    
    .dial-icon {
        font-size: 20px;
    }
    
    .receiver-volume {
        font-size: 32px;
    }
    
    .color-wheel {
        width: 120px;
        height: 120px;
    }
    
    .scenarios-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .scenario-btn {
        padding: 10px 6px;
        min-height: 70px;
    }
    
    .scenario-icon {
        font-size: 18px;
    }
    
    .scenario-text {
        font-size: 10px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .top-header {
        flex-direction: row;
        height: 60px;
        padding: 8px 15px;
    }
    
    .header-center,
    .header-right {
        width: auto;
    }
    
    .sensor-readings {
        width: auto;
        gap: 15px;
    }
    
    .main-content {
        flex-direction: row;
        height: calc(100vh - 200px);
    }
    
    .left-nav {
        width: 150px;
        max-height: 100%;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .nav-section {
        flex-direction: column;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .nav-header {
        display: block;
    }
    
    .nav-item {
        flex-direction: row;
        min-width: auto;
    }
    
    .nav-item.active::after {
        top: 0;
        bottom: 0;
        left: auto;
        right: 0;
        width: 3px;
        height: 100%;
    }
    
    .central-content {
        flex: 1;
        max-height: 100%;
    }
    
    .right-panel {
        width: 250px;
        max-height: 100%;
        border-top: none;
        border-left: 1px solid var(--border-color);
    }
    
    .bottom-panel {
        height: 80px;
    }
    
    .scenarios-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets for mobile */
    .nav-item,
    .temp-btn,
    .device-btn,
    .fan-btn,
    .receiver-btn,
    .media-btn,
    .scenario-btn,
    .control-icon {
        min-height: 44px; /* Apple's recommended minimum touch target */
    }
    
    /* Remove hover effects on touch devices */
    .nav-item:hover,
    .temp-btn:hover,
    .device-btn:hover,
    .fan-btn:hover,
    .receiver-btn:hover,
    .media-btn:hover,
    .scenario-btn:hover {
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .nav-item:active,
    .temp-btn:active,
    .device-btn:active,
    .fan-btn:active,
    .receiver-btn:active,
    .media-btn:active,
    .scenario-btn:active,
    .control-icon:active {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-secondary);
}

.modal-body {
    padding: 20px;
}

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

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-body .form-group input[type="text"],
.modal-body .form-group input[type="number"],
.modal-body .form-group input[type="password"] {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    box-sizing: border-box;
}

.modal-body .form-group input[type="checkbox"] {
    margin-right: 8px;
}

.modal-body .form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-primary:hover {
    background-color: #3a8eef;
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-card);
}

/* Dynamic UI Elements */
.dynamic-controls {
    display: block;
}

.dynamic-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dynamic-device {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.dynamic-device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dynamic-device-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.dynamic-device-value {
    font-size: 18px;
    color: var(--accent-blue);
    font-weight: 600;
}

.dynamic-control {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dynamic-control .device-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Smooth transitions */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

