body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: radial-gradient(circle at top, #38bdf8 0%, #0f172a 45%, #020617 100%);
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.82);
    box-shadow: 0 0 45px rgba(0,0,0,0.45);
    backdrop-filter: blur(12px);
}

.chat-header {
    background: linear-gradient(135deg, #0284c7, #0f172a);
    color: white;
    padding: 14px 18px;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sar-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(56,189,248,0.8);
}

.lang-switch {
    font-size: 13px;
    margin-left: 15px;
}

.lang-switch a {
    color: white;
    background: rgba(255,255,255,0.15);
    padding: 7px 10px;
    border-radius: 10px;
    text-decoration: none;
    margin-left: 5px;
    font-weight: bold;
}

.lang-switch a:hover {
    background: rgba(255,255,255,0.28);
}

.install-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
}

.button-bar {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: rgba(2, 6, 23, 0.55);
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.chat-button {
    padding: 11px 14px;
    background: rgba(56,189,248,0.16);
    color: white;
    border: 1px solid rgba(56,189,248,0.35);
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    flex: 1 1 14%;
    min-width: 130px;
    font-weight: bold;
    transition: 0.2s;
}

.chat-button:hover {
    background: linear-gradient(135deg, #0284c7, #22c55e);
    transform: translateY(-2px);
}

#chat-box {
    flex: 1;
    padding: 22px;
    overflow-y: auto;
    background:
        linear-gradient(rgba(15,23,42,0.78), rgba(15,23,42,0.78)),
        radial-gradient(circle at bottom right, rgba(34,197,94,0.25), transparent 35%);
}

.message {
    background: rgba(255,255,255,0.95);
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 82%;
    box-shadow: 0 8px 25px rgba(0,0,0,0.18);
    animation: messageIn 0.25s ease;
}

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

.user {
    font-weight: bold;
    color: #0284c7;
    display: block;
    margin-bottom: 4px;
}

.text {
    display: block;
    margin-top: 5px;
    font-size: 16px;
    color: #111827;
    line-height: 1.45;
}

.time {
    display: block;
    font-size: 12px;
    color: #64748b;
    text-align: right;
    margin-top: 8px;
}

.system-message {
    text-align: center;
    color: #e0f2fe;
    font-size: 13px;
    margin: 12px auto;
    background: rgba(255,255,255,0.10);
    padding: 8px 14px;
    border-radius: 20px;
    width: fit-content;
}

.reactions {
    margin-top: 10px;
}

.reactions button {
    border: none;
    background: #e0f2fe;
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
}

.comments {
    margin-top: 8px;
    font-size: 13px;
    color: #334155;
}

.message input[type="text"] {
    width: 100%;
    margin-top: 10px;
    padding: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-sizing: border-box;
}

.chat-input {
    display: flex;
    padding: 15px;
    background: rgba(2,6,23,0.85);
    border-top: 1px solid rgba(255,255,255,0.12);
}

.chat-input input {
    flex: 1;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.18);
    outline: none;
    background: rgba(255,255,255,0.95);
}

.chat-input input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56,189,248,0.25);
}

.chat-input button {
    margin-left: 10px;
    background: linear-gradient(135deg, #0284c7, #22c55e);
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 22px;
    cursor: pointer;
    font-weight: bold;
}

.chat-input button:hover {
    transform: scale(1.03);
}

/* Anciennes interfaces login/register conservées */
.login-box {
    max-width: 350px;
    margin: 100px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-box h2 {
    margin-bottom: 20px;
    color: #0088cc;
}

.login-box input,
.login-box select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.support-contact {
    margin-top: 25px;
    padding: 15px;
    background: #16212e;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    color: #ddd;
}

.admin-email {
    margin-top: 8px;
    font-weight: bold;
    color: #2ecc71;
    font-size: 16px;
}

@media (max-width: 768px) {
    .chat-container {
        max-width: none;
    }

    .chat-header {
        font-size: 16px;
        flex-wrap: wrap;
        padding: 12px;
    }

    .sar-logo {
        width: 34px;
        height: 34px;
    }

    .button-bar {
        padding: 10px;
    }

    .chat-button {
        font-size: 13px;
        padding: 10px;
        flex: 1 1 45%;
        min-width: 120px;
    }

    #chat-box {
        padding: 14px;
    }

    .message {
        max-width: 95%;
        font-size: 15px;
    }

    .chat-input {
        padding: 10px;
    }

    .chat-input input {
        font-size: 15px;
    }

    .chat-input button {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ✅ CORRECTION MOBILE : afficher la zone d'envoi */
html, body{
    height:100%;
}

body{
    overflow:hidden;
}

.chat-container{
    height:100vh;
    height:100dvh;
    min-height:0;
}

#chat-box{
    min-height:0;
    flex:1 1 auto;
    padding-bottom:20px;
}

.chat-input{
    flex-shrink:0;
    position:sticky;
    bottom:0;
    z-index:50;
}

/* ✅ Mobile */
@media (max-width:768px){

    body{
        height:100dvh;
        overflow:hidden;
    }

    .chat-container{
        height:100dvh;
        max-height:100dvh;
    }

    .button-bar{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    padding:10px;
    overflow-y:auto;
    max-height:170px;
    }

    .chat-button{
    min-width:0;
    width:100%;
    flex:none;
    padding:11px 8px;
    font-size:13px;
    border-radius:12px;
    }

    #chat-box{
    flex:1;
    min-height:0;
    overflow-y:auto;
    }

    .chat-input{
        flex-shrink:0;
        padding:8px;
        gap:6px;
    }

    .chat-input input{
        min-width:0;
        font-size:14px;
        padding:12px;
    }

    .chat-input button{
        margin-left:4px;
        padding:12px 14px;
        white-space:nowrap;
    }
}