/* ============================================
   rigolospam - Scenario Player Frontend Styles
   ============================================ */

/* Conteneur principal - fond sombre */
.rigolospam-scenario-player {
    max-width: 900px;
    margin: 40px auto;
    padding: 0;
    background: #1a1a2e;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #2a2a4a;
}

/* Sélecteur de voix */
.rigolospam-scenario-player__voice-selector {
    padding: 24px 32px 0 32px;
}

.rigolospam-scenario-player__voice-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #a0a0c0;
    margin-bottom: 8px;
}

.rigolospam-scenario-player__voice-selector select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    background: #2d2d5e;
    color: #e0e0f0;
    border: 1px solid #3a3a6a;
    border-radius: 10px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a0a0c0' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.rigolospam-scenario-player__voice-selector select:hover {
    border-color: #7b7bff;
}

.rigolospam-scenario-player__voice-selector select:focus {
    outline: 2px solid #7b7bff;
    outline-offset: 2px;
}

.rigolospam-scenario-player__voice-selector select option {
    background: #2d2d5e;
    color: #e0e0f0;
    padding: 8px;
}

/* Musique de fond (cachée mais fonctionnelle) */
.rigolospam-scenario-player__music {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.rigolospam-scenario-player__music audio {
    display: none;
}

/* Contenu du scénario */
.rigolospam-scenario-player__content {
    background: transparent;
    padding: 24px 32px;
    font-size: 18px;
    line-height: 1.8;
    color: #e0e0f0;
    position: relative;
}

.rigolospam-scenario-player__content p {
    margin-bottom: 16px;
}

.rigolospam-scenario-player__content p:last-child {
    margin-bottom: 0;
}

/* Contrôles */
.rigolospam-scenario-player__controls {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 24px 32px;
    padding-top: 0;
    background: transparent;
}

.rsp-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    background: #2d2d5e;
    color: #7b7bff;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.rsp-button:hover {
    background: #3a3a7a;
    color: #9d9dff;
    box-shadow: 0 4px 12px rgba(123, 123, 255, 0.2);
    transform: translateY(-1px);
}

.rsp-button:focus {
    outline: 2px solid #7b7bff;
    outline-offset: 2px;
}

.rsp-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.rsp-stop {
    background: #3d1a1a;
    color: #ff4d4d;
}

.rsp-stop:hover {
    background: #5a2a2a;
    color: #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.2);
}

/* Indicateur de lecture en cours */
.rigolospam-scenario-player.is-playing {
    border-color: #7b7bff;
}

/* Erreur */
.rigolospam-error {
    background: #3d1a1a;
    border-left: 4px solid #ff4d4d;
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 8px;
    color: #ff6b6b;
    font-weight: 500;
}

/* Responsive mobile - lisibilité améliorée */
@media screen and (max-width: 782px) {
    .rigolospam-scenario-player {
        margin: 12px 8px;
        border-radius: 12px;
    }

    .rigolospam-scenario-player__voice-selector {
        padding: 16px 16px 0 16px;
    }

    .rigolospam-scenario-player__voice-selector label {
        font-size: 16px;
        color: #c0c0e0;
    }

    .rigolospam-scenario-player__voice-selector select {
        font-size: 17px;
        padding: 14px 18px;
        color: #ffffff;
        background: #2d2d5e;
    }

    .rigolospam-scenario-player__content {
        padding: 16px 14px;
        font-size: 19px;
        line-height: 1.8;
        color: #f0f0ff;
    }

    .rigolospam-scenario-player__controls {
        flex-direction: column;
        padding: 16px 14px;
        gap: 10px;
    }

    .rsp-button {
        width: 100%;
        justify-content: center;
        padding: 16px 24px;
        font-size: 17px;
        font-weight: 700;
    }

    /* Lignes du scénario */
    .rsp-line-item {
        flex-direction: column;
        gap: 12px;
        padding: 16px 14px;
        margin-bottom: 10px;
        background: rgba(45, 45, 94, 0.6);
        border: 1px solid #3a3a6a;
    }

    .rsp-line-item__text {
        font-size: 18px;
        line-height: 1.7;
        color: #ffffff;
    }

    .rsp-line-item__play {
        width: 100%;
        padding: 16px 20px;
        font-size: 17px;
        font-weight: 700;
        background: #2d2d5e;
        color: #a0a0ff;
        border: 2px solid #4a4a8a;
        border-radius: 10px;
        text-align: center;
    }

    .rsp-line-item__play:hover,
    .rsp-line-item__play:active {
        background: #3a3a7a;
        color: #c0c0ff;
        border-color: #7b7bff;
    }

    .rsp-line-item.is-playing .rsp-line-item__play {
        background: #7b7bff;
        color: #ffffff;
        border-color: #9d9dff;
    }

    /* Bouton Fin du scénario */
    .rigolospam-scenario-player__finish {
        padding: 0 14px 16px 14px;
    }

    .rsp-finish-scenario {
        padding: 18px 24px;
        font-size: 19px;
        font-weight: 800;
    }

    /* Toggle musique */
    .rigolospam-scenario-player__music-toggle {
        padding: 16px 16px;
        font-size: 16px;
    }

    .rsp-music-toggle {
        padding: 14px 18px;
        font-size: 16px;
        font-weight: 600;
    }
}

