:root {
    --bordeaux: #660601;
    --beige-fond: #FEF5E5;
    --beige-bulle: #FFF9F0;
    --beige-bordure: #E6E0D4;
    --blanc: #FFFFFF;
    --focus-outline: #0056b3;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    transition: background 0.2s ease, border 0.2s ease; 
}

html {
    font-family: 'DM Sans', sans-serif;
    -webkit-text-size-adjust: 100%;
}

body, button, input, textarea, select {
    font-family: inherit;
}

body { 
    background-color: var(--beige-fond); 
    display: flex; 
    height: 100vh; 
    overflow: hidden;
    font-size: 1rem; /* Taille standard (16px) */
    line-height: 1.5;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

a:focus, button:focus, input:focus {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
}

.sidebar { 
    width: clamp(280px, 30vw, 350px); 
    background-color: var(--bordeaux); 
    color: white; 
    display: flex; 
    flex-direction: column; 
}

.logo-container { 
    padding: clamp(15px, 4vh, 30px); 
    text-align: left; 
}

.logo-container img { 
    height: clamp(30px, 5vh, 45px); 
    display: block;
}

.search-container { 
    padding: 0 20px 20px; 
    position: relative; 
}

.search-bar { 
    width: 100%; 
    background-color: var(--beige-fond); 
    border: 2px solid transparent; 
    border-radius: 10px; 
    padding: 12px 12px 12px 40px; 
    color: var(--bordeaux); 
    font-weight: 600;
    font-size: 0.95rem;
}

.search-icon { 
    position: absolute; 
    left: 35px; 
    top: 50%;
    transform: translateY(-110%);
    color: var(--bordeaux); 
}

.section-title { 
    padding: 15px 25px 5px; 
    font-size: 0.8rem; /* Agrandi (au lieu de 11px) */
    text-transform: uppercase; 
    opacity: 0.7; 
    letter-spacing: 1px; 
    font-weight: 700;
}

.sidebar-separator {
    margin-top: clamp(10px, 3vh, 20px);
}

.sidebar-header-row { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding-right: 25px; 
}

.add-chat-btn { 
    width: 26px; 
    height: 26px; 
    background-color: var(--beige-bulle); 
    color: var(--bordeaux); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer;
    border: none;
}

.discussion-list { 
    flex: 1; 
    overflow-y: auto; 
}

.discussion-item { 
    display: block; 
    padding: 12px 25px; 
    color: white; 
    text-decoration: none; 
    border-left: 4px solid transparent; 
    font-size: 1rem;
}

.discussion-item:hover, .discussion-item:focus { 
    background: rgba(255,255,255,0.1); 
}

.discussion-item.active { 
    background: rgba(255,255,255,0.15); 
    border-left-color: var(--beige-fond); 
}

.user-row { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

.mini-avatar { 
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    object-fit: cover; 
    border: 1px solid white; 
}

.chat-main { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}

.chat-header { 
    height: 70px; 
    background: white; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 30px; 
    border-bottom: 1px solid var(--beige-bordure); 
}

.back-btn { 
    display: none; 
    color: var(--bordeaux); 
    font-size: 1.5rem; 
    text-decoration: none; 
    margin-right: 15px; 
}

.header-info h2 { 
    color: var(--bordeaux); 
    margin: 0; 
    font-size: 1.25rem; 
}

.header-icons { 
    color: var(--bordeaux); 
    font-size: 1.25rem; 
    display: flex; 
    gap: 20px; 
}

.header-icons i {
    cursor: pointer;
    padding: 5px;
}

.messages-container { 
    flex: 1; 
    overflow-y: auto; 
    padding: 25px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.message-row { 
    display: flex; 
    gap: 12px; 
    width: 100%; 
    max-width: 650px; 
    align-items: flex-end; 
}

.message-row.me { 
    align-self: flex-end; 
    flex-direction: row-reverse; 
}

.avatar-msg { 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    object-fit: cover; 
    flex-shrink: 0;
}

.bubble { 
    padding: 12px 16px; 
    border-radius: 18px; 
    font-size: 1rem; 
    position: relative; 
    line-height: 1.45; 
    max-width: 450px; 
    width: fit-content;
    word-wrap: break-word;
}

.message-row.others .bubble { 
    background: var(--bordeaux); 
    color: white; 
    border-bottom-left-radius: 4px; 
}

.message-row.me .bubble { 
    background: var(--beige-bordure); 
    color: var(--bordeaux); 
    border-bottom-right-radius: 4px; 
}

.chat-image {
    max-width: 100%;
    max-height: 250px;
    display: block;
    border-radius: 10px;
    margin-bottom: 8px;
    object-fit: contain;
}

.msg-time { 
    font-size: 0.75rem; /* Agrandi (au lieu de 9px) */
    opacity: 0.8; 
    display: block; 
    margin-top: 4px; 
    text-align: right; 
}

.input-area { 
    padding: 15px 30px; 
}

.input-wrapper { 
    display: flex; 
    align-items: center; 
    background: white; 
    border-radius: 12px; 
    padding: 8px 20px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    gap: 15px; 
}

.input-wrapper input { 
    flex: 1; 
    border: none; 
    outline: none; 
    font-size: 1rem; 
    padding: 5px 0;
}

.hidden-input { display: none; }

.upload-btn, .send-btn { 
    color: var(--bordeaux); 
    cursor: pointer; 
    font-size: 1.3rem; 
    background: none; 
    border: none; 
    display: flex;
    align-items: center;
}

.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.4); 
    backdrop-filter: blur(4px); 
    align-items: center; 
    justify-content: center; 
}

.modal-content {
    background: var(--blanc);
    border-radius: 40px;
    padding: 40px;
    width: min(450px, 90%);
    text-align: center;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-content h3 {
    font-size: 1.75rem; /* Adapté (environ 28px) */
    font-weight: 800;
    margin-bottom: 30px;
    color: var(--bordeaux);
}

.setting-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
}

.setting-item span {
    font-weight: 700;
    font-size: 1.15rem; /* Agrandi pour lisibilité */
    color: var(--bordeaux);
}

.switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--bordeaux); }
input:checked + .slider:before { transform: translateX(22px); }

