/* ===== GLOBAL ===== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f6f7f8;
    font-family: Lato, sans-serif;
    overflow-x: hidden;
}

/* ===== EVENT CARD ===== */

.event-card {
    max-width: 1100px;
    margin: 30px auto 20px auto;
    display: flex;
    gap: 20px;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.event-img {
    width: 220px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
}

.event-info {
    flex: 1;
}

.event-info h1 {
    margin-top: 0;
    color: #1f2937;
}

.event-info p {
    line-height: 1.5;
    color: #555;
    margin-bottom:0;
}

/* ===== CONTENT ===== */

.content {
    display: flex;
    gap: 20px;
    max-width: 1100px;
    margin: auto;
}

/* ===== PARTICIPANTS ===== */

.participants-panel {
    width: 280px;
    background: #eef9fb;
    border: 1px solid #c7e9ee;
    border-radius: 16px;
    padding: 20px;
}

.participants-panel h3 {
    margin-top: 0;
    color: #00798a;
}

#participants {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.participant {
    background: white;
    border-left: 4px solid #00798a;
    padding: 12px;
    border-radius: 8px;
}

/* ===== CHAT ===== */

.chat-panel {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
}

/* -----------MESSAGES CONTAINER-------------- */

.messages {
    height: 450px;
    overflow-y: auto;
    padding: 13px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f9fb; 
    overflow-y: auto;
}

/*----------MESSAGE BLOCK------------*/

.message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* MES messages (droite) */
.message.me {
    align-items:flex-end;
    display:flex;
}

/* LES AUTRES (gauche) */
.message.other {
    align-items: flex-start;
    display:flex;
}

.author {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    color:rgb(0,121,138)
}

/*-------------BUBBLE----------------*/

.bubble {
    display: inline-block; 
    align-items: center;
    max-width: 70%;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.2;
    word-break: break-word;
    box-sizing: border-box;
    white-space: normal;
    padding: 5px 5px!important;
} 

.message.me .bubble {
    background: #0b7a8a;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message.other .bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-radius: 18px 18px 18px 4px;
}

.bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* /*-----------TIME--------------------*/


.time {
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
    opacity: 0.8;
}

/* form */

#chat-form {
    display: flex;
    gap: 10px;
}

#message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

#chat-form button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #00798a;
    color: white;
    cursor: pointer;
}

#chat-form button:hover {
    opacity: .9;
}

*{
    text-align:left!important;
}

/* ===== MOBILE ===== */

@media (max-width: 900px) {

    .event-card {
        flex-direction: row;
        gap: 10px;
        align-items:flex-start;
    }

    .event-img {
        width: 70px;
        height: 70px;
        flex-shrink: 0;
        border-radius: 10px;
        object-fit: cover;
    }

    .event-info {
        flex: 1;
        min-width: 0; /* IMPORTANT pour éviter overflow */
    }

    .event-info h1 {
        font-size: 18px;
        margin: 0;
    }

    .event-info p {
        font-size: 14px;
        line-height: 1.3;
    }

    .content {
        padding: 10px;
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .participants-panel {
        order:1;
        width:100%;
        max-width:100%;
    }

    #participants {
        max-height: 150px;
        overflow-y: auto;
    }

    .chat-panel {
        order: 2;
        width:100%;
        max-width:100%;
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    .message {
        display: flex !important;
        width: 100%;
    }

    .messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    #chat-form {
        gap: 8px;
        flex-shrink: 0;
    }

    .bubble {
        max-width: 85%;
    }

    .message.me {
        align-items: flex-end !important;
    }

    .message.other {
        align-items: flex-start !important;
        justify-content: flex-start;
    }

    .message.me .bubble {
        align-self: flex-end;
    }

    .message.other .bubble {
        align-self: flex-start;
    }

}