/* Widget de contact flottant (WhatsApp / tawk.to / Chat direct) — reutilise
   sur les pages qui n'incluent pas home-styles.css (connexion, creation de
   compte, mot de passe oublie...). Valeurs de repli fournies pour les
   variables CSS au cas ou la page hote ne les definit pas deja. */
.contact-widget-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    transition: transform .2s var(--ease, cubic-bezier(.22, .61, .36, 1)), box-shadow .2s var(--ease, cubic-bezier(.22, .61, .36, 1));
    text-decoration: none;
}

.contact-widget-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 28px rgba(0,0,0,.28);
    color: #fff;
}

.contact-widget-whatsapp { background: #25d366; }
.contact-widget-direct { background: linear-gradient(135deg, var(--color-primary, #1a4f8a), var(--color-secondary, #0d2845)); }

.direct-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 94px;
    width: min(340px, calc(100vw - 48px));
    height: min(460px, calc(100vh - 160px));
    background: #fff;
    border-radius: var(--radius-lg, 18px);
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1050;
}

.direct-chat-panel[hidden] {
    display: none;
}

.direct-chat-header {
    background: linear-gradient(135deg, var(--color-primary, #1a4f8a), var(--color-secondary, #0d2845));
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
}

.direct-chat-header span { display: flex; align-items: center; gap: 8px; }

.direct-chat-header button {
    background: rgba(255,255,255,.18);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.direct-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}

.direct-chat-bubble {
    max-width: 80%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
}

.direct-chat-bubble.is-admin {
    align-self: flex-start;
    background: #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.direct-chat-bubble.is-visitor {
    align-self: flex-end;
    background: var(--color-primary, #1a4f8a);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.direct-chat-form {
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
}

.direct-chat-prechat {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 18px;
    background: #f8fafc;
    overflow-y: auto;
}

.direct-chat-prechat-greeting {
    margin: 0 0 14px;
    align-self: flex-start;
}

.direct-chat-prechat-intro {
    margin: 0 0 16px;
    font-size: 13.5px;
    color: #475569;
    line-height: 1.5;
}

.direct-chat-prechat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.direct-chat-prechat-form input {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    background: #fff;
}

.direct-chat-prechat-form input:focus { outline: none; border-color: var(--color-primary, #1a4f8a); }

.direct-chat-prechat-submit {
    margin-top: 4px;
    border: none;
    border-radius: var(--radius-pill, 999px);
    padding: 11px 16px;
    background: var(--color-primary, #1a4f8a);
    color: #fff;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
}

.direct-chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.direct-chat-prechat[hidden],
.direct-chat-conversation[hidden] {
    display: none;
}

.direct-chat-input-row { display: flex; gap: 8px; }

.direct-chat-input-row input[type="text"] {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-pill, 999px);
    padding: 9px 14px;
    font-size: 13.5px;
}

.direct-chat-input-row input[type="text"]:focus { outline: none; border-color: var(--color-primary, #1a4f8a); }

.direct-chat-input-row button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary, #1a4f8a);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .contact-widget-btn { right: 16px; bottom: 16px; width: 52px; height: 52px; font-size: 22px; }
    .direct-chat-panel { right: 12px; bottom: 80px; }
}
