/* ============================================================
   Movi Player — Equalizer UI Styles
   File: styles/eq.css
   
   Accent: #00d4ff (cyan/teal cinema glow)
   Theme:  Glassmorphism dark mode
   ============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES (EQ-scoped tokens)
   ============================================================ */
:root {
    --eq-accent:        #00d4ff;
    --eq-accent-dim:    rgba(0, 212, 255, 0.18);
    --eq-accent-glow:   rgba(0, 212, 255, 0.45);
    --eq-accent-text:   #00d4ff;
    --eq-bg:            rgba(10, 12, 18, 0.92);
    --eq-surface:       rgba(255, 255, 255, 0.04);
    --eq-border:        rgba(0, 212, 255, 0.18);
    --eq-border-subtle: rgba(255, 255, 255, 0.07);
    --eq-text:          #e5e7eb;
    --eq-text-dim:      #6b7280;
    --eq-radius:        18px;
    --eq-slider-h:      180px;
    --eq-transition:    0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Remove mobile blue tap highlight & focus outline on EQ elements */
.eq-modal *,
.eq-btn-topleft {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none;
    user-select: none;
}

.eq-modal *:focus,
.eq-modal *:focus-visible,
.eq-modal *:active {
    outline: none !important;
    -webkit-focus-ring-color: transparent !important;
}

/* ============================================================
   TOP-LEFT EQ BUTTON
   ============================================================ */
.eq-btn-topleft {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 220;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #c9d1db;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        color        0.2s ease,
        background   0.2s ease,
        border-color 0.2s ease,
        box-shadow   0.2s ease,
        transform    0.15s ease;
    opacity: 0;           /* hidden until controls are visible */
    pointer-events: none;
}

/* Button is shown/hidden by JS (MutationObserver on #custom-controls).
   Only override: force visible when the EQ panel is open. */

.eq-btn-active,
.eq-btn-topleft.eq-btn-active {
    opacity: 1 !important;
    pointer-events: auto !important;
    color: var(--eq-accent) !important;
    background: rgba(0, 212, 255, 0.12) !important;
    border-color: var(--eq-accent) !important;
    box-shadow: 0 0 16px var(--eq-accent-glow), inset 0 0 8px rgba(0, 212, 255, 0.08) !important;
}

.eq-btn-topleft:hover {
    color: #fff;
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--eq-accent);
    box-shadow: 0 0 12px var(--eq-accent-glow);
    transform: scale(1.05);
}

.eq-btn-topleft:active {
    transform: scale(0.94);
}

.eq-btn-topleft svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ============================================================
   EQ PANEL — Full-viewport bottom sheet
   ============================================================ */
#eq-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;

    /* Slide-up animation */
    transform: translateY(100%);
    transition: transform var(--eq-transition);
    will-change: transform;

    /* Glassmorphism */
    background: var(--eq-bg);
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);

    border-top: 1px solid var(--eq-border);
    border-radius: var(--eq-radius) var(--eq-radius) 0 0;
    box-shadow:
        0 -8px 48px rgba(0, 0, 0, 0.7),
        0 -2px 0 var(--eq-border),
        0 0 80px rgba(0, 212, 255, 0.06);

    /* Prevent touch-action interference */
    touch-action: none;
}

#eq-panel.open {
    transform: translateY(0);
}

/* Drag handle notch */
#eq-panel::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    margin: 10px auto 0;
}

/* ============================================================
   PANEL INNER WRAPPER
   ============================================================ */
.eq-panel-inner {
    padding: 0 20px 20px;
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================================
   PANEL HEADER
   ============================================================ */
.eq-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 14px;
    border-bottom: 1px solid var(--eq-border-subtle);
    gap: 12px;
    flex-wrap: wrap;
}

.eq-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.eq-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- EQ Title --- */
.eq-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--eq-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.eq-title-icon {
    width: 22px;
    height: 22px;
    fill: var(--eq-accent);
    filter: drop-shadow(0 0 6px var(--eq-accent-glow));
    flex-shrink: 0;
}

