/* ---------- RESET & LAYOUT ---------- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Segoe UI', monospace; 
}

/* Vidéo d'arrière-plan */
#bgvid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    opacity: 0.3;
    filter: blur(2px) brightness(0.6);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(13, 17, 23, 0.95) 0%,
        rgba(22, 27, 34, 0.92) 100%);
    z-index: -1;
}

body {
    position: relative;
    color: #eee;
    min-height: 100vh;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

/* --- STYLE DU BOUTON "PASSER À L'ÉTAPE SUIVANTE" --- */
.next-step-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 25px;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: #00f0ff;
    text-decoration: none;
    font-family: 'Segoe UI', monospace;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.next-step-text {
    font-weight: 600;
}

.next-step-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

/* Interaction au survol */
.next-step-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: rgba(0, 240, 255, 0.8);
    color: #fff;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
    transform: translateX(-5px);
}

.next-step-btn:hover .next-step-icon {
    transform: translateX(5px);
}

/* Effet de passage lumineux (Glitch) */
.next-step-btn .next-step-glitch {
    position: absolute;
    top: 0; 
    left: -100%;
    width: 100%; 
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.6), transparent);
    transform: skewX(-25deg);
    transition: 0.5s;
}

.next-step-btn:hover .next-step-glitch {
    left: 100%;
    transition: 0.5s;
}

/* Conteneur principal plein écran */
.fullscreen-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* ---------- CHAT CONTAINER ---------- */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: rgba(22, 27, 34, 0.9);
    border: none;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
    overflow: hidden;
}

/* Wrapper pour les messages */
.messages-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(13, 17, 23, 0.7);
}

/* Scrollbar personnalisée pour le chat */
.messages-wrapper::-webkit-scrollbar {
    width: 8px;
}

.messages-wrapper::-webkit-scrollbar-track {
    background: rgba(22, 27, 34, 0.3);
    border-radius: 4px;
}

.messages-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 4px;
}

.messages-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.5);
}

/* Header */
.header {
    text-align: center;
    padding: 20px;
    background: rgba(13, 17, 23, 0.9);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.header h1 {
    color: #00f0ff;
    font-size: 28px;
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
    letter-spacing: 0.5px;
}

.subtitle {
    color: #8b949e;
    font-size: 15px;
    font-style: italic;
    margin-bottom: 12px;
    opacity: 0.9;
}

.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: #00ff88;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.1);
    }
}

/* ---------- MESSAGES ---------- */
.message {
    max-width: 85%;
    padding: 16px 22px;
    margin-bottom: 8px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(15px);
    animation: messageAppear 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Indicateur de type de message */
.message-type-indicator {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.message-type-indicator::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.message.user .message-type-indicator::before {
    background: #00f0ff;
    box-shadow: 0 0 8px #00f0ff;
}

.message.bot .message-type-indicator::before {
    background: #ff6b6b;
    box-shadow: 0 0 8px #ff6b6b;
}

/* utilisateur */
.message.user { 
    align-self: flex-end; 
    background: linear-gradient(135deg, rgba(0, 100, 255, 0.2), rgba(0, 200, 255, 0.15));
    color: #b3e0ff; 
    border: 1px solid rgba(0, 180, 255, 0.4);
    border-right: 4px solid rgba(0, 150, 255, 0.6);
}

.message.user.text-only .message-type-indicator::after {
    content: "Vous";
    color: #00f0ff;
}

.message.user.audio-message .message-type-indicator::after {
    content: "Vous (Audio)";
    color: #00f0ff;
}

/* bot / autre */
.message.bot { 
    align-self: flex-start; 
    background: linear-gradient(135deg, rgba(50, 56, 70, 0.9), rgba(40, 46, 60, 0.95));
    border: 1px solid rgba(90, 100, 120, 0.4); 
    color: #e6edf3;
    border-left: 4px solid rgba(0, 240, 255, 0.4);
}

.message.bot.text-only .message-type-indicator::after {
    content: "Éloa";
    color: #ff6b6b;
}

.message.bot.audio-message .message-type-indicator::after {
    content: "Éloa (Audio)";
    color: #ff6b6b;
}

/* Message time */
.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 5px;
    text-align: right;
}

/* typing (trois points) */
.typing {
    display: flex; 
    gap: 6px; 
    background: rgba(34, 40, 49, 0.9); 
    border: 1px solid rgba(68, 76, 86, 0.8);
    padding: 12px 20px; 
    border-radius: 15px; 
    width: fit-content; 
    align-items: center;
    align-self: flex-start;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.typing span {
    width: 8px; 
    height: 8px; 
    background: #00f0ff; 
    border-radius: 50%;
    animation: blink 1.2s infinite ease-in-out; 
    opacity: .7;
    box-shadow: 0 0 8px #00f0ff;
}

.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0%, 100% { 
        opacity: .3; 
        transform: translateY(0); 
    }
    50% { 
        opacity: 1; 
        transform: translateY(-4px); 
    }
}

/* ---------- AUDIO BUBBLE ---------- */
.audio-message {
    display: flex; 
    align-items: center; 
    gap: 12px;
    background: rgba(40, 45, 60, 0.95);
    border-radius: 20px; 
    padding: 14px 18px;
    border: 1px solid rgba(0, 240, 255, 0.25);
    width: fit-content; 
    max-width: 320px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.audio-message:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 240, 255, 0.15);
    border-color: rgba(0, 240, 255, 0.4);
}

