/* ============================================
   OUDIFY — Tuner Page Styles
   ============================================ */

.tuner-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Tuning Preset Bar --- */
.tuner-preset-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-3) 0;
}

.tuner-preset-bar__label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* --- Mic Selector Bar --- */
.tuner-mic-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) 0;
}

.tuner-mic-bar select {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-mono);
    cursor: pointer;
}

/* --- Gauge Container --- */
.tuner-gauge-container {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Outer glass ring */
.tuner-gauge-ring {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* SVG gauge lives here */
.tuner-gauge-svg {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
}

/* Center info overlay */
.tuner-gauge-info {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    pointer-events: none;
}

.tuner-gauge-info__perde {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 500;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1;
}

.tuner-gauge-info__western {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: 2px;
}

.tuner-gauge-info__freq {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-top: var(--space-2);
}

.tuner-gauge-info__cents {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: 500;
    margin-top: var(--space-1);
}

.tuner-gauge-info__cents.in-tune {
    color: var(--success);
}

.tuner-gauge-info__cents.sharp {
    color: var(--warning);
}

.tuner-gauge-info__cents.flat {
    color: var(--danger);
}

.tuner-gauge-info__status {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: var(--space-1);
}

.tuner-gauge-info__status.in-tune {
    color: var(--success);
}

.tuner-gauge-info__status.sharp {
    color: var(--warning);
}

.tuner-gauge-info__status.flat {
    color: var(--danger);
}

/* Glow ring when actively listening */
.tuner-gauge-container.listening .tuner-gauge-ring {
    border-color: var(--border-glass-accent);
    animation: glowPulse 2s ease-in-out infinite;
}

/* In-tune celebration glow — multi-layer premium effect */
.tuner-gauge-container.in-tune .tuner-gauge-ring {
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow:
        /* Inner subtle glow */
        inset 0 0 30px rgba(74, 222, 128, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        /* Mid-range green radiance */
        0 0 30px rgba(74, 222, 128, 0.15),
        0 0 60px rgba(74, 222, 128, 0.08),
        /* Outer dramatic glow */
        0 0 100px rgba(74, 222, 128, 0.05),
        0 0 150px rgba(74, 222, 128, 0.03);
    animation: inTuneGlow 2s ease-in-out infinite;
}

/* Pulsing background aura */
.tuner-gauge-container.in-tune::before {
    content: '';
    position: absolute;
    inset: -40px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle at center,
            rgba(74, 222, 128, 0.06) 0%,
            rgba(74, 222, 128, 0.02) 40%,
            transparent 70%);
    animation: inTuneAura 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* Particle canvas overlay */
.tuner-particle-canvas {
    position: absolute;
    inset: -20px;
    z-index: 1;
    pointer-events: none;
    border-radius: var(--radius-full);
}

@keyframes inTuneGlow {

    0%,
    100% {
        box-shadow:
            inset 0 0 30px rgba(74, 222, 128, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            0 0 30px rgba(74, 222, 128, 0.15),
            0 0 60px rgba(74, 222, 128, 0.08),
            0 0 100px rgba(74, 222, 128, 0.05);
    }

    50% {
        box-shadow:
            inset 0 0 40px rgba(74, 222, 128, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 40px rgba(74, 222, 128, 0.25),
            0 0 80px rgba(74, 222, 128, 0.12),
            0 0 120px rgba(74, 222, 128, 0.08);
    }
}

@keyframes inTuneAura {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.03);
    }
}

/* --- String Selector Area --- */
.tuner-strings {
    width: 100%;
    text-align: center;
}

.tuner-strings__label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-3);
}

/* --- Mode Switcher Area --- */
.tuner-modes {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* --- Rolling Pitch Deviation Graph --- */
.tuner-graph {
    width: 100%;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
}

.tuner-graph__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.tuner-graph__label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tuner-graph__unit {
    font-size: 10px;
    color: var(--text-muted);
}

.tuner-graph__body {
    position: relative;
}

.tuner-graph__body canvas {
    display: block;
    width: 100%;
    height: 120px;
    border-radius: var(--radius-sm);
}

.tuner-graph__y-axis {
    position: absolute;
    top: 0;
    right: var(--space-2);
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.tuner-graph__y-axis span {
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-muted);
    line-height: 1;
}

/* --- Start/Stop Button --- */
.tuner-toggle {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-gold));
    color: #0a0a0f;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(212, 165, 116, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all var(--transition-base);
    border: none;
    cursor: pointer;
}

.tuner-toggle:hover {
    transform: scale(1.05);
    box-shadow:
        0 6px 28px rgba(212, 165, 116, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tuner-toggle:active {
    transform: scale(0.95);
}

.tuner-toggle__icon {
    width: 28px;
    height: 28px;
}

.tuner-toggle.active {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    box-shadow:
        0 4px 20px rgba(248, 113, 113, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .tuner-gauge-container {
        width: 280px;
        height: 280px;
    }

    .tuner-gauge-info__perde {
        font-size: var(--text-3xl);
    }

    .string-btn {
        width: 48px;
        height: 48px;
        font-size: var(--text-xs);
    }

    .tuner-page {
        gap: var(--space-4);
    }
}

@media (max-width: 380px) {
    .tuner-gauge-container {
        width: 240px;
        height: 240px;
    }
}

/* --- Maqam Selector (tuner) --- */
.tuner-maqam-selector {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

.tuner-maqam-select {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-family: var(--font-display);
    font-style: italic;
}

.tuner-maqam-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* --- Reference Tone Indicator --- */
.tuner-ref-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: rgba(74, 222, 128, 0.06);
    border: 1px solid rgba(74, 222, 128, 0.15);
    border-radius: var(--radius-md);
    animation: refPulse 2s ease-in-out infinite;
}

.tuner-ref-indicator__icon {
    font-size: var(--text-lg);
}

.tuner-ref-indicator__text {
    font-size: var(--text-xs);
    color: var(--success);
    font-weight: 500;
}

@keyframes refPulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}