/* ================================================================
   AlphaTab Preview Player — Styles Yooplay
   Préfixe : .yp-at- (player) / .yp-popup- (popups)
   ================================================================ */

/* --- Wrapper principal --- */
.yp-at-wrap {
    width: 100%;
    max-height: 680px;
    display: flex;
    flex-direction: column;
    /* overflow visible pour laisser le dropdown dépasser le wrapper */
    position: relative;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0, 0, 0, .14);
    margin-bottom: 20px;
}

/* --- Toolbar --- */
.yp-at-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    background: #2e0431;
    min-height: 48px;
    padding: 0 14px;
    gap: 10px;
    z-index: 10;
    flex-wrap: wrap;
    border-radius: 6px 6px 0 0;
}

/* Bouton Play/Pause */
.yp-at-playbtn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5);
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
}
.yp-at-playbtn:hover:not(:disabled) {
    border-color: #fff;
    background: rgba(255, 255, 255, .12);
}
.yp-at-playbtn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* Temps */
.yp-at-time {
    color: rgba(255, 255, 255, .85);
    font-size: 12px;
    font-weight: 500;
    min-width: 85px;
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
}

/* Barre de progression */
.yp-at-progress {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, .2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    min-width: 60px;
}
.yp-at-progress-fill {
    height: 100%;
    background: #bc4195;
    border-radius: 2px;
    width: 0%;
    pointer-events: none;
    transition: width .1s linear;
}

/* Contrôles (vitesse + mode) */
.yp-at-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative; /* ancre pour le dropdown */
}

.yp-at-speed {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}
.yp-at-speed button {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
}
.yp-at-speed button:hover:not(:disabled) {
    background: rgba(255, 255, 255, .22);
}
.yp-at-speed button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* Bouton recording intégré dans le toggle (remplace le bouton YouTube/Vidéo plat) */
.yp-rec-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}
.yp-rec-toggle-btn .yp-rec-caret {
    opacity: .6;
    transition: transform .15s;
    flex-shrink: 0;
}
.yp-rec-toggle-btn[aria-expanded="true"] .yp-rec-caret {
    transform: rotate(180deg);
}

/* Dropdown recordings (positionné sous .yp-at-controls) */
.yp-rec-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #1e1e2e;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
    z-index: 200;
}
.yp-rec-dropdown.open {
    display: block;
}
.yp-rec-dropdown-label {
    padding: 4px 12px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.4);
}
.yp-rec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.75);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: background .1s, color .1s;
}
.yp-rec-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}
.yp-rec-item.active {
    color: #bc4195;
    font-weight: 600;
}
.yp-rec-item.active::after {
    content: '✓';
    margin-left: auto;
    font-size: 11px;
}

/* Toggle plat de sélection de mode */
.yp-at-toggle {
    display: flex;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 6px;
    overflow: hidden;
}
.yp-at-toggle button {
    background: transparent;
    color: rgba(255, 255, 255, .55);
    border: none;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background .1s, color .1s;
}
.yp-at-toggle button.active {
    background: #bc4195;
    color: #fff;
}
.yp-at-toggle button:hover:not(:disabled):not(.active) {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.yp-at-toggle button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* Contrôles grisés (visiteur) */
.yp-controls-locked .yp-at-speed button,
.yp-controls-locked .yp-at-toggle button {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}
.yp-controls-locked .yp-locked-btn {
    cursor: pointer;
    pointer-events: auto;
    position: relative;
}
.yp-controls-locked .yp-locked-btn::after {
    content: '🔒';
    font-size: 10px;
    position: absolute;
    top: -6px;
    right: -6px;
}

/* Bloc verrouillé avec overlay cliquable */
.yp-locked-block {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.yp-locked-block > * {
    pointer-events: none;
    opacity: .4;
}
.yp-locked-cover {
    position: absolute;
    inset: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    background: rgba(0,0,0,.04);
    pointer-events: auto !important;
    opacity: 1 !important;
    transition: background .15s;
}
.yp-locked-cover:hover {
    background: rgba(0,0,0,.1);
}
/* Le select container locked doit être block */
.yp-at-display-settings.yp-locked-block {
    display: flex;
}

/* Bouton Recommencer dans la paywall */
.yp-paywall-restart {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    padding: 9px 16px;
    background: transparent;
    border: 1.5px solid #bc4195;
    color: #bc4195;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.yp-paywall-restart:hover {
    background: #bc4195;
    color: #fff;
}

/* --- Corps --- */
.yp-at-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fff;
    min-height: 400px;
    border-radius: 0 0 6px 6px;
}

/* Container de la zone lecteur (doit utiliser flex) */
.yp-at-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fff;
}

/* Le Panel Vidéo */
.yp-video-panel {
    flex: 0 0 420px;
    background: #000;
    display: none;
    border-right: 1px solid #222;
    align-items: flex-start;
}

/* Appliqué en JS quand le mode "video" ou "youtube" est actif */
.yp-video-panel.on {
    display: flex;
}

.yp-video-panel video, 
.yp-video-panel iframe {
    width: 100%;
    object-fit: contain;
}

/* Tablature */
.yp-at-content {
    position: relative;
    flex: 1;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 700px) {
    .yp-at-body {
        flex-direction: column;
    }
    .yp-video-panel {
        flex: 0 0 200px;
        border-right: none;
        border-bottom: 1px solid #222;
    }
}

