/* Définition des couleurs et polices */
:root {
    --color-primary: #5A87D8; /* Bleu doux */
    --color-secondary: #2ecc71; /* Vert Apaisant */
    --color-background-light: #f7f9fc; /* Arrière-plan très clair */
    --color-background-dark: #e0e6ed; /* Gris clair */
    --color-text-dark: #2c3e50; /* Texte principal */
    --color-text-light: #ffffff;
    --color-danger: #e74c3c;
    --color-warning: #f39c12;
    --font-family-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius-lg: 18px;
    --border-radius-sm: 8px;
}

body {
    font-family: var(--font-family-sans);
    background-color: var(--color-background-light);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--color-text-dark);
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* --- ACCESSIBILITÉ: MODE CONTRASTE ÉLEVÉ --- */
body.high-contrast {
    background-color: #000000;
    color: #ffffff;
}
.high-contrast header { background-color: #111; border-bottom: 3px solid yellow; }
.high-contrast .logo-name { color: #00ffff; }
.high-contrast .logo-tagline { color: #ccc; }
.high-contrast .user-counter, .high-contrast .safety-badge {
    background-color: #333; color: yellow; border: 2px solid yellow;
}
.high-contrast .card, .high-contrast .chat-box, .high-contrast .controls, .high-contrast #messages li {
    background-color: #222;
    color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    border: none !important; 
}
.high-contrast #auth-form input, .high-contrast select {
    background-color: #444; color: white; border: 2px solid #00ffff !important;
}
.high-contrast .btn-primary, .high-contrast .btn-send { background-color: #00ffff !important; color: black; }
.high-contrast .btn-secondary, .high-contrast .btn-header { background-color: #555; color: white; border: 1px solid white;}
.high-contrast .btn-danger { background-color: #ff0000; color: white; }
.high-contrast #messages li.self { background-color: #004d40; }
.high-contrast #messages li.partner { background-color: #4a148c; }


/* === HEADER ET NAVIGATION === */
header {
    background-color: var(--color-text-light);
    padding: 15px 40px;
    display: flex;
    justify-content: flex-start; 
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.logo { line-height: 1.1; display: flex; flex-direction: column; }
.logo-name {
    font-size: 30px;
    font-weight: 900;
    color: var(--color-primary);
}
.logo-tagline {
    font-size: 14px; 
    font-weight: 400;
    color: #7f8c8d; 
    margin-top: 2px;
}

.btn-header {
    padding: 8px 15px;
    font-size: 16px;
    border-radius: var(--border-radius-sm);
    margin-left: 15px;
}

.user-counter {
    background-color: var(--color-background-dark);
    color: var(--color-primary);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: bold;
    margin-left: auto; 
    margin-right: 20px;
    transition: background-color 0.3s;
}
.safety-badge { 
    background: #e8f5e9; 
    color: var(--color-secondary); 
    padding: 8px 15px; 
    border-radius: 30px; 
    font-weight: bold; 
    font-size: 14px;
}

/* === GÉNÉRAL (MAIN / CARTES) === */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background-color: var(--color-text-light);
    padding: 40px 50px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    max-width: 550px;
    width: 100%;
    text-align: center;
}

.intro-card ul {
    list-style: none;
    padding: 0;
    text-align: left;
    margin: 25px 0;
}
.intro-card li {
    padding: 10px 0;
    font-size: 18px;
    color: var(--color-text-dark);
}
.intro-card li span {
    font-weight: bold;
}

/* Formulaires */
.auth-card input {
    width: calc(100% - 20px);
    padding: 15px;
    margin: 10px 0;
    border: 1px solid var(--color-background-dark);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    box-sizing: border-box;
}

.info-text {
    margin: 15px 0;
    font-size: 16px;
    color: #6c757d;
}

/* Sélecteur de qualité vidéo (avant de démarrer) */
#quality-selector {
    margin: 15px 0 25px;
    padding: 15px;
    background-color: var(--color-background-dark);
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}
#video-quality {
    padding: 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid #ccc;
    font-size: 16px;
}

/* === BOUTONS === */
.btn {
    padding: 15px 35px;
    font-size: 18px;
    border: none;
    border-radius: 50px; /* Pilules pour un look moderne */
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    margin: 5px;
    text-decoration: none;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-primary { background-color: var(--color-primary); color: var(--color-text-light); }
.btn-secondary { background-color: #95a5a6; color: var(--color-text-light); }
.btn-danger { background-color: var(--color-danger); color: var(--color-text-light); }
.btn-warning { background-color: var(--color-warning); color: var(--color-text-light); }
.btn-link { background: none; color: var(--color-primary); text-decoration: underline; padding: 10px; font-weight: normal; }


/* === CHAT VIDÉO PAGE === */
#chat-page { 
    flex-direction: column; 
    max-width: 1200px; 
    width: 100%;
    justify-content: flex-start; 
}
.video-grid {
    display: flex;
    gap: 25px;
    width: 100%;
    margin-bottom: 25px;
}
.video-container {
    flex: 2;
    position: relative;
    width: 100%;
    max-width: 850px;
    aspect-ratio: 16/9;
    background: #000000;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}
#remoteVideo { width: 100%; height: 100%; object-fit: cover; }
#localVideo {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: 25%;
    min-width: 150px;
    border-radius: var(--border-radius-sm);
    border: 4px solid var(--color-text-light);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.timer {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(var(--color-text-dark), 0.7);
    color: var(--color-text-light);
    padding: 8px 15px;
    border-radius: var(--border-radius-sm);
    font-weight: bold;
    font-size: 18px;
    z-index: 10;
}
#status-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-text-light);
    font-size: 22px;
    text-align: center;
    padding: 10px;
    background: rgba(var(--color-text-dark), 0.5);
    border-radius: var(--border-radius-sm);
}

/* Chat Box */
.chat-box {
    flex: 1; 
    display: flex;
    flex-direction: column;
    background: var(--color-text-light);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    min-width: 300px;
}
.chat-header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
}

/* Liste de messages */
#messages { 
    list-style-type: none; 
    margin: 0; 
    padding: 15px; 
    flex-grow: 1; 
    overflow-y: auto; 
    height: 350px; 
    display: flex; 
    flex-direction: column; 
}
#messages li { 
    padding: 10px 15px; 
    margin-bottom: 10px; 
    border-radius: 20px; 
    max-width: 85%; 
    word-wrap: break-word; 
    font-size: 16px;
    line-height: 1.4;
}
#messages li.self { 
    background-color: #cfd8dc; /* Gris clair */
    margin-left: auto; 
    text-align: right; 
}
#messages li.partner { 
    background-color: #e3f4e9; /* Vert très pâle */
    margin-right: auto; 
    text-align: left;
}
#messages li strong {
    font-weight: 700;
}

