/* ==========================================================================
   🎮 MODULE TWITCH - STYLES DE L'INTÉGRATION STREAM
   Living Tales Together - Éléments isolés pour le mode Twitch
   ========================================================================== */

/* Badge Twitch */
.badge-twitch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #9146FF;
    color: #ffffff;
    font-size: 0.72em;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px rgba(145, 70, 255, 0.4);
}

/* Bouton pour déclencher l'action du tchat sur la fiche du héros */
.btn-twitch-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: 9px 14px;
    background: linear-gradient(135deg, #9146FF 0%, #772CE8 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(145, 70, 255, 0.3);
}

.btn-twitch-play:hover:not(:disabled) {
    background: linear-gradient(135deg, #a35eff 0%, #873cf3 100%);
    box-shadow: 0 0 15px rgba(145, 70, 255, 0.6);
    transform: translateY(-1px);
}

.btn-twitch-play:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #443e52;
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    transform: none;
}

/* Modale Twitch */
.twitch-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(8, 6, 14, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 15px;
    box-sizing: border-box;
    overflow-y: auto;
}

.twitch-modal-card {
    background: linear-gradient(180deg, #1c1629 0%, #120e1c 100%);
    border: 2px solid #9146FF;
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    max-height: calc(100dvh - 30px);
    max-height: min(90vh, 90dvh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 22px 20px;
    box-shadow: 0 0 35px rgba(145, 70, 255, 0.35);
    color: #ffffff;
    font-family: inherit;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    margin: auto;
    animation: twitchModalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    scrollbar-width: thin;
    scrollbar-color: #9146FF rgba(20, 15, 32, 0.8);
}

.twitch-modal-card::-webkit-scrollbar {
    width: 6px;
}
.twitch-modal-card::-webkit-scrollbar-track {
    background: rgba(20, 15, 32, 0.8);
    border-radius: 4px;
}
.twitch-modal-card::-webkit-scrollbar-thumb {
    background: #9146FF;
    border-radius: 4px;
}

@keyframes twitchModalPop {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Boutons d'actions en haut à droite de la modale */
.twitch-card-top-actions {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.twitch-card-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(145, 70, 255, 0.4);
    border-radius: 6px;
    color: #e5d4ff;
    cursor: pointer;
    font-size: 1.15em;
    padding: 4px 8px;
    line-height: 1;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.twitch-card-action-btn:hover:not(:disabled) {
    background: rgba(145, 70, 255, 0.3);
    border-color: #bf94ff;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(145, 70, 255, 0.5);
}

.twitch-settings-btn {
    font-size: 1.2em;
}

.twitch-settings-btn:hover:not(:disabled) {
    transform: rotate(45deg) scale(1.08);
}

.twitch-settings-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.twitch-card-close-btn {
    font-size: 1.6em;
    padding: 0 6px;
    background: none;
    border: none;
    color: #aaa;
}

.twitch-card-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 71, 87, 0.2);
}

/* En-tête de la modale */
.twitch-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 0 50px 0 20px;
}

.twitch-modal-header h3 {
    margin: 0;
    font-size: 1.35em;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(145, 70, 255, 0.5);
    line-height: 1.3;
}

/* Mise en valeur du nom de la chaîne dans le titre */
.twitch-channel-title-highlight {
    color: #bf94ff;
    text-shadow: 0 0 12px rgba(191, 148, 255, 0.75);
    font-weight: 800;
}

/* Panneau de configuration / modification de la chaîne en temps réel */
.twitch-settings-panel {
    background: rgba(18, 14, 28, 0.95);
    border: 1px solid #9146FF;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(145, 70, 255, 0.25);
    text-align: left;
    animation: twitchSettingsFadeDown 0.25s ease-out;
}

@keyframes twitchSettingsFadeDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.twitch-settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    font-weight: 700;
    color: #e5d4ff;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(145, 70, 255, 0.25);
    padding-bottom: 6px;
}

.twitch-settings-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.twitch-settings-close-mini {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.4em;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s ease;
}

.twitch-settings-close-mini:hover {
    color: #ff4757;
}

.twitch-settings-label {
    display: block;
    font-size: 0.85em;
    color: #cbb8e8;
    margin-bottom: 6px;
    font-weight: 600;
}