.yp-at-content {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.yp-at-viewport {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    background: #fff;
}

/* Curseurs AlphaTab */
.at-cursor-bar  { background: rgba(188, 65, 149, .10); }
.at-cursor-beat { background: #bc4195; width: 3px; }

/* --- Spinner de chargement --- */
.yp-at-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .92);
    display: flex;
    justify-content: center;
    align-items: center;
}
.yp-at-overlay.hidden {
    display: none;
}
.yp-spin {
    width: 32px;
    height: 32px;
    border: 3px solid #f0e0f7;
    border-top-color: #bc4195;
    border-radius: 50%;
    animation: yp-spin .8s linear infinite;
}
@keyframes yp-spin {
    to { transform: rotate(360deg); }
}

/* --- Paywall visiteur (fond dégradé + carte) --- */
.yp-at-paywall {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 20;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .98) 55%);
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 32px;
}
.yp-at-paywall.on {
    display: flex;
}
.yp-paywall-card {
    background: #fff;
    border: 1px solid #f0e0f7;
    border-radius: 12px;
    padding: 22px 28px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .1);
    max-width: 340px;
}
.yp-paywall-title {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1a1a1a;
}
.yp-paywall-sub {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: #555;
    margin: 0 0 14px;
}

/* --- CTA bouton partagé --- */
.yp-cta-btn {
    display: inline-block;
    background: #bc4195;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    margin-top: 10px;
    transition: background .15s;
}
.yp-cta-btn:hover {
    background: #a3357f;
    color: #fff;
    text-decoration: none;
}

/* --- Popup overlay (visiteur & premium) --- */
.yp-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.yp-popup-card {
    background: #fff;
    border-radius: 14px;
    padding: 28px 32px;
    max-width: 420px;
    width: 100%;
    position: relative;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .22);
    font-family: 'Poppins', sans-serif;
}
.yp-popup-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px;
}
.yp-popup-card p {
    font-size: 13px;
    color: #444;
    margin: 0 0 10px;
}
.yp-popup-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #888;
}
.yp-popup-close:hover {
    color: #222;
}
.yp-popup-features {
    list-style: none;
    padding: 0;
    margin: 8px 0 12px;
    font-size: 13px;
    color: #333;
}
.yp-popup-features li {
    padding: 3px 0;
}
.yp-popup-levels {
    font-size: 13px;
    font-style: italic;
    color: #bc4195;
    margin: 6px 0 10px;
}

/* --- Onglet Preview dans la barre de navigation --- */
.titre-onglet-preview {
    background: #bc4195 !important;
    color: #fff !important;
    font-weight: 700;
}
.titre-onglet-preview.selected {
    background: #a3357f !important;
    color: #fff !important;
}

/* --- Onglets SoundSlice verrouillés --- */
.titre-onglet-locked {
    opacity: .55;
    cursor: pointer !important;
    position: relative;
}
.titre-onglet-locked .yp-lock-icon {
    font-size: 11px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Mobile --- */
@media (max-width: 640px) {
    .yp-at-header {
        gap: 8px;
        padding: 8px 10px;
    }
    .yp-at-toggle button {
        padding: 5px 7px;
        font-size: 10px;
    }
    .yp-at-wrap {
        max-height: 520px;
    }
    .yp-at-body {
        min-height: 280px;
    }
    .yp-popup-card {
        padding: 20px 18px;
    }
}


/* --- Bouton Loop --- */
.yp-at-loop-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-right: 8px;
}
.yp-at-loop-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.yp-at-loop-btn.active {
    color: #fff;
    background: #bc4195; /* Couleur de la marque */
    box-shadow: 0 0 5px rgba(188, 65, 149, 0.5);
}

/* --- Input Vitesse façon ancienne version --- */
.yp-speed-input {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 22px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    -moz-appearance: textfield; /* Retire les flèches Firefox */
}
.yp-speed-input::-webkit-outer-spin-button,
.yp-speed-input::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Retire les flèches Chrome */
    margin: 0;
}
.yp-speed-input:focus {
    outline: 1px solid #bc4195;
    background: rgba(0,0,0, 0.5);
}
.yp-speed-percent {
    margin-left: -2px;
}

/* --- Barre de progression pleine largeur (en bas du header) --- */
.yp-at-progress-wrapper {
    width: 100%;
    height: 26px; /* Même hauteur que l'ancienne */
    background-color: #e5e5e5;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.yp-at-progress-wrapper .yp-at-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #f3a42c; /* Le orange de ton ancienne version */
    width: 0%;
    pointer-events: none;
}

.yp-at-wrap .yp-at-progress-wrapper .yp-at-sections {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: none; /* Laisse le clic passer à travers pour la timeline */
}

.yp-at-wrap .yp-at-progress-wrapper .yp-at-sections .yp-section-marker {
    position: absolute;
    height: 100%;
    border-left: 2px solid #fff;
    border-right: 2px solid #fff;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(51, 0, 51);
    font-weight: bold;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yp-section-marker:first-child { border-left: none; }
.yp-section-marker:last-child { border-right: none; }

/* Retire l'ancienne barre .yp-at-progress si elle traîne encore dans le CSS (ou garde-la pour compatibilité) */

/* --- Sélecteurs d'affichage dans la barre de contrôle (stave / zoom / layout) --- */
.yp-at-display-settings {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.yp-at-display-settings select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0.5 0.5l3.5 4 3.5-4' stroke='rgba(255,255,255,0.7)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 5px;
    color: rgba(255,255,255,.85);
    font-size: 11px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    padding: 4px 24px 4px 9px;
    cursor: pointer;
    outline: none;
    height: 28px;
    transition: border-color .15s, background .15s;
}

.yp-at-display-settings select:hover {
    background-color: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.5);
    color: #fff;
}

.yp-at-display-settings select:focus {
    border-color: #bc4195;
    background-color: rgba(188,65,149,.2);
}

.yp-at-display-settings select option {
    background: #2e0431;
    color: #fff;
}