/* ============================================
   STYLE SWITCHER — Complete Styles
   ============================================ */

/* ===== PANEL CONTAINER ===== */
.ss-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    height: 100%;
    pointer-events: none;
}
.ss-panel.open {
    pointer-events: auto;
}

/* ===== OVERLAY (click outside to close) ===== */
.ss-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ss-panel.open + .ss-overlay {
    opacity: 1;
    visibility: visible;
}

/* ===== TOGGLE BUTTON ===== */
.ss-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 10000;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.10);
    border-right: none;
    border-radius: 12px 0 0 12px;
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    pointer-events: auto;
}
.ss-toggle:hover {
    color: var(--color-primary, #f7b731);
    border-color: rgba(247,183,49,0.3);
}
.ss-toggle:focus-visible {
    outline: 2px solid var(--color-primary, #f7b731);
    outline-offset: 2px;
}

/* === Gear icon === */
.ss-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    animation: ss-gear-spin 6s linear infinite;
}
.ss-gear svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ss-toggle:hover .ss-gear {
    animation-duration: 0.8s;
}
.ss-panel.open .ss-toggle .ss-gear {
    animation-duration: 2s;
}
.ss-panel.open .ss-toggle:hover .ss-gear {
    animation-duration: 0.5s;
}
@keyframes ss-gear-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Move toggle when panel is open */
.ss-panel.open .ss-toggle {
    right: 280px;
    border-radius: 12px 0 0 12px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

/* ===== PANEL WRAPPER ===== */
.ss-wrap {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: rgba(15, 15, 25, 0.96);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-left: 1px solid rgba(255,255,255,0.08);
    box-shadow: -8px 0 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.ss-panel.open .ss-wrap {
    right: 0;
}

/* ===== HEADER ===== */
.ss-header {
    flex-shrink: 0;
    padding: 20px 20px 16px;
    background: rgba(20, 20, 35, 0.9);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ss-title {
    margin: 0;
    font-family: 'Jost', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.9);
}
.ss-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ss-close:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.ss-close:focus-visible {
    outline: 2px solid var(--color-primary, #f7b731);
    outline-offset: 2px;
}

/* ===== BODY ===== */
.ss-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    background: transparent;
}
.ss-body::-webkit-scrollbar {
    width: 4px;
}
.ss-body::-webkit-scrollbar-track {
    background: transparent;
}
.ss-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
}

/* ===== SECTIONS ===== */
.ss-section {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ss-section-last {
    border-bottom: none;
}

/* ===== HEADING ===== */
.ss-heading {
    margin: 0 0 10px;
    font-family: 'Jost', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.7);
}

/* ===== SWATCHES GRID ===== */
.ss-swatches {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* ===== INDIVIDUAL SWATCH ===== */
.ss-swatch {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    border-radius: 8px;
}
.ss-swatch:hover {
    z-index: 2;
}
.ss-swatch:hover .ss-swatch-bg {
    transform: scale(1.12);
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* Hide the actual radio */
.ss-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

/* Color background */
.ss-swatch-bg {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ===== SELECTION RING ===== */
/* Visible on ALL backgrounds (light, dark, gradient) */
.ss-input:checked + .ss-swatch-bg {
    box-shadow:
        0 0 0 2.5px rgba(255,255,255,0.95),
        0 0 0 4.5px rgba(255,255,255,0.2);
    outline: none;
}

/* ===== HINT ===== */
.ss-hint {
    margin: 10px 0 0;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    line-height: 1.4;
}

/* ===== CUSTOM COLOR ROW ===== */
.ss-custom-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Hex text input */
.ss-input-text {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    color: rgba(255,255,255,0.8);
    font-family: 'Jost', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.ss-input-text::placeholder {
    color: rgba(255,255,255,0.3);
}
.ss-input-text:focus {
    border-color: var(--color-primary, #f7b731);
}

/* Color picker label (wraps native input + display button) */
.ss-color-label {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    flex-shrink: 0;
}
.ss-color-label input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

/* Color display button */
.ss-color-btn {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    transition: transform 0.2s;
}
.ss-color-btn:hover {
    transform: scale(1.08);
}

/* ===== RESET BUTTON ===== */
.ss-reset {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: rgba(255,255,255,0.8);
    font-family: 'Jost', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}
.ss-reset:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.ss-reset:focus-visible {
    outline: 2px solid var(--color-primary, #f7b731);
    outline-offset: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .ss-wrap {
        width: 260px;
        right: -280px;
    }
    .ss-panel.open .ss-toggle {
        right: 260px;
    }
    .ss-swatches {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
    .ss-section {
        padding: 10px 16px;
    }
    .ss-header {
        padding: 16px 16px 12px;
    }
}

@media (max-width: 400px) {
    .ss-wrap {
        width: 240px;
        right: -260px;
    }
    .ss-panel.open .ss-toggle {
        right: 240px;
    }
    .ss-swatches {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
    }
    .ss-toggle {
        width: 38px;
        height: 38px;
    }
    .ss-gear {
        width: 26px;
        height: 26px;
    }
    .ss-gear svg {
        width: 22px;
        height: 22px;
    }
}