/*
 * Swatches + the HSV picker, shared by the frontend panel and the admin
 * settings page. Picker rules are scoped under its root id #wptp-picker so id
 * specificity beats class-based theme rules without !important; the swatch is a
 * plain div themes have no reason to target, so a class selector suffices.
 * Fallback values are needed because the admin page loads this file without
 * style.css and its :root variables.
 */

.wptp-color-swatch {
    width: 100%;
    height: 38px;
    border: 1px solid var(--wptp-border, #d0d7de);
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
}

#wptp-picker {
    display: none;
    position: fixed;
    z-index: calc(var(--wptp-z, 9101) + 10);
    width: 220px;
    background: var(--wptp-surface, #fff);
    border: 1px solid var(--wptp-border, #d0d7de);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    padding: 10px;
    font-family: var(--wptp-font, sans-serif);
    touch-action: none;
}

#wptp-picker.wptp-picker-open {
    display: block;
}

#wptp-picker .wptp-picker-sv {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 4px;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;
}

#wptp-picker .wptp-picker-sv-white,
#wptp-picker .wptp-picker-sv-black {
    position: absolute;
    inset: 0;
    border-radius: 4px;
}

#wptp-picker .wptp-picker-sv-white {
    background: linear-gradient(to right, #fff, transparent);
}

#wptp-picker .wptp-picker-sv-black {
    background: linear-gradient(to top, #000, transparent);
}

#wptp-picker .wptp-picker-sv-cursor {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0,0,0,.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#wptp-picker .wptp-picker-hue {
    position: relative;
    width: 200px;
    height: 14px;
    margin-top: 10px;
    border-radius: 7px;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
    cursor: pointer;
    touch-action: none;
}

#wptp-picker .wptp-picker-hue-cursor {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0,0,0,.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#wptp-picker .wptp-picker-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

#wptp-picker .wptp-picker-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid var(--wptp-border, #d0d7de);
    flex-shrink: 0;
}

#wptp-picker .wptp-picker-hex {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--wptp-border, #d0d7de);
    border-radius: 4px;
    font-size: 13px;
    font-family: monospace;
    color: var(--wptp-text, #24292f);
    background: #fff;
    outline: none;
    box-sizing: border-box;
}

#wptp-picker .wptp-picker-hex:focus {
    border-color: var(--wptp-accent, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .2);
}
