:root {
    --bg-primary: #0f1115;
    --bg-secondary: #1a1d24;
    --bg-card: #22262f;
    --text-primary: #ffffff;
    --text-secondary: #a0a5b0;
    --accent-primary: #ffcc00;
    --accent-success: #00d084;
    --accent-danger: #ff4757;
    --accent-blue: #3498db;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 4rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-danger);
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
}

.modal h2 { margin-bottom: 1rem; }
.modal p { color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.5; }

.input-group {
    display: flex;
    gap: 0.5rem;
}

input[type="text"], input[type="number"], select {
    background: var(--bg-primary);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    flex: 1;
    font-family: inherit;
}

input:focus { outline: none; border-color: var(--accent-primary); }

.status-message {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--accent-primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary { background: var(--accent-primary); color: #000; }
.btn-success { background: var(--accent-success); color: #000; width: 100%; }
.btn-danger { background: var(--accent-danger); color: #fff; width: 100%; }
.btn-secondary { background: var(--bg-card); color: white; border: 1px solid rgba(255,255,255,0.1); }

.btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Dashboard */
.dashboard {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Sync Panel */
.sync-panel {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    border: 1px solid rgba(255,255,255,0.05);
    transition: box-shadow 0.3s;
}

.sync-panel.active {
    box-shadow: 0 0 30px rgba(0, 208, 132, 0.2);
    border-color: var(--accent-success);
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sync-header h2 { font-size: 1.2rem; }

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.status-badge.stopped { background: var(--accent-danger); color: white; }
.status-badge.active { background: var(--accent-success); color: black; animation: pulse 2s infinite; }

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

.sync-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.setting-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="range"] {
    width: 100%;
    margin-bottom: 0.25rem;
}

.color-preview-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.color-preview-box {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #333;
    border: 2px solid rgba(255,255,255,0.1);
    transition: background-color 0.1s;
}

/* Lights Grid */
.lights-section h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.lights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* Light Card */
.light-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.light-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
}

.light-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.light-info h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.light-info span { font-size: 0.75rem; color: var(--text-secondary); }

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: #444;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active { background: var(--accent-success); }

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

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

.light-controls {
    margin-top: 1rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.sync-checkbox {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
    .header { padding: 1rem; }
    .dashboard { padding: 1rem; }
    .sync-settings { grid-template-columns: 1fr; }
}
