/* ============================================================
   THEME TOGGLE
   - Theme picker (🎨 + panneau de sélection des thèmes colorés)
   - Toggle dark/light (pastille qui glisse)
   - Toggle switch booléen (utilisé sur isFood, etc.)
   ============================================================ */


/* ============================================================
   THEME PICKER (🎨 + panneau)
   ============================================================ */

.theme-picker-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2rem;
    border-radius: 9999px;
    color: var(--color-header-text);
    font-size: 1rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.theme-picker-btn:hover {
    background-color: var(--color-header-hover);
}

.theme-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 280px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 50;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform-origin: top right;
}

.theme-panel-visible {
    opacity: 1;
    transform: translateY(0);
}

html.dark .theme-panel {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.theme-panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.theme-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.theme-chip {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background-color: transparent;
    color: var(--color-text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-align: left;
    width: 100%;
}

.theme-chip:hover {
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

html.dark .theme-chip:hover {
    background-color: color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.theme-chip-active {
    border-color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

html.dark .theme-chip-active {
    background-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.theme-chip-swatch {
    display: flex;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    overflow: hidden;
    border: 1.5px solid var(--color-border);
    flex-shrink: 0;
}

.theme-chip-swatch span {
    flex: 1;
    height: 100%;
}

@media (max-width: 640px) {
    .theme-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 1.25rem 1rem 1.5rem;
        transform: translateY(100%);
        transition: transform 0.25s ease, opacity 0.25s ease;
    }
    
    .theme-panel-visible {
        transform: translateY(0);
    }
    
    .theme-panel-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   TOGGLE DARK / LIGHT
   Pattern : icône active DANS la pastille qui glisse
   ============================================================ */

.theme-toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 2rem;
    width: 4rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background-color: #475569;
    transition: background-color 0.3s ease;
    cursor: pointer;
    padding: 0;
    border: none;
}

.theme-toggle-switch:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-header-bg), 0 0 0 4px var(--color-header-text);
}

html.dark .theme-toggle-switch {
    background-color: #1E293B;
}

.theme-toggle-thumb {
    position: absolute;
    top: 50%;
    left: 0.25rem;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    background-color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: left 0.3s ease, background-color 0.3s ease;
}

html.dark .theme-toggle-thumb {
    left: calc(100% - 1.75rem);
    background-color: #F1F5F9;
}

.theme-toggle-icon {
    position: absolute;
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.theme-toggle-icon-sun {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.theme-toggle-icon-moon {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

html.dark .theme-toggle-icon-sun {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

html.dark .theme-toggle-icon-moon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}


/* ============================================================
   TOGGLE SWITCH BOOLÉEN (isFood, etc.)
   ============================================================ */

.toggle-switch {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    background-color: var(--color-border);
    border-radius: 9999px;
    transition: background-color 0.2s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    transition: transform 0.2s ease;
}

.peer:checked ~ .toggle-switch {
    background-color: var(--color-primary);
}

.peer:checked ~ .toggle-switch::after {
    transform: translateX(100%);
    background-color: var(--color-surface);
}

.peer:focus ~ .toggle-switch {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 25%, transparent);
}