/* ============================================
  rsp-line-item - Chaque ligne avec bouton Lire
   ============================================ */

.rsp-line-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: rgba(45, 45, 94, 0.4);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.rsp-line-item:hover {
    background: rgba(45, 45, 94, 0.6);
    border-color: #3a3a6a;
}

.rsp-line-item.is-playing {
    background: rgba(123, 123, 255, 0.15);
    border-color: #7b7bff;
}

/* Surbrillance du bouton de lecture actif — bordure/lueur verte pour montrer où appuyer */
.rsp-btn--highlight {
    background: #2d2d5e !important;
    color: #00c896 !important;
    border-color: #00c896 !important;
    border-width: 2px !important;
    box-shadow: 0 0 16px rgba(0, 200, 150, 0.35);
    animation: rsp-btn-highlight-pulse 2s ease-in-out infinite;
}

.rsp-line-item--highlight .rsp-line-item__play {
    background: #2d2d5e !important;
    color: #00c896 !important;
    border-color: #00c896 !important;
    border-width: 2px !important;
    box-shadow: 0 0 16px rgba(0, 200, 150, 0.35);
    animation: rsp-btn-highlight-pulse 2s ease-in-out infinite;
}

@keyframes rsp-btn-highlight-pulse {
    0%, 100% {
        box-shadow: 0 0 16px rgba(0, 200, 150, 0.35);
    }
    50% {
        box-shadow: 0 0 24px rgba(0, 200, 150, 0.55);
    }
}

.rsp-line-item__text {
    flex: 1;
    font-size: 17px;
    line-height: 1.7;
    color: #e0e0f0;
}

.rsp-line-item__play {
    flex-shrink: 0;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: #2d2d5e;
    color: #7b7bff;
    border: 1px solid #3a3a6a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.rsp-line-item__play:hover {
    background: #3a3a7a;
    color: #9d9dff;
    border-color: #7b7bff;
    box-shadow: 0 2px 8px rgba(123, 123, 255, 0.2);
}

.rsp-line-item__play:active {
    transform: translateY(0);
}

.rsp-line-item.is-playing .rsp-line-item__play {
    background: #7b7bff;
    color: #1a1a2e;
    border-color: #7b7bff;
}

/* ============================================
  rsp-music-toggle - Toggle musique d'ambiance
   ============================================ */

.rigolospam-scenario-player__music-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
    background: transparent;
}

.rsp-music-toggle {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: #2d2d5e;
    color: #a0a0c0;
    border: 1px solid #3a3a6a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.rsp-music-toggle:hover {
    background: #3a3a7a;
    color: #7b7bff;
    border-color: #7b7bff;
}

