/* ===========================================
   R4P – Theme Picker UI
   =========================================== */

.theme-picker {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: var(--ff-body, 'Inter', system-ui, sans-serif);
    font-size: 14px;
}

.theme-picker__toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--c-green, #0b0f0b);
    color: var(--c-accent, #ffd100);
    display: grid;
    place-items: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.2s ease, background 0.2s ease;
}

.theme-picker__toggle:hover {
    transform: translateY(-2px) scale(1.04);
}

.theme-picker__toggle.is-active {
    background: var(--c-accent, #ffd100);
    color: var(--c-green, #0b0f0b);
}

.theme-picker__panel {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: min(320px, calc(100vw - 32px));
    max-height: min(70vh, 520px);
    overflow: auto;
    background: #fff;
    color: #0b0f0b;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(11, 15, 11, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    -webkit-overflow-scrolling: touch;
}

.theme-picker.is-open .theme-picker__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.theme-picker__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(11, 15, 11, 0.08);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.theme-picker__head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.theme-picker__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.4rem;
    line-height: 1;
    color: #666;
    display: grid;
    place-items: center;
}

.theme-picker__close:hover {
    background: rgba(11, 15, 11, 0.06);
}

.theme-picker__body {
    padding: 14px 16px 16px;
}

.theme-picker__label {
    margin: 0 0 8px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(11, 15, 11, 0.5);
}

.theme-picker__label:not(:first-child) {
    margin-top: 16px;
}

.theme-picker__presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.theme-picker__preset {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(11, 15, 11, 0.1);
    background: #fafafa;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.theme-picker__preset:hover {
    border-color: rgba(11, 15, 11, 0.25);
}

.theme-picker__preset.is-active {
    border-color: var(--c-accent, #ffd100);
    background: rgba(255, 209, 0, 0.12);
}

.theme-picker__preset-swatch {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.theme-picker__preset-name {
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25;
}

.theme-picker__field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(11, 15, 11, 0.06);
}

.theme-picker__field:last-of-type {
    border-bottom: none;
}

.theme-picker__field-name {
    font-size: 0.82rem;
    font-weight: 500;
}

.theme-picker__field input[type="color"] {
    width: 44px;
    height: 32px;
    padding: 2px;
    border: 1px solid rgba(11, 15, 11, 0.15);
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.theme-picker__actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.theme-picker__btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1.5px solid rgba(11, 15, 11, 0.15);
    background: #fff;
    color: #0b0f0b;
}

.theme-picker__btn:hover {
    background: rgba(11, 15, 11, 0.04);
}

.theme-picker__btn--primary {
    background: var(--c-green, #0b0f0b);
    color: var(--c-accent, #ffd100);
    border-color: var(--c-green, #0b0f0b);
}

.theme-picker__btn--primary:hover {
    opacity: 0.9;
}

@media (max-width: 480px) {
    .theme-picker {
        bottom: 12px;
        right: 12px;
    }

    .theme-picker__presets {
        grid-template-columns: 1fr;
    }
}
