/* ============================================
   FINGERBOARD PAGE
   Interactive oud fingerboard with SVG
   ============================================ */

.fingerboard-page {
    padding: var(--space-6);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.fingerboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.fingerboard-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
}

.fingerboard-subtitle {
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

/* --- Controls --- */
.fingerboard-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.fingerboard-control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.fingerboard-toggles {
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
}

.control-label {
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Düzen switcher */
.duzen-switcher {
    display: flex;
    gap: var(--space-1);
}

.duzen-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.duzen-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.duzen-btn--active {
    background: rgba(212, 165, 116, 0.15);
    border-color: var(--border-glass-accent);
    color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Makam searchable dropdown */
.makam-search-dropdown {
    position: relative;
    min-width: 200px;
}

.makam-search-input {
    width: 100%;
    padding: var(--space-2) var(--space-4);
    padding-right: 28px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.makam-search-input:focus {
    border-color: var(--accent-primary);
}

.makam-search-input::placeholder {
    color: var(--text-muted);
}

.makam-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    z-index: 2;
}

.makam-search-clear:hover {
    color: var(--text-primary);
}

.makam-search-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(20, 20, 30, 0.96);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.makam-search-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.makam-search-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.makam-search-item.active {
    background: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.2);
    color: var(--accent-primary);
}

.makam-family-tag {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-left: 8px;
    white-space: nowrap;
}

/* Info box */
.fingerboard-info-box {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    min-width: 200px;
    min-height: 36px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.info-placeholder {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-style: italic;
}

.info-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.info-perde-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--accent-primary);
}

.info-detail {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* --- SVG Canvas --- */
.fingerboard-canvas-wrap {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-x: auto;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin-bottom: var(--space-4);
}

.fingerboard-canvas {
    min-width: 900px;
}

.fingerboard-svg {
    width: 100%;
    height: auto;
}

/* Perde dots */
.perde-dot {
    cursor: pointer;
    transition: r 0.15s ease, opacity 0.15s ease, fill 0.15s ease;
}

.perde-dot--open {
    stroke-width: 2;
}

.perde-dot--normal {
    /* Do not override inline SVG fill — let white circles show through */
}

.perde-dot--normal:hover {
    filter: url(#glow);
    r: 14;
}

.perde-dot--maqam {
    /* Do not override inline fill — let SVG attributes control */
    stroke-width: 1.5;
}

.perde-dot--maqam:hover {
    filter: url(#glow);
    r: 14;
}

.perde-dot--dim {
    opacity: 0.3;
}

.perde-dot--playing-active {
    fill: var(--success) !important;
    stroke: var(--success) !important;
    stroke-width: 2 !important;
    filter: url(#glow);
}

/* Seyir animation */
.perde-dot--seyir-active {
    fill: var(--accent-primary) !important;
    stroke: var(--accent-gold-light) !important;
    stroke-width: 2.5 !important;
    filter: url(#seyir-glow);
}

.seyir-trail {
    pointer-events: none;
}

/* Mizrap string vibration animation */
@keyframes tel-wiggle {
    0% {
        transform: translateY(0);
    }

    5% {
        transform: translateY(-3px);
    }

    10% {
        transform: translateY(3px);
    }

    15% {
        transform: translateY(-2.5px);
    }

    20% {
        transform: translateY(2.5px);
    }

    25% {
        transform: translateY(-2px);
    }

    30% {
        transform: translateY(2px);
    }

    35% {
        transform: translateY(-1.5px);
    }

    40% {
        transform: translateY(1.5px);
    }

    50% {
        transform: translateY(-1px);
    }

    60% {
        transform: translateY(1px);
    }

    70% {
        transform: translateY(-0.5px);
    }

    80% {
        transform: translateY(0.5px);
    }

    90% {
        transform: translateY(-0.2px);
    }

    100% {
        transform: translateY(0);
    }
}

.tel-vibrating {
    animation: tel-wiggle 0.6s ease-out;
    filter: drop-shadow(0 0 4px rgba(212, 165, 116, 0.6));
}

/* Variant perde wobble — indicates flexible pitch position */
@keyframes variant-wobble {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

.perde-variant-dot {
    animation: variant-wobble 2s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(255, 170, 50, 0.5));
}

.seyir-head {
    pointer-events: none;
    transition: cx 0.3s ease-out, cy 0.3s ease-out;
}

/* Position zones */
.position-zone {
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.position-label {
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Arabic comparison markers */
.arabic-fret-line {
    pointer-events: none;
}

.arabic-label {
    pointer-events: none;
    font-family: var(--font-mono);
}

/* --- Legend --- */
.fingerboard-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
}

.legend-dot--open {
    background: var(--accent-primary);
}

.legend-dot--normal {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.legend-dot--maqam {
    background: rgba(212, 165, 116, 0.3);
    border: 1px solid var(--accent-primary);
}

.legend-dot--playing {
    background: var(--success);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.legend-divider {
    width: 1px;
    height: 20px;
    background: var(--border-glass);
}

/* --- Comparison Section --- */
.comparison-section {
    margin-top: var(--space-4);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
}

.comparison-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.comparison-subtitle {
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.comparison-table-wrap {
    overflow-x: auto;
    margin-bottom: var(--space-4);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    font-family: var(--font-mono);
}

.comparison-table th,
.comparison-table td {
    padding: var(--space-2) var(--space-3);
    text-align: center;
    border: 1px solid var(--border-glass);
}

.comparison-table th {
    background: var(--bg-glass);
    color: var(--text-muted);
    font-weight: 500;
    font-size: var(--text-xs);
}

.row-turkish td {
    background: rgba(212, 165, 116, 0.05);
}

.row-arabic td {
    background: rgba(248, 113, 113, 0.05);
}

.system-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tag--accent {
    background: rgba(212, 165, 116, 0.15);
    color: var(--accent-primary);
}

.tag--danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.comparison-note {
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-glass);
    line-height: var(--leading-relaxed);
}

/* --- Fingerboard Makam Detail Panel --- */
.fingerboard-makam-detail {
    margin-bottom: var(--space-4);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
}

.fmd-header {
    margin-bottom: var(--space-5);
}

.fmd-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.fmd-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
}

.fmd-arabic {
    font-size: var(--text-lg);
    color: var(--text-muted);
    margin-left: var(--space-2);
}

.fmd-character {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-3);
    font-style: italic;
}

.fmd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    font-size: var(--text-sm);
}

.fmd-meta-item {
    color: var(--text-secondary);
}

.fmd-section {
    margin-bottom: var(--space-4);
}

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

.fmd-section-title {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.fmd-section-header .fmd-section-title {
    margin-bottom: 0;
}

.fmd-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 768px) {
    .fmd-row {
        grid-template-columns: 1fr;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .fingerboard-page {
        padding: var(--space-4);
    }

    .fingerboard-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .fingerboard-toggles {
        flex-wrap: wrap;
    }

    .fingerboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .fingerboard-title {
        font-size: var(--text-2xl);
    }
}

/* --- Perde Labels Inside Circles --- */
.perde-label-inner {
    font-family: var(--font-body);
    letter-spacing: -0.02em;
    user-select: none;
}

/* --- Perde Reference Table --- */
.perde-table-section {
    margin-top: var(--space-4);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.perde-table-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.perde-table-subtitle {
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.perde-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.perde-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-xs);
    white-space: nowrap;
}

.perde-table th,
.perde-table td {
    padding: var(--space-1) var(--space-2);
    text-align: center;
    border: 1px solid var(--border-glass);
}

.perde-table th {
    background: var(--bg-glass);
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-mono);
    font-size: 10px;
    position: sticky;
    top: 0;
}

.perde-table-tel {
    text-align: left !important;
    font-size: 11px;
    white-space: nowrap;
    padding-left: var(--space-3) !important;
    padding-right: var(--space-3) !important;
    position: sticky;
    left: 0;
    background: var(--bg-primary);
    z-index: 1;
}

.perde-table-cell {
    font-size: 10px;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

.perde-table-cell:hover {
    background: rgba(212, 165, 116, 0.1);
    color: var(--text-primary);
}

.perde-table-cell--open {
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.05);
}