/* --- Preset dropdown wrapper --- */
.eq-preset-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.eq-preset-wrap::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--eq-text-dim);
    pointer-events: none;
}

.eq-preset-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--eq-border-subtle);
    border-radius: 8px;
    color: var(--eq-text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 7px 30px 7px 11px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    min-width: 140px;
}

.eq-preset-select:hover {
    border-color: var(--eq-accent);
    background: rgba(0, 212, 255, 0.08);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.eq-preset-select:focus {
    border-color: var(--eq-accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.25);
}

.eq-preset-select option {
    background: #111318;
    color: #e5e7eb;
}

/* --- Reset button --- */
.eq-reset-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--eq-border-subtle);
    border-radius: 8px;
    color: var(--eq-text-dim);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 7px 12px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.eq-reset-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

.eq-reset-btn:hover {
    color: var(--eq-accent);
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--eq-accent);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.eq-reset-btn:active {
    transform: scale(0.95);
}

/* --- Close button --- */
.eq-close-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--eq-border-subtle);
    border-radius: 8px;
    color: var(--eq-text-dim);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    padding: 0;
}

.eq-close-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.eq-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ============================================================
   SLIDERS ROW
   ============================================================ */
.eq-sliders-row {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 8px;
    padding: 24px 0 20px;
}

/* ============================================================
   INDIVIDUAL BAND COLUMN
   ============================================================ */
.eq-slider-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* --- dB Readout --- */
.eq-db-readout {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--eq-text-dim);
    min-height: 18px;
    text-align: center;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.eq-db-readout.eq-db-positive {
    color: var(--eq-accent);
    text-shadow: 0 0 8px var(--eq-accent-glow);
}

.eq-db-readout.eq-db-negative {
    color: #f87171;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}

.eq-db-readout.eq-db-zero {
    color: var(--eq-text-dim);
    text-shadow: none;
}

/* --- Slider track wrapper --- */
.eq-slider-track-wrap {
    position: relative;
    width: 36px;
    height: var(--eq-slider-h);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fill bars (top = negative dB fill, bottom = positive dB fill) */
.eq-slider-fill-top,
.eq-slider-fill-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    border-radius: 2px;
    transition: height 0.1s ease;
    pointer-events: none;
}

.eq-slider-fill-top {
    top: 0;
    height: 0%;
    background: linear-gradient(to bottom, rgba(248, 113, 113, 0.6), rgba(248, 113, 113, 0.2));
    transform-origin: top;
}

.eq-slider-fill-bottom {
    bottom: 0;
    height: 0%;
    background: linear-gradient(to top, var(--eq-accent), rgba(0, 212, 255, 0.3));
    transform-origin: bottom;
}

/* Center line (0 dB marker) */
.eq-slider-center-line {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   VERTICAL RANGE SLIDER
   ============================================================ */
.eq-slider {
    /* Size and orientation */
    writing-mode: vertical-lr;
    direction: rtl;
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;

    width: 36px;
    height: var(--eq-slider-h);
    cursor: ns-resize;

    /* Track base */
    background: transparent;
    outline: none;
    border: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
}

/* --- WebKit Track --- */
.eq-slider::-webkit-slider-runnable-track {
    width: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border: none;
}

/* --- WebKit Thumb --- */
.eq-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #ffffff, var(--eq-accent));
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 3px var(--eq-accent-dim),
        0 0 14px var(--eq-accent-glow),
        0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: ns-resize;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    margin-top: -8px; /* center on track */
}

.eq-slider::-webkit-slider-thumb:hover {
    box-shadow:
        0 0 0 5px rgba(0, 212, 255, 0.28),
        0 0 24px var(--eq-accent-glow),
        0 2px 12px rgba(0, 0, 0, 0.6);
    transform: scale(1.15);
}

.eq-slider:active::-webkit-slider-thumb {
    box-shadow:
        0 0 0 7px rgba(0, 212, 255, 0.2),
        0 0 32px rgba(0, 212, 255, 0.8);
    transform: scale(1.25);
}

/* --- Firefox Track --- */
.eq-slider::-moz-range-track {
    width: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border: none;
}

/* --- Firefox Thumb --- */
.eq-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #ffffff, var(--eq-accent));
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 3px var(--eq-accent-dim),
        0 0 14px var(--eq-accent-glow),
        0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: ns-resize;
    transition: box-shadow 0.2s ease;
}

