/**
 * Chronicles of Apocalyptica - Color Wheel Sidebar
 * Sleek slide-out color customizer
 */

/* Toggle Button - Fixed on right side */
.color-wheel-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color, #c896ff), var(--secondary-color, #9b6dff));
    border: none;
    border-radius: 25px 0 0 25px;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.color-wheel-toggle:hover {
    width: 60px;
    box-shadow: -8px 0 30px var(--glow-color, rgba(200, 150, 255, 0.6));
}

.color-wheel-toggle svg {
    width: 28px;
    height: 28px;
    animation: spin-slow 8s linear infinite;
}

.color-wheel-toggle.active svg {
    animation: spin-slow 2s linear infinite;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Sidebar Panel */
.color-wheel-sidebar {
    position: fixed;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100vh;
    background: linear-gradient(180deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
    border-left: 3px solid var(--primary-color, #c896ff);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
}

.color-wheel-sidebar.open {
    right: 0;
}

.color-wheel-sidebar::-webkit-scrollbar {
    width: 6px;
}

.color-wheel-sidebar::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.color-wheel-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color, #c896ff);
    border-radius: 3px;
}

/* Header */
.cw-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--primary-color, #c896ff);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
}

.cw-header h3 {
    color: var(--primary-color, #c896ff);
    font-family: 'Comfortaa', cursive;
    font-size: 1.2rem;
    margin: 0;
    text-shadow: 0 0 15px var(--glow-color, rgba(200, 150, 255, 0.6));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cw-close {
    background: none;
    border: none;
    color: var(--primary-color, #c896ff);
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.cw-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

/* Content */
.cw-content {
    padding: 1.5rem;
}

/* Section Titles */
.cw-section-title {
    color: var(--primary-color, #c896ff);
    font-family: 'Comfortaa', cursive;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(200, 150, 255, 0.3);
}

/* Color Wheel */
.cw-wheel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.cw-wheel {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: conic-gradient(
        hsl(0, 100%, 50%),
        hsl(30, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(90, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(150, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(210, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(270, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(330, 100%, 50%),
        hsl(360, 100%, 50%)
    );
    border: 4px solid var(--primary-color, #c896ff);
    cursor: crosshair;
    position: relative;
    box-shadow: 0 0 30px var(--glow-color, rgba(200, 150, 255, 0.4)),
                inset 0 0 60px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
}

.cw-wheel:hover {
    box-shadow: 0 0 50px var(--glow-color, rgba(200, 150, 255, 0.6)),
                inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.cw-wheel-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, #fff 0%, #888 100%);
    border-radius: 50%;
    border: 3px solid var(--primary-color, #c896ff);
}

.cw-wheel-selector {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Color Preview */
.cw-preview {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cw-preview-swatch {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #fff;
    box-shadow: 0 0 15px var(--glow-color, rgba(200, 150, 255, 0.4));
}

.cw-preview-hex {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--primary-color, #c896ff);
}

/* Saturation/Lightness Sliders */
.cw-sliders {
    margin-bottom: 2rem;
}

.cw-slider-group {
    margin-bottom: 1rem;
}

.cw-slider-label {
    display: flex;
    justify-content: space-between;
    color: #e0e0e0;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.cw-slider {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #333, var(--primary-color, #c896ff));
    border: 2px solid rgba(200, 150, 255, 0.3);
    cursor: pointer;
}

.cw-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color, #c896ff);
    border: 3px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 10px var(--glow-color, rgba(200, 150, 255, 0.6));
}

.cw-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color, #c896ff);
    border: 3px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 10px var(--glow-color, rgba(200, 150, 255, 0.6));
}

/* Preset Themes */
.cw-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.cw-preset {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid var(--preset-color);
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.cw-preset:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px var(--preset-glow);
}

.cw-preset.active {
    background: rgba(var(--preset-color-rgb), 0.2);
    box-shadow: 0 0 20px var(--preset-glow);
}

.cw-preset-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.cw-preset-name {
    font-size: 0.75rem;
    color: var(--preset-color);
    font-family: 'Comfortaa', cursive;
}

/* Apply Button */
.cw-apply-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color, #c896ff), var(--secondary-color, #9b6dff));
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Comfortaa', cursive;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 20px var(--glow-color, rgba(200, 150, 255, 0.4));
}

.cw-apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-color, rgba(200, 150, 255, 0.6));
}

.cw-apply-btn:active {
    transform: translateY(0);
}

/* Reset Link */
.cw-reset {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.cw-reset:hover {
    color: var(--primary-color, #c896ff);
}

/* Overlay when sidebar is open */
.cw-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cw-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .color-wheel-sidebar {
        width: 100%;
        right: -100%;
    }

    .color-wheel-toggle {
        top: auto;
        bottom: 20px;
        right: 20px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
    }

    .color-wheel-toggle:hover {
        width: 56px;
    }

    .cw-wheel {
        width: 150px;
        height: 150px;
    }
}
