body,
html {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.light-container {
    width: 100%;
    height: 100%;
    background-color: #000000;
    transition: background-color 0.5s ease;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.back-link:hover {
    background: rgba(0, 0, 0, 0.4);
    color: white;
}

.controls-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 20;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.control-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

#bulb-icon {
    transition: all 0.3s;
}

.light-on #bulb-icon {
    fill: currentColor;
    filter: drop-shadow(0 0 8px rgba(255, 255, 0, 0.5));
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* Color Panel */
.color-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 280px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    color: white;
    z-index: 15;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.color-panel.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    pointer-events: none;
}

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

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.btn-icon-sm {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 4px;
    font-size: 1.2rem;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon-sm:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Custom Picker */
.custom-picker-container {
    display: flex;
    gap: 12px;
    height: 150px;
    margin-bottom: 15px;
}

.saturation-area {
    flex: 1;
    position: relative;
    background-color: red;
    /* Dynamic hue */
    background-image:
        linear-gradient(to right, #fff, transparent),
        linear-gradient(to top, #000, transparent);
    border-radius: 8px;
    cursor: crosshair;
    overflow: hidden;
}

.saturation-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
    top: 0;
    left: 0;
}

.hue-slider-area {
    width: 24px;
    position: relative;
    background: linear-gradient(to bottom,
            #f00 0%, #ff0 17%, #0f0 33%,
            #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
    border-radius: 12px;
    cursor: pointer;
}

.hue-cursor {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    transform: translateY(-50%);
    pointer-events: none;
    left: 0;
    top: 0;
    background: transparent;
}

.color-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.color-preview-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: #ffffff;
}

input[type="text"] {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0 12px;
    color: white;
    font-family: monospace;
    font-size: 1rem;
    text-transform: uppercase;
    height: 40px;
    box-sizing: border-box;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.panel-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-sm {
    flex: 1;
    padding: 8px;
    font-size: 0.9rem;
}

.presets-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.preset-slot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-slot:hover {
    transform: scale(1.1);
    border-color: white;
}

.preset-slot.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Light Mode Styles for UI elements when background is bright */
.light-mode-ui .back-link {
    color: rgba(0, 0, 0, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.light-mode-ui .back-link:hover {
    color: black;
    background: rgba(255, 255, 255, 0.4);
}

.light-mode-ui .control-btn {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.light-mode-ui .control-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.light-mode-ui .control-btn.active {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}