.eq-slider::-moz-range-thumb:hover {
    box-shadow:
        0 0 0 5px rgba(0, 212, 255, 0.28),
        0 0 24px var(--eq-accent-glow);
}

/* ============================================================
   FREQUENCY / SUB LABELS
   ============================================================ */
.eq-freq-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--eq-text);
    text-align: center;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.eq-sublabel {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--eq-text-dim);
    text-align: center;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ============================================================
   PANEL FOOTER HINT
   ============================================================ */
.eq-footer {
    padding-top: 10px;
    border-top: 1px solid var(--eq-border-subtle);
    text-align: center;
}

.eq-footer-hint {
    font-size: 0.7rem;
    color: var(--eq-text-dim);
    letter-spacing: 0.02em;
    opacity: 0.7;
}

/* ============================================================
   BODY SCROLL LOCK when panel is open
   ============================================================ */
body.eq-panel-open {
    overflow: hidden;
}

/* ============================================================
   SCROLLBAR styling for eq panel (if content overflows)
   ============================================================ */
#eq-panel::-webkit-scrollbar {
    width: 4px;
}
#eq-panel::-webkit-scrollbar-track {
    background: transparent;
}
#eq-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 600px) {
    :root {
        --eq-slider-h: 140px;
    }

    .eq-panel-inner {
        padding: 0 12px 16px;
    }

    .eq-panel-header {
        padding: 14px 0 12px;
        gap: 8px;
    }

    .eq-title {
        font-size: 0.82rem;
        gap: 5px;
    }

    .eq-title-icon {
        width: 18px;
        height: 18px;
    }

    .eq-preset-select {
        font-size: 0.74rem;
        min-width: 110px;
        padding: 6px 26px 6px 9px;
    }

    .eq-reset-btn {
        font-size: 0.72rem;
        padding: 6px 9px;
    }

    .eq-reset-btn svg {
        width: 12px;
        height: 12px;
    }

    .eq-sliders-row {
        gap: 4px;
        padding: 18px 0 14px;
    }

    .eq-slider-track-wrap {
        width: 28px;
    }

    .eq-slider {
        width: 28px;
    }

    .eq-slider::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }

    .eq-freq-label {
        font-size: 0.65rem;
    }

    .eq-sublabel {
        font-size: 0.58rem;
    }

    .eq-db-readout {
        font-size: 0.65rem;
    }
}

@media (max-width: 380px) {
    :root {
        --eq-slider-h: 110px;
    }

    .eq-sliders-row {
        gap: 2px;
    }

    .eq-sublabel {
        display: none;
    }
}

/* ============================================================
   SAFE AREA (notch / home indicator support for iOS)
   ============================================================ */
#eq-panel {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   ANIMATION — Entry glow pulse on open
   ============================================================ */
@keyframes eq-panel-glow {
    0%   { box-shadow: 0 -8px 48px rgba(0,0,0,0.7), 0 0 0 rgba(0,212,255,0); }
    50%  { box-shadow: 0 -8px 48px rgba(0,0,0,0.7), 0 -2px 40px rgba(0,212,255,0.15); }
    100% { box-shadow: 0 -8px 48px rgba(0,0,0,0.7), 0 -2px 0 var(--eq-border), 0 0 80px rgba(0,212,255,0.06); }
}

#eq-panel.open {
    animation: eq-panel-glow 0.5s ease forwards;
}
