:root {
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --glass-blur: blur(10px);
    --text-color: #ffffff;
    --accent-color: #00ff88;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

#app {
    display: flex;
    gap: 20px;
    height: 100%;
}

/* Glassmorphism Container */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Left Column Layout */
#left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    /* Prevent flex overflow */
}

/* Device Panel */
#device-panel {
    flex: 1;
    /* Takes available space */
    min-height: 0;
    /* Allow shrinking for scroll */
    overflow: hidden;
    /* Container doesn't scroll, child does */
}

#device-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 5px;
    /* Space for scrollbar */
    height: 100%;
}

/* Console Panel */
#console-panel {
    height: 200px;
    /* Fixed height for console */
    flex-shrink: 0;
}

#console-output {
    flex: 1;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-all;
    color: #00ff88;
}

.console-entry {
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 2px;
}

.console-timestamp {
    color: #888;
    margin-right: 8px;
    font-size: 0.8em;
}

/* Device Items */
.device-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.device-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.device-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.05);
}

.device-name {
    font-weight: 500;
    font-size: 1.1em;
}

.device-sku {
    font-size: 0.8em;
    opacity: 0.6;
}

/* Controls Column */
#controls-column {
    width: 300px;
    gap: 20px;
    overflow-y: auto;
    /* Fix overflow on small screens */
}

h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 300;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    font-size: 1.2em;
}

.control-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.control-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    font-weight: 600;
    margin-bottom: 10px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-on {
    background: var(--accent-color);
    color: #1a1a2e;
}

.btn-off {
    background: rgba(255, 99, 71, 0.8);
    color: white;
}

.btn-action {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

/* Color Picker */
#color-picker {
    width: 100%;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
}

/* Range Slider */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    margin-top: 5px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

#status-message {
    margin-top: auto;
    font-size: 0.85em;
    opacity: 0.7;
    text-align: center;
    min-height: 1.2em;
    padding-top: 10px;
}