.rsp-music-toggle.is-active {
    background: linear-gradient(135deg, #7b7bff, #5a5adf);
    color: #fff;
    border-color: #7b7bff;
    box-shadow: 0 2px 8px rgba(123, 123, 255, 0.3);
}

.rsp-music-toggle.is-active:hover {
    background: linear-gradient(135deg, #9d9dff, #7b7bff);
}

.rsp-music-toggle__hint {
    font-size: 13px;
    color: #8080a0;
    line-height: 1.4;
}

/* ============================================
   rigolospam-scenario-player__controls-bottom
    ============================================ */

.rigolospam-scenario-player__controls-bottom {
    padding: 0 32px 24px 32px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================
   rigolospam-scenario-player__volume - Slider de volume
    ============================================ */

.rigolospam-scenario-player__volume {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 100%;
    min-width: 150px;
    order: 1;
}

/* Force le slider a passer a la ligne en dessous sur les ecrans etroits */
@media (max-width: 600px) {
    .rigolospam-scenario-player__controls-bottom {
        flex-direction: column;
        align-items: stretch;
    }

    .rigolospam-scenario-player__volume {
        flex: 1 1 auto;
        order: 1;
    }

    .rigolospam-scenario-player__finish {
        flex: 0 0 auto;
        order: 2;
        width: 100%;
        margin-top: 12px;
    }
}

.rigolospam-scenario-player__volume label {
    font-size: 15px;
    font-weight: 600;
    color: #a0a0c0;
    white-space: nowrap;
    user-select: none;
}

.rsp-volume-slider {
    flex: 1;
    min-width: 100px;
    height: 4px;
    appearance: none;
    background: linear-gradient(90deg, rgba(74, 222, 128, 0.15) 0%, rgba(74, 222, 128, 0.15) 100%);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.1);
}

.rsp-volume-slider:hover {
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

.rsp-volume-slider:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15), 0 0 12px rgba(74, 222, 128, 0.2);
}

.rsp-volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.rsp-volume-slider::-webkit-slider-thumb:hover {
    background: #22c55e;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
}

.rsp-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.rsp-volume-slider::-moz-range-thumb:hover {
    background: #22c55e;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
}

.rsp-volume-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: transparent;
}

/* Cacher le slider uniquement sur iOS Safari */
/* Détection: sans hover + écran tactile (les devices iOS n'ont pas de hover) */
@media (hover: none) and (pointer: coarse) {
    .rigolospam-scenario-player__volume {
        display: none !important;
    }

    /* Forcer le style du bouton Lire sur iOS (supprimer le style natif Safari) */
    .rsp-line-item__play {
        -webkit-appearance: none;
        appearance: none;
        border: none;
        background: transparent;
        font-family: inherit;
        font-size: inherit;
        cursor: pointer;
    }
}

/* ============================================
   rsp-finish-scenario - Bouton Fin du scénario
    ============================================ */

.rigolospam-scenario-player__finish {
    padding: 0 32px 24px 32px;
    background: transparent;
    flex: 0 0 auto;
    order: 2;
}

.rsp-finish-scenario {
    width: 100%;
    padding: 16px 28px;
    font-size: 16px;
    font-weight: 700;
    /* background: linear-gradient(135deg, #ff4d4d, #cc0000); */
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.3);
}

.rsp-finish-scenario:hover {
    background: linear-gradient(135deg, #ff6b6b, #e60000);
    box-shadow: 0 6px 16px rgba(255, 77, 77, 0.4);
    transform: translateY(-2px);
}

.rsp-finish-scenario:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 77, 77, 0.3);
}

.rsp-finish-scenario:focus {
    outline: 2px solid #ff4d4d;
    outline-offset: 2px;
}

/* ============================================
   Responsive
    ============================================ */

@media (max-width: 768px) {
    .rigolospam-scenario-player {
        margin: 16px;
        margin-bottom: 32px;
    }

    .rigolospam-scenario-player__voice-selector {
        padding: 20px 20px 0 20px;
    }

    .rigolospam-scenario-player__content {
        padding: 20px;
    }

    .rigolospam-scenario-player__finish {
        padding: 0;
        width: 100%;
        text-align: center;
        margin-top: 20px;
    }

    .rsp-finish-scenario {
        width: 100%;
    }
}

/* ============================================
   Wrapper accordéon (mode Elementor)
   ============================================ */

/* Wrapper caché par défaut */
.rsp-scenario-wrapper {
    display: none;
    margin-top: 24px;
}

.rsp-scenario-wrapper.active {
    display: block;
    animation: rsp-fade-in 0.35s ease forwards;
}

@keyframes rsp-fade-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bouton trigger dans les cards Elementor */
.rsp-trigger {
    cursor: pointer;
}

.rsp-trigger:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Card active */
.rsp-card.active {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 2px #6366f1, 0 12px 40px rgba(99, 102, 241, 0.3) !important;
}