.twitch-settings-input-group {
    display: flex;
    gap: 0;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.twitch-settings-prefix {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    background: rgba(145, 70, 255, 0.2);
    color: #bf94ff;
    font-size: 0.82em;
    font-weight: 700;
    user-select: none;
    border: 1px solid rgba(145, 70, 255, 0.4);
    border-radius: 6px 0 0 6px;
    border-right: none;
    flex: 0 0 auto;
    white-space: nowrap;
}

.twitch-channel-edit-input {
    flex: 1 1 auto;
    min-width: 0 !important;
    width: 0 !important;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(145, 70, 255, 0.4);
    border-radius: 0;
    outline: none;
    color: #ffffff;
    font-size: 0.95em;
    font-weight: 600;
    padding: 6px 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.twitch-channel-edit-input:focus {
    border-color: #9146FF;
    box-shadow: 0 0 10px rgba(145, 70, 255, 0.4);
    background: rgba(145, 70, 255, 0.08);
}

.twitch-btn-save-channel {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 50px !important;
    min-width: 38px !important;
    background: linear-gradient(135deg, #9146FF 0%, #772CE8 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 6px 6px 0;
    padding: 6px 8px !important;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.twitch-btn-save-channel:hover {
    background: linear-gradient(135deg, #a35eff 0%, #873cf3 100%);
    box-shadow: 0 0 12px rgba(145, 70, 255, 0.5);
}

.twitch-settings-feedback {
    min-height: 18px;
    font-size: 0.82em;
    margin-top: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.twitch-settings-feedback.success {
    color: #4ecca3;
}

.twitch-settings-feedback.error {
    color: #ff4757;
}

/* Grand texte visible pour les viewers / tchat */
.twitch-prompt-banner {
    background: rgba(145, 70, 255, 0.15);
    border: 1px solid rgba(145, 70, 255, 0.45);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1.45;
    color: #e5d4ff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.twitch-prompt-banner strong {
    color: #ffffff;
    background: #9146FF;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 1.05em;
}

/* Configuration du slider de durée Twitch (20s à 60s) */
.twitch-duration-config {
    background: rgba(145, 70, 255, 0.12);
    border: 1px solid rgba(145, 70, 255, 0.35);
    border-radius: 8px;
    padding: 12px 18px;
    margin-bottom: 18px;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.twitch-duration-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95em;
    font-weight: 600;
    color: #e5d4ff;
}

.twitch-duration-val-badge {
    background: #9146FF;
    color: #ffffff;
    font-size: 0.95em;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: monospace;
    box-shadow: 0 0 10px rgba(145, 70, 255, 0.6);
}

.twitch-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.twitch-slider-bound {
    font-size: 0.8em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    font-family: monospace;
    min-width: 25px;
}

.twitch-duration-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.twitch-duration-range:hover:not(:disabled) {
    background: rgba(145, 70, 255, 0.45);
}

.twitch-duration-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a86bff 0%, #9146FF 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(145, 70, 255, 0.85);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.twitch-duration-range::-webkit-slider-thumb:hover {
    transform: scale(1.18);
    box-shadow: 0 0 16px rgba(145, 70, 255, 1);
}

.twitch-duration-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a86bff 0%, #9146FF 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(145, 70, 255, 0.85);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.twitch-duration-range:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.twitch-duration-config.countdown-active {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.2);
}

/* Zone du compte à rebours */
.twitch-timer-zone {
    margin: 20px 0;
}

.twitch-timer-display {
    font-size: 3.2em;
    font-weight: 900;
    font-family: monospace;
    color: #ffffff;
    text-shadow: 0 0 20px #9146FF;
    line-height: 1;
    margin-bottom: 8px;
}

.twitch-timer-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.twitch-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #9146FF, #00f2fe);
    border-radius: 4px;
    transition: width 1s linear;
}

.twitch-actions-counter {
    font-size: 1.05em;
    font-weight: 600;
    color: #4ecca3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Roulette / Défilement rapide des actions */
.twitch-roulette-container {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(145, 70, 255, 0.3);
    border-radius: 8px;
    height: 80px;
    margin: 18px 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.twitch-roulette-ticker {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffffff;
    padding: 10px 15px;
    text-align: center;
    width: 100%;
    transition: all 0.1s ease;
}

.twitch-roulette-ticker.roulette-spinning {
    animation: rouletteBlur 0.12s infinite alternate;
}

@keyframes rouletteBlur {
    0% { transform: translateY(-4px); opacity: 0.8; filter: blur(0.5px); }
    100% { transform: translateY(4px); opacity: 1; filter: blur(0); }
}

.twitch-roulette-winner {
    background: rgba(78, 204, 163, 0.15) !important;
    border: 2px solid #4ecca3 !important;
    box-shadow: 0 0 25px rgba(78, 204, 163, 0.4) !important;
}

.twitch-winner-badge {
    color: #4ecca3;
    font-size: 0.9em;
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
}

.twitch-winner-text {
    font-size: 1.15em;
    font-weight: 800;
    color: #ffffff;
}

/* Actions du bas */
.twitch-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
    margin: 20px auto 0 auto;
}

.twitch-modal-btn-start {
    background: linear-gradient(135deg, #9146FF 0%, #772CE8 100%);
    color: white;
    font-size: 1.05em;
    font-weight: 700;
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(145, 70, 255, 0.4);
    transition: all 0.2s;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.twitch-modal-btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(145, 70, 255, 0.6);
}

.twitch-modal-btn-skip {
    background: rgba(22, 27, 34, 0.85);
    border: 1px solid rgba(145, 70, 255, 0.45);
    color: #e2e8f0;
    font-size: 0.95em;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.twitch-modal-btn-skip:hover {
    background: rgba(145, 70, 255, 0.2);
    border-color: #9146FF;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(145, 70, 255, 0.35);
    transform: translateY(-1px);
}

.twitch-modal-btn-close {
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
    font-size: 0.95em;
    font-weight: 600;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.twitch-modal-btn-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Adaptation Responsive Petits Formats d'Écran (< 760px hauteur ou < 600px largeur) */
@media (max-height: 760px), (max-width: 600px) {
    .twitch-modal-backdrop {
        padding: 8px;
        align-items: flex-start;
    }

    .twitch-modal-card {
        padding: 14px 14px 18px 14px;
        max-height: calc(100dvh - 16px);
        border-radius: 10px;
        margin: auto;
    }

    .twitch-modal-header {
        margin-bottom: 8px;
        padding: 0 45px 0 15px;
    }

    .twitch-modal-header h3 {
        font-size: 1.15em;
    }

    .twitch-prompt-banner {
        padding: 10px 14px;
        margin-bottom: 10px;
        font-size: 0.92em;
    }

    .twitch-duration-config {
        padding: 8px 12px;
        margin-bottom: 10px;
    }

    .twitch-timer-zone {
        margin-bottom: 10px;
    }

    .twitch-timer-display {
        font-size: 2.2em;
    }

    .twitch-roulette-container {
        padding: 10px;
        margin-bottom: 12px;
        min-height: 48px;
    }

    .twitch-settings-panel {
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    .twitch-modal-btn-start,
    .twitch-modal-btn-skip,
    .twitch-modal-btn-close {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}