.message.user.audio-message {
    background: linear-gradient(135deg, rgba(0, 92, 75, 0.9), rgba(0, 122, 98, 0.85)); 
    border-color: rgba(0, 180, 150, 0.5); 
    color: white;
}

.message.bot.audio-message {
    background: linear-gradient(135deg, rgba(60, 30, 45, 0.9), rgba(80, 40, 60, 0.85));
    border-color: rgba(150, 60, 100, 0.5);
}

.voice-btn {
    width: 40px; 
    height: 40px; 
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.25); 
    border: 2px solid rgba(0, 240, 255, 0.7);
    display: flex; 
    justify-content: center; 
    align-items: center;
    cursor: pointer; 
    flex-shrink: 0; 
    font-size: 20px; 
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.voice-btn:hover { 
    transform: scale(1.1); 
    background: rgba(0, 240, 255, 0.35);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.duration { 
    font-size: 14px; 
    opacity: .9; 
    margin-left: 8px; 
    width: 45px; 
    text-align: center; 
    font-weight: 500;
}

.wave { 
    display: flex; 
    gap: 4px; 
    height: 18px; 
    align-items: flex-end; 
    flex-grow: 1; 
    padding: 0 10px;
}

.wave span {
    width: 4px; 
    background: #00f0ff; 
    border-radius: 4px;
    animation: waveJump 1.4s infinite ease-in-out;
    animation-play-state: paused;
}

.wave span:nth-child(2) { animation-delay: .2s; }
.wave span:nth-child(3) { animation-delay: .4s; }
.wave span:nth-child(4) { animation-delay: .6s; }
.wave span:nth-child(5) { animation-delay: .8s; }

.wave.playing span { animation-play-state: running; }
.wave.paused span { animation-play-state: paused; }
.wave.stopped span { animation: none; height: 4px; }

@keyframes waveJump { 
    0% { height: 4px; } 
    50% { height: 18px; } 
    100% { height: 4px; } 
}

/* ---------- LOADER BUBBLE ---------- */
.message.audio-message.loading-msg {
    display: flex; 
    align-items: center; 
    gap: 12px;
    background: rgba(30, 36, 45, 0.9); 
    border-radius: 20px; 
    padding: 14px 18px;
    border: 1px solid rgba(46, 58, 70, 0.8); 
    width: fit-content; 
    max-width: 300px;
}

.voice-loader {
    width: 30px;
    height: 30px;
    border: 3px solid #00f0ff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.message.audio-message.loading-msg span {
    font-size: 14px;
    color: #cfeadf;
    opacity: .9;
    font-weight: 500;
}

@keyframes spin { 
    from { transform: rotate(0deg); } 
    to { transform: rotate(360deg); } 
}

/* ---------- CHOICES CONTAINER ---------- */
.choices-container {
    flex-shrink: 0;
    width: 100%;
    background: rgba(13, 17, 23, 0.95);
    padding: 25px;
    backdrop-filter: blur(15px);
    border: none;
    border-top: 2px solid rgba(0, 240, 255, 0.25);
    box-shadow: 0 -5px 30px rgba(0, 240, 255, 0.15);
    max-height: 40vh;
    overflow-y: auto;
}

.choices-header {
    font-size: 15px;
    color: #00f0ff;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.choices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 5px;
}

.choice-btn {
    padding: 20px 25px;
    background: linear-gradient(135deg, rgba(35, 40, 55, 0.95), rgba(45, 50, 70, 0.9));
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 14px;
    color: #f0f7ff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-align: left;
    line-height: 1.6;
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.choice-btn:hover {
    background: linear-gradient(135deg, rgba(55, 60, 80, 0.95), rgba(65, 70, 90, 0.9));
    border-color: rgba(100, 200, 255, 0.5);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 240, 255, 0.25);
}

.choice-btn .tone-label {
    display: block;
    font-size: 12px;
    color: #00f0ff;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    font-weight: 600;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- CONCLUSION ---------- */
.conclusion {
    text-align: center;
    color: #8b949e;
    font-size: 14px;
    padding: 20px;
    font-style: italic;
    background: rgba(22, 27, 34, 0.9);
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.conclusion button {
    background: rgba(0, 240, 255, 0.2);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: #00f0ff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.conclusion button:hover {
    background: rgba(0, 240, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 240, 255, 0.2);
}

/* ---------- UTILS ---------- */

/* Ajustements pour très grands écrans */
@media (min-width: 1200px) {
    .message {
        max-width: 75%;
    }
    
    .choices-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .header h1 {
        font-size: 32px;
    }
    
    .subtitle {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .messages-wrapper {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .choices-container {
        padding: 20px;
    }
    
    .choice-btn {
        padding: 18px 20px;
        font-size: 15px;
    }
}

/* Adaptation Mobile pour le bouton suivant */
@media (max-width: 768px) {
    .next-step-btn {
        top: 20px; 
        right: 20px;
        padding: 10px 15px;
        font-size: 12px;
    }
    .next-step-text {
        font-size: 11px;
    }
    .next-step-icon {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .messages-wrapper {
        padding: 12px;
    }
    
    .message {
        max-width: 92%;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .choices-container {
        padding: 15px;
        max-height: 35vh;
    }
    
    .choice-btn {
        padding: 16px;
        font-size: 14px;
    }
    
    .audio-message {
        max-width: 280px;
    }
    
    .next-step-btn {
        top: 15px; 
        right: 15px;
        padding: 8px 12px;
        font-size: 10px;
    }
    .next-step-text {
        display: none;
    }
    .next-step-btn::after {
        content: 'Suivant';
        font-size: 11px;
    }
}