/* ================================================================
   CHAT-PRIVE.CSS — Discussion Privée Style WhatsApp
   À inclure dans index.html APRÈS style.css
   ================================================================ */

/* ── EN-TÊTE DE LA DISCUSSION (réduit de 25%) ────────────────── */
.cp-header {
    background: #075E54;
    color: white;
    padding: 7px 12px;           /* était 10px 15px */
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 45px;            /* était 60px */
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cp-back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;             /* était 22px */
    cursor: pointer;
    padding: 4px 6px;
    flex-shrink: 0;
    line-height: 1;
}

.cp-avatar {
    width: 32px;                 /* était 42px */
    height: 32px;                /* était 42px */
    border-radius: 50%;
    background: #128C7E;
    border: 2px solid rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;             /* était 22px */
    flex-shrink: 0;
}

.cp-contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cp-contact-info b {
    font-size: 14px;             /* était 16px */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-contact-sub {
    font-size: 11px;             /* était 12px */
    opacity: 0.75;
    margin-top: 1px;
}

/* ── MENU 3 POINTS EN-TÊTE ────────────────────────────────────── */
.cp-header-actions {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.cp-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 50%;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.cp-menu-btn:active {
    background: rgba(255,255,255,0.15);
}

.cp-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    min-width: 170px;
    z-index: 10000;
    overflow: hidden;
}

.cp-dropdown.visible {
    display: block;
}

.cp-dropdown button {
    display: block;
    width: 100%;
    padding: 13px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background 0.12s;
}

.cp-dropdown button:hover {
    background: #f5f5f5;
}

.cp-dropdown button.cp-btn-danger {
    color: #e53935;
}

/* ── FOND DE LA ZONE MESSAGES (Motif WhatsApp) ────────────────── */
.cp-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    padding-bottom: 110px;      /* Marge sécurité barre de saisie (augmentée pour la reply bar) */
    background-color: #efeae2;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c0aa8c' fill-opacity='0.18'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    -webkit-overflow-scrolling: touch;
}

/* ── BULLES DE MESSAGES ───────────────────────────────────────── */
.cp-bubble-wrapper {
    display: flex;
    margin: 3px 6px;
    max-width: 100%;
    /* Transition pour l'effet swipe */
    transition: transform 0.18s ease-out;
}

/* Message de MOI → droite */
.cp-me {
    justify-content: flex-end;
}

/* Message de L'AUTRE → gauche */
.cp-other {
    justify-content: flex-start;
}

.cp-bubble {
    max-width: 76%;
    padding: 7px 10px 4px 10px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Bulle ENVOYÉE (vert clair WhatsApp) */
.cp-me .cp-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 3px;
}

.cp-me .cp-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid #dcf8c6;
    border-bottom: 8px solid transparent;
}

/* Bulle REÇUE (blanc) */
.cp-other .cp-bubble {
    background: #ffffff;
    border-bottom-left-radius: 3px;
}

.cp-other .cp-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid #ffffff;
    border-bottom: 8px solid transparent;
}

/* ── APERÇU DU MESSAGE CITÉ (RÉPONSE) DANS LA BULLE ──────────── */
.cp-reply-quote {
    background: rgba(0, 0, 0, 0.07);
    border-left: 3px solid #25D366;
    border-radius: 5px;
    padding: 5px 8px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: background 0.12s;
}

.cp-reply-quote:active {
    background: rgba(0,0,0,0.12);
}

.cp-me .cp-reply-quote {
    border-left-color: #128C7E;
}

.cp-reply-quote-author {
    font-size: 11px;
    font-weight: bold;
    color: #075E54;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-me .cp-reply-quote-author {
    color: #128C7E;
}

.cp-reply-quote-text {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.cp-reply-quote-media {
    font-size: 11px;
    color: #777;
    font-style: italic;
}

/* Texte du message */
.cp-bubble-text {
    font-size: 14px;
    line-height: 1.5;
    color: #303030;
    white-space: pre-wrap;
    margin-bottom: 2px;
}

/* Médias (images & vidéos) */
.cp-media-img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin: 4px 0 2px 0;
    cursor: pointer;
}

.cp-media-video {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin: 4px 0 2px 0;
}

/* Heure + coches */
.cp-time {
    font-size: 10px;
    color: #8d8d8d;
    text-align: right;
    margin-top: 2px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.cp-ticks {
    color: #4FC3F7;
    font-size: 12px;
}

/* ── SÉPARATEUR DE DATE ───────────────────────────────────────── */
.cp-date-sep {
    text-align: center;
    margin: 12px 0 8px;
}

.cp-date-sep span {
    background: rgba(255,255,255,0.85);
    color: #555;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ── BARRE DE SAISIE FIXÉE EN BAS ─────────────────────────────── */
.cp-input-container {
    background: #f0f0f0;
    padding: 8px 10px 15px 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 9998;
    box-sizing: border-box;
    border-top: 1px solid #ddd;
}

/* ── BARRE D'APERÇU DE RÉPONSE (au-dessus de la zone de saisie) ─ */
.cp-reply-preview-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #fff;
    border-left: 4px solid #25D366;
    border-radius: 6px;
    margin-bottom: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    animation: cp-slide-in 0.15s ease-out;
}

@keyframes cp-slide-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cp-reply-bar-inner {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.cp-reply-bar-user {
    font-size: 12px;
    font-weight: bold;
    color: #075E54;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-reply-bar-text {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-reply-bar-cancel {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.cp-reply-bar-cancel:active {
    color: #e53935;
}

/* ── RANGÉE DE SAISIE ─────────────────────────────────────────── */
.cp-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

/* Icônes 📷 et 📎 */
.cp-icon-btn {
    font-size: 26px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.cp-icon-btn:active {
    background: rgba(0,0,0,0.08);
}

/* Champ de saisie de texte */
.cp-input-field {
    flex: 1;
    min-height: 22px;
    max-height: 120px;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1px solid #ddd;
    background: white;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    word-break: break-word;
}

.cp-input-field:focus {
    border-color: #25D366;
}

.cp-input-field:empty:before {
    content: attr(placeholder);
    color: #aaa;
    font-style: italic;
    pointer-events: none;
}

/* Bouton ENVOYER vert rond */
.cp-send-btn {
    background: #25D366;
    color: white;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.cp-send-btn:active {
    background: #1ebd5a;
}

/* ── INDICATEUR DE CHARGEMENT ─────────────────────────────────── */
.cp-loading {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 14px;
}

/* ── MESSAGE VIDE ─────────────────────────────────────────────── */
.cp-empty {
    text-align: center;
    padding: 50px 20px;
    color: #999;
    font-size: 14px;
    line-height: 1.6;
}

/* ── APERÇU MÉDIA AVANT ENVOI ─────────────────────────────────── */
.cp-media-preview {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #e9f5e9;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid #25D366;
    font-size: 12px;
    color: #075E54;
}

.cp-media-preview.visible {
    display: flex;
}

.cp-media-preview img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.cp-media-preview-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-media-preview-cancel {
    background: none;
    border: none;
    color: #e53935;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