.group-info-card { 
    background: #FFF9F0; 
    padding: 20px; 
    border-radius: 20px; 
    margin: 20px 0;
    border: 1px solid #F8E8D0;
    text-align: left;
}

.group-info-card p { margin: 0; font-size: 1rem; color: #555; font-weight: 500; }

.leave-btn { 
    width: 100%; 
    padding: 14px; 
    background-color: transparent; 
    color: var(--bordeaux); 
    border: 2px solid var(--bordeaux); 
    border-radius: 15px; 
    font-weight: 800; 
    font-size: 1rem;
    cursor: pointer;
}

.leave-btn:hover, .leave-btn:focus { background-color: var(--bordeaux); color: white; }

.close { position: absolute; right: 30px; top: 30px; cursor: pointer; font-size: 1.5rem; color: #ddd; border: none; background: none; }

.conteneur-apercu-image {
    display: none;
    padding: 15px 40px;
    background-color: var(--beige-fond);
    border-top: 1px solid var(--beige-bordure);
    position: relative;
}

.image-apercu { max-height: 120px; border-radius: 10px; display: block; }

.bouton-annuler-apercu {
    position: absolute; top: 20px; left: 20px; background-color: rgba(102, 6, 1, 0.8);
    color: white; border: none; border-radius: 50%; width: 28px; height: 28px; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem;
}

.empty-state { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    color: var(--bordeaux); 
    opacity: 0.6; 
    gap: 15px;
    height: 100%; 
}

.empty-state i { font-size: 4rem; }
.empty-state p { font-size: 1.25rem; font-weight: 500; }

.contact-item { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--beige-bordure); }
.contact-details { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.contact-name { color: var(--bordeaux); font-weight: 700; font-size: 1.15rem; }
.match-badge-transparent { background: rgba(102, 6, 1, 0.15); color: var(--bordeaux); padding: 2px 8px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; }
.discuter-btn { background-color: var(--bordeaux); color: white; border: none; padding: 8px 16px; border-radius: 10px; font-size: 0.95rem; font-weight: 700; cursor: pointer; }

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .chat-header { height: 90px; padding: 0 25px; }
    .header-icons { font-size: 2rem; gap: 30px; }
    .bubble { max-width: 60vw; font-size: 1.2rem; padding: 16px 20px; }
}

@media (max-width: 768px) {
    .sidebar { width: 100%; }
    .chat-main { display: none; }
    body.mobile-chat-active .sidebar { display: none; }
    body.mobile-chat-active .chat-main { display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: 100; background: var(--beige-fond); }
    body.mobile-chat-active .back-btn { display: block; }
    .chat-header { height: 100px; }
    .header-info h2 { font-size: 1.5rem; }
    .header-icons { font-size: 2.25rem; }
    .bubble { max-width: 50vw; min-width: 45vw; font-size: 1.3rem; padding: 20px 25px; line-height: 1.6; }
    .message-row { max-width: 100%; margin-bottom: 10px; }
    body:not(.mobile-chat-active) .discussion-item { padding: 22px 24px; font-size: 1.3rem; }
    body:not(.mobile-chat-active) .mini-avatar { width: 44px; height: 44px; }
    .section-title { font-size: 1rem; padding: 25px 25px 10px; letter-spacing: 1.5px; }
}
