/* ================================================
   ANIMATION CONTROLS - Floating Panel
   ProductiveApp v4.0
   Controles d'intensite et presets d'animation
   ================================================ */

/* --- Floating Action Button --- */
.anim-ctrl-fab {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.anim-ctrl-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    background: var(--bg-tertiary);
}

.anim-ctrl-fab svg {
    width: 22px;
    height: 22px;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.anim-ctrl-fab.panel-open svg {
    transform: rotate(180deg);
}

/* Subtle pulse animation on the FAB */
@keyframes animFabPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
    50% { box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 12px var(--accent-glow, rgba(99,102,241,0.3)); }
}

.anim-ctrl-fab:not(.panel-open) {
    animation: animFabPulse 3s ease-in-out infinite;
}

/* --- Panel --- */
.anim-ctrl-panel {
    position: fixed;
    bottom: 147px;
    right: 25px;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
    z-index: 9998;
    padding: 20px;
    opacity: 0;
    transform: translateY(12px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.anim-ctrl-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Panel title */
.anim-ctrl-panel-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.anim-ctrl-panel-title svg {
    width: 14px;
    height: 14px;
}

/* --- Preset Selector Row --- */
.anim-presets-row {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
}

.anim-preset-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 2px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.2;
}

.anim-preset-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(255,255,255,0.03);
}

.anim-preset-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 8px var(--accent-glow, rgba(99,102,241,0.2));
}

.anim-preset-icon {
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.anim-preset-btn:hover .anim-preset-icon {
    transform: scale(1.15);
}

.anim-preset-btn.active .anim-preset-icon {
    transform: scale(1.1);
}

/* --- Intensity Slider --- */
.anim-slider-group {
    margin-bottom: 14px;
}

.anim-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.anim-slider-value {
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: right;
}

.anim-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    transition: background 0.2s;
}

.anim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 2px solid var(--bg-secondary);
}

.anim-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(0,0,0,0.4), 0 0 8px var(--accent-glow, rgba(99,102,241,0.3));
}

.anim-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Slider track fill (webkit) */
.anim-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
}

/* --- Preview & Action Buttons --- */
.anim-ctrl-actions {
    display: flex;
    gap: 8px;
}

.anim-preview-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.anim-preview-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255,255,255,0.02);
}

.anim-preview-btn:active {
    transform: scale(0.97);
}

/* --- Divider --- */
.anim-ctrl-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
    opacity: 0.5;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .anim-ctrl-fab {
        animation: none !important;
    }
    .anim-ctrl-panel {
        transition: none !important;
    }
    .anim-preset-btn,
    .anim-preset-icon {
        transition: none !important;
    }
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .anim-ctrl-fab {
        bottom: 90px;
        right: 16px;
        width: 40px;
        height: 40px;
    }

    .anim-ctrl-fab svg {
        width: 20px;
        height: 20px;
    }

    .anim-ctrl-panel {
        right: 16px;
        bottom: 140px;
        width: calc(100vw - 32px);
        max-width: 300px;
    }
}

/* --- Hide when not logged in --- */
body:not(.logged-in) .anim-ctrl-fab,
body:not(.logged-in) .anim-ctrl-panel {
    display: none !important;
}