/* Formulaire de chat */
#chat-form { 
    display: flex; 
    padding: 15px; 
    border-top: 1px solid var(--color-background-dark); 
    align-items: center;
}
#chat-form input { 
    flex-grow: 1; 
    border: 1px solid #ccc; 
    padding: 12px; 
    border-radius: var(--border-radius-sm); 
    margin-right: 10px;
    font-size: 16px;
}
#waveBtn { 
    padding: 12px 18px; 
    font-size: 16px;
    border-radius: var(--border-radius-sm);
}
.btn-send { 
    background-color: var(--color-secondary); 
    color: var(--color-text-light); 
    padding: 12px 20px; 
    border-radius: var(--border-radius-sm); 
}

/* Contrôles globaux */
.controls {
    display: flex;
    flex-wrap: wrap; 
    gap: 12px;
    align-items: center;
    margin-top: 15px;
    background-color: var(--color-text-light);
    padding: 15px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.controls select { 
    padding: 12px; 
    font-size: 16px; 
    border-radius: var(--border-radius-sm); 
    border: 1px solid #ccc; 
}

/* Responsive pour les petits écrans */
@media (max-width: 900px) {
    header { padding: 10px 20px; }
    .logo-name { font-size: 24px; }
    .video-grid { flex-direction: column; }
    .chat-box { min-width: auto; width: 100%; }
    .controls { justify-content: center; padding: 10px; }
    .btn { padding: 12px 20px; font-size: 16px; }
    #localVideo { width: 30%; bottom: 10px; right: 10px; }
    .card { padding: 30px; }
    .user-counter { margin-right: 10px; }
}