/*
         Rulestex Colors v0.1.0
 An open-source web-based color picker
        © 2025 Codemaster United

Basic Stylesheet
*/

:root {
    --picker-bg: #fff;
    --picker-radius: 12px;
    --picker-shadow: 0 8px 20px rgba(0,0,0,0.15);
    --picker-transition: 0.25s ease;
    --text-color: black;
    --swatch-size: 32px;
    --wheel-size: 80px;
    --panel-w: auto;
    --panel-h: auto;
    --accent: #0077ff;
    --wheel-indicator: white;
}

/* The swatch trigger */
.rlstxcols-swatch {
    width: var(--swatch-size);
    height: var(--swatch-size);
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    display: inline-block;
    box-shadow: none;
    cursor: pointer;
    transition: box-shadow var(--picker-transition), transform var(--picker-transition);
    flex: 0 0 auto;
}
.rlstxcols-swatch:focus {
    outline: 2px solid rgba(0,0,0,0.08);
    outline-offset: 2px
}
.rlstxcols-swatch:hover {
    box-shadow: 0 0 5px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

/* Popup panel */
.rlstxcols-panel {
    width: var(--panel-w);
    height: var(--panel-h);
    background: var(--picker-bg);
    color: var(--text-color);
    border-radius: var(--picker-radius);
    box-shadow: var(--picker-shadow);
    padding: 0.8rem;
    position: fixed;
    z-index: 9999;
    transform-origin: top center;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0;
    transform: scale(0.95);
    display: flex;
    gap: 10px;
    box-sizing: border-box;
    align-items: center;
}
.rlstxcols-panel.show {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}
.rlstxcols-panel.hide {
    opacity: 0;
    transform: scale(0.95);
    visibility: hidden;
}

.rlstxcols-panel * {
    box-sizing: border-box;
}

/* Wheel + slider column */
.rlstxcols-panel .rlstxcols-wheel-col {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.rlstxcols-panel canvas.rlstxcols-wheel {
    width: var(--wheel-size);
    height: var(--wheel-size);
    border-radius: 50%;
    touch-action: none;
    display: block;
    background: transparent;
    position: relative;
    box-shadow: 0 0 5px #B4B4B4;
}
.rlstxcols-panel .rlstxcols-wheel-indicator {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--wheel-indicator);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transform: translate(-50%,-50%);
    pointer-events: none;
}

/* Value slider */
.rlstxcols-panel .rlstxcols-slider {
    width: 12px;
    height: var(--wheel-size);
    border-radius: 8px;
    box-shadow: 0 0 2px #B4B4B4;
    background: linear-gradient(#fff,#000);
    position: relative;
    touch-action: none;
}
.rlstxcols-panel .rlstxcols-slider-handle {
    width: 18px;
    height: 6px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    position: absolute;
    left: 50%;
    transform: translate(-50%,-50%);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Right side: input + preview */
.rlstxcols-panel .rlstxcols-controls {
    flex: 1;
    width: 100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rlstxcols-panel .rlstxcols-input-row {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}
.rlstxcols-panel .rlstxcols-input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 8px;
    width: calc(100% - 4px - 20px);
    box-sizing: border-box;
    font-size: 13px;
}
.rlstxcols-panel .rlstxcols-input.invalid {
    border-color: #e35b5b;
    animation: shake .15s linear 0s 1
}
.rlstxcols-panel .rlstxcols-recent-colors {
    display: flex;
    align-items: center;
    gap: 5px;
}
.rlstxcols-panel .rlstxcols-recent-colors .recent-color {
    background: teal;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    box-shadow: 0 0 2px #B4B4B4;
}
@keyframes shake {
    0% {
        transform: translateX(0)
    }

    25% {
        transform: translateX(-3px)
    }

    75% {
        transform: translateX(3px)
    }

    100% {
        transform: translateX(0)
    }}

.rlstxcols-panel .rlstxcols-preview {
    width: 20px;
    height: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: inset 0 -6px 12px rgba(0,0,0,0.03)
}

.rlstxcols-panel .rlstxcols-footer {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px
}
.rlstxcols-panel .rlstxcols-btn {
    font-size: 12px;
    border: none;
    background: transparent;
    cursor: pointer
}

.rlstxcols-panel .rlstxcols-transparent-option {
    width: 18px;
    height: 18px;
    aspect-ratio: 1;
    border-radius: 999px;
}
.rlstxcols-panel .rlstxcols-transparent-option:hover {
    transform: scale(1.1);
}
.rlstxcols-panel .rlstxcols-transparent-option.active {
    border: 2px solid white;
    box-shadow: 0 0 0px 2px #008AFF;
    transition: all 0.2s;
}
.rlstxcols-panel .rlstxcols-apply {
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;

}
.rlstxcols-panel .rlstxcols-cancel {
    aspect-ratio: 1;
}
.rlstxcols-panel .rlstxcols-input-heading {
    font-size: 10px;
    width: 100%;
}

/* small touch affordances */
.rlstxcols-panel {
    touch-action: none
}
.rlstxcols-panel .rlstxcols-wheel-col, .rlstxcols-panel .rlstxcols-controls {
    user-select: none
}

.transparent, .rlstxcols-panel .rlstxcols-transparent-option {
    background-color: white !important;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23A8A8A8' fill-opacity='1'%3E%3Cpath d='M0 0h10v10H0V0zm10 10h10v10H10V10z'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: 10px 10px;
    background-position: center;
}

/* responsive fallback */
@media (max-width:320px) {
    .rlstxcols-panel {
        width: calc(100% - 20px);
        left: 10px !important;
        right: 10px !important;
        transform-origin: center top
    }
}