
/* =====================================================
   Chat Premium — Design System
===================================================== */

:root{
    --accent:#4f7cff;
    --accent-dark:#3d63e0;
    --bubble-me:#dcf8e8;
    --bubble-me-text:#14532d;
    --bubble-them:#ffffff;
    --border:#e8edf5;
    --bg-page:#f5f7fb;
    --bg-chat:#f3f0ea;
    --text-main:#1f2937;
    --text-muted:#6b7280;
    --text-faint:#94a3b8;
    --radius-lg:20px;
    --radius-md:14px;
    --radius-sm:10px;
}

*{
    box-sizing:border-box;
}

html,
body{
    min-height:100%;
    overflow-x:hidden;
    overflow-y:auto;
}

body{
    margin:0;
    background-color: #f5f7fb !important;
    font-family:'Inter',system-ui,sans-serif;
    color:var(--text-main);
}

.mini-flag{
    width:18px;
    height:13px;
    object-fit:cover;
    border-radius:2px;
    vertical-align:middle;
    margin-right:4px;
}

/* =====================================================
   Wrapper — Two Column Layout
===================================================== */

.messenger-wrapper{
    display:grid;
    grid-template-columns:360px 1fr;
    height:100vh;
    max-width:1500px;
    margin:0 auto;
    background:#fff;
}

/* =====================================================
   Sidebar
===================================================== */

.messenger-sidebar{
    display:flex;
    flex-direction:column;
    background:#fff;
    border-right:1px solid var(--border);
    min-height:0;
}

.sidebar-topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:18px 18px 14px;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:10px;
    font-weight:800;
    font-size:17px;
}

.brand-badge{
    width:34px;
    height:34px;
    border-radius:11px;
    background: linear-gradient(135deg, #4f7cff, #3b6df5);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:16px;
    flex-shrink:0;
}

.sidebar-topbar-actions{
    display:flex;
    gap:6px;
}

.icon-btn{
    width:38px;
    height:38px;
    border-radius:50%;
    border:none;
    background:#f5f7fb;
    color:var(--text-muted);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:16px;
    cursor:pointer;
    transition:.2s;
    text-decoration:none;
    flex-shrink:0;
}

.icon-btn:hover{
    background:var(--accent);
    color:#fff;
}

.sidebar-search{
    display:flex;
    align-items:center;
    gap:8px;
    padding:0 18px 14px;
}

.sidebar-search form{
    flex:1;
    min-width:0;
}

.search-box{
    display:flex;
    align-items:center;
    gap:10px;
    background:#f5f7fb;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    padding:10px 14px;
}

.search-box i{
    color:var(--text-faint);
    font-size:15px;
}

.search-box input{
    flex:1;
    min-width:0;
    border:none;
    background:transparent;
    outline:none;
    font-size:14px;
    font-family:inherit;
}

.filter-btn{
    width:40px;
    height:40px;
    flex-shrink:0;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:#f5f7fb;
    color:var(--text-muted);
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

.sidebar-tabs{
    display:flex;
    padding:0 18px;
    border-bottom:1px solid var(--border);
    gap:24px;
}

.sidebar-tab{
    padding:0 2px 12px;
    text-decoration:none;
    font-weight:600;
    font-size:14px;
    color:var(--text-muted);
    border-bottom:2px solid transparent;
}

.sidebar-tab.active{
    color:#16a34a;
    border-bottom-color:#16a34a;
}

.sidebar-label{
    padding:14px 18px 8px;
    font-size:11px;
    font-weight:700;
    letter-spacing:.06em;
    color:var(--text-faint);
    text-transform:uppercase;
}

.sidebar-list{
    flex:1;
    overflow-y:auto;
    padding:0 10px 10px;
}

.sidebar-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px 8px;
    border-radius:var(--radius-md);
    text-decoration:none;
    color:inherit;
    transition:.15s;
    position:relative;
}

.sidebar-item:hover{
    background:#f5f7fb;
}

.sidebar-item.active{
    background:#eef9f1;
}

.sidebar-avatar{
    position:relative;
    flex-shrink:0;
}

.sidebar-avatar img{
    width:52px;
    height:52px;
    border-radius:50%;
    object-fit:cover;
}

.sidebar-online-dot{
    position:absolute;
    bottom:2px;
    right:2px;
    width:12px;
    height:12px;
    border-radius:50%;
    background:#2ecc71;
    border:2.5px solid #fff;
}

.sidebar-item-content{
    flex:1;
    min-width:0;
}

.sidebar-item-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:8px;
    margin-bottom:2px;
}

.sidebar-item-name{
    font-weight:700;
    font-size:14.5px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    display:flex;
    align-items:center;
}

.sidebar-item-time{
    font-size:12px;
    color:var(--text-faint);
    white-space:nowrap;
    flex-shrink:0;
}

.sidebar-item-preview{
    font-size:13px;
    color:var(--text-muted);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.sidebar-item.active .sidebar-item-preview{
    color:#166534;
    font-weight:600;
}

.sidebar-item-badge{
    position:absolute;
    top:10px;
    right:8px;
    min-width:20px;
    height:20px;
    border-radius:50%;
    background:#22c55e;
    color:#fff;
    font-size:11px;
    font-weight:700;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0 5px;
}

.sidebar-footer{
    padding:12px 18px 18px;
}

.new-message-btn{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    width:100%;
    padding:13px;
    border-radius:var(--radius-md);
    background:#4f7cff;
    color:#fff;
    font-weight:700;
    font-size:14px;
    text-decoration:none;
    transition:.2s;
}

.new-message-btn:hover{
    background:#16a34a;
    color:#fff;
    transform:translateY(-1px);
}


/*=========================================
ATTACH MENU
=========================================*/

.attach-menu{

    position:absolute;

    bottom:70px;

    left:52px;

    background:#fff;

    border-radius:14px;

    box-shadow:0 12px 35px rgba(0,0,0,.15);

    padding:8px;

    display:none;

    flex-direction:column;

    gap:6px;

    min-width:180px;

    z-index:999;

}

.attach-menu.show{

    display:flex;

}

.attach-option{

    border:none;

    background:none;

    padding:10px 14px;

    border-radius:10px;

    display:flex;

    align-items:center;

    gap:10px;

    cursor:pointer;

    transition:.18s;

}

.attach-option:hover{

    background:#f1f5f9;

}

/* =====================================================
   Chat Panel
===================================================== */

.messenger-chat{
    display:flex;
    flex-direction:column;
    min-height:0;
    background:var(--bg-chat);
    background-image:
        radial-gradient(rgba(0,0,0,.015) 1px, transparent 1px);
    background-size:16px 16px;
}

.chat-header{

    position:sticky;

    top:env(safe-area-inset-top);

    z-index:100;

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:14px 22px;

    background:#fff;

    border-bottom:1px solid var(--border);

    flex-shrink:0;

}

.chat-header-user{
    display:flex;
    align-items:center;
    gap:14px;
    min-width:0;
}



.chat-header-avatar img{
    width:48px;
    height:48px;
    border-radius:50%;
    object-fit:cover;
    border:2px solid #fff;
    box-shadow:0 3px 10px rgba(0,0,0,.08);
}

.chat-header-info{
    min-width:0;
}

.chat-header-name{
    font-weight:700;
    font-size:16px;
    display:flex;
    align-items:center;
    gap:8px;
}

.chat-online-dot{
    width:9px;
    height:9px;
    border-radius:50%;
    background:#2ecc71;
    display:inline-block;
}

.chat-header-meta{
    font-size:13px;
    color:var(--text-muted);
    display:flex;
    align-items:center;
    gap:6px;
    margin-top:2px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.meta-sep{
    color:var(--border);
}

.chat-header-actions{
    flex-shrink:0;
}

/* =====================================================
   Chat Body
===================================================== */

.chat-body{
    flex:1;
    overflow-y:auto;
    padding:22px 26px;
    display:flex;
    flex-direction:column;
    gap:2px;
    margin-top:72px;
}

.day-separator{
    display:flex;
    justify-content:center;
    margin:14px 0;
}

.day-pill{
    background:#fff;
    color:var(--text-muted);
    font-size:12px;
    font-weight:600;
    padding:6px 16px;
    border-radius:999px;
    box-shadow:0 2px 8px rgba(15,23,42,.06);
}


.msg-row{

    display:flex;

    align-items:flex-start;

    gap:10px;

    margin-bottom:12px;

    width:100%;
    position: relative;

}

.msg-row.them{

    justify-content:flex-start;

}

.msg-row.me{

    justify-content:flex-end;

    padding-right:8px;

}

.msg-avatar img{

    width:36px;

    height:36px;

    border-radius:50%;

    object-fit:cover;

}

.msg-avatar img{

    width:40px;

    height:40px;

    border-radius:50%;

    object-fit:cover;

    box-shadow:0 2px 8px rgba(0,0,0,.12);

}

.msg-bubble{

    position:relative;

    display:inline-block;

    width:auto;

    max-width:520px;

    padding:10px 14px;

    border-radius:18px;

    background:#fff;

    box-shadow:0 2px 8px rgba(0,0,0,.08);

}

.msg-content{

    display:inline-flex;

    align-items:flex-end;

    gap:8px;

    flex-wrap:wrap;

}

.msg-text{

    line-height:1.4;

    font-size:15px;

    word-break:break-word;
    padding-top: 10px;

}

.msg-meta{

    display:flex;

    align-items:center;

    gap:3px;

    font-size:11px;

    color:#94a3b8;

    white-space:nowrap;

    align-self:flex-end;

    flex-shrink:0;

    margin-bottom:1px;

}

.msg-bubble a{
    color:var(--accent);
    word-break:break-all;
}

.msg-row.me .msg-bubble{

    background:#dcf8e8;

}

.msg-row.me .msg-bubble a{
    color:#166534;
    text-decoration:underline;
}


/*=============================
Bubble Tail
=============================*/

.msg-row.them .msg-bubble::before{

    content:"";

    position:absolute;

    left:-8px;

    top:18px;

    width:16px;

    height:16px;

    background:#fff;

    clip-path:polygon(100% 0,0 50%,100% 100%);

}

.msg-row.me .msg-bubble::after{

    content:"";

    position:absolute;

    right:-8px;

    top:18px;

    width:16px;

    height:16px;

    background:var(--bubble-me);

    clip-path:polygon(0 0,100% 50%,0 100%);

}

/* =====================================================
   Message Media
===================================================== */

/*=========================================
PREMIUM MESSAGE GALLERY
=========================================*/

.msg-gallery{

    margin-top:10px;

    display:grid;

    gap:6px;

    width:100%;

    max-width:420px;

}

/*=========================================
IMAGES
=========================================*/

.msg-gallery img{

    width:100%;

    height:100%;

    display:block;

    object-fit:cover;

    border-radius:14px;

    cursor:pointer;

    transition:
    transform .18s ease,
    filter .18s ease;

    box-shadow:
    0 6px 18px rgba(0,0,0,.14);

}

.msg-gallery img:hover{

    transform:scale(1.02);

    filter:brightness(.96);

}

/*=========================================
1 IMAGE
=========================================*/

.gallery-1{

    grid-template-columns:1fr;

}

.gallery-1 img{

    max-height:420px;

    aspect-ratio:4/5;

}

/*=========================================
2 IMAGES
=========================================*/

.gallery-2{

    grid-template-columns:repeat(2,1fr);

}

.gallery-2 img{

    aspect-ratio:1/1;

}

/*=========================================
3 IMAGES
=========================================*/

.gallery-3{

    grid-template-columns:2fr 1fr;

    grid-template-rows:1fr 1fr;

}

.gallery-3 img:first-child{

    grid-row:1 / span 2;

    aspect-ratio:auto;

    height:100%;

}

.gallery-3 img:not(:first-child){

    aspect-ratio:1/1;

}

/*=========================================
4+ IMAGES
=========================================*/

.gallery-4,
.gallery-5{

    grid-template-columns:repeat(2,1fr);

}

.gallery-4 img,
.gallery-5 img{

    aspect-ratio:1/1;

}

/*=========================================
IMAGE TILE
=========================================*/

.gallery-item{

    position:relative;

    overflow:hidden;

    border-radius:14px;

}

/*=========================================
+MORE BADGE
=========================================*/

.gallery-more{

    position:absolute;

    inset:0;

    display:flex;

    align-items:center;

    justify-content:center;

    background:rgba(0,0,0,.55);

    backdrop-filter:blur(3px);

    color:#fff;

    font-size:34px;

    font-weight:700;

    letter-spacing:.5px;

    transition:.2s;

}

.gallery-item{

    position:relative;

    overflow:hidden;

    border-radius:14px;

}

.gallery-item:hover .gallery-more{

    background:rgba(0,0,0,.42);

}

/*=========================================
ANIMATION
=========================================*/

.msg-gallery{

    animation:galleryFade .25s ease;

}

@keyframes galleryFade{

    from{

        opacity:0;

        transform:translateY(8px);

    }

    to{

        opacity:1;

        transform:none;

    }

}

.link-preview-card{
    display:block;
    margin-top:8px;
    max-width:280px;
    background:#f8fafc;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    overflow:hidden;
    text-decoration:none;
    color:inherit;
}

.link-preview-image{
    width:100%;
    height:120px;
    object-fit:cover;
    display:block;
}

.link-preview-body{
    padding:10px 12px;
}

.link-preview-body strong{
    display:block;
    font-size:13.5px;
    color:var(--text-main);
    margin-bottom:3px;
}

.link-preview-desc{
    font-size:12px;
    color:var(--text-muted);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    margin-bottom:4px;
}

.link-preview-domain{
    font-size:11px;
    color:var(--text-faint);
    text-transform:lowercase;
}

/* =====================================================
   Reactions
===================================================== */

.msg-reactions-wrap{
    position:relative;
    display:flex;
    justify-content:flex-end;
    margin-top:6px;
}

.reaction-toggle-btn{

    width:30px;

    height:30px;

    border:none;

    border-radius:50%;

    background:#ffffff;

    color:#64748b;

    display:flex;

    align-items:center;

    justify-content:center;

    box-shadow:
    0 2px 8px rgba(0,0,0,.12);

    cursor:pointer;

    opacity:0;

    transform:scale(.8);

    transition:.25s;

}

.msg-bubble:hover .reaction-toggle-btn{

    opacity:1;

    transform:scale(1);

}

.reaction-toggle-btn:hover{

    background:#f8fafc;

    color:#4f7cff;

}

.reaction-picker{
    display:none;
    position:absolute;
    bottom:32px;
    right:0;
    background:#fff;
    border-radius:30px;
    padding:8px 12px;
    box-shadow:0 8px 25px rgba(0,0,0,.15);
    z-index:20;
    white-space:nowrap;
}

.reaction-picker.show{
    display:block;
}

.reaction-picker a{
    text-decoration:none;
    font-size:20px;
    margin-right:8px;
}

.reaction-picker a:last-child{
    margin-right:0;
}

.msg-reactions-list{
    margin-top:5px;
    display:flex;
    gap:5px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

.reaction-badge{
    background:rgba(0,0,0,.05);
    border-radius:20px;
    padding:2px 8px;
    font-size:12px;
    font-weight:600;
}

/* =====================================================
   Message Meta (time + ticks)
===================================================== */

.msg-meta{
    margin-top:5px;
    font-size:11px;
    color:var(--text-faint);
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:5px;
}

.edited-label{

    margin-left:4px;

    font-size:11px;

    opacity:.7;

    font-style:italic;

}

.msg-row.me .msg-meta{
    color:#3f7d54;
}

.msg-tick.seen{
    color:#2563eb;
}

.msg-tick.delivered{
    color:#d97706;
}

.msg-tick.sent{
    color:#16a34a;
}

/* =====================================================
   Chat Input Form
===================================================== */

.chat-input-form{

    position:sticky;

    bottom:0;

    z-index:100;

    background:#fff;

    border-top:1px solid var(--border);

    padding:14px 22px;

    flex-shrink:0;

}

.emoji-picker{
    display:none;
    flex-wrap:wrap;
    gap:6px;
    background:#f5f7fb;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    padding:10px;
    margin-bottom:10px;
}

.emoji-picker.show{
    display:flex;
}

.emoji-picker .emoji{
    border:none;
    background:#fff;
    border-radius:10px;
    width:36px;
    height:36px;
    font-size:18px;
    cursor:pointer;
    transition:.15s;
}

.emoji-picker .emoji:hover{
    background:var(--accent);
    transform:scale(1.08);
}

.image-preview-wrap{

    display:none;

    margin-bottom:12px;

}

.image-preview-wrap.show{

    display:block;

}

.image-preview-grid{

    display:flex;

    flex-wrap:wrap;

    gap:10px;

}

.preview-item{

    position:relative;

}

.preview-item img{

    width:90px;

    height:90px;

    object-fit:cover;

    border-radius:12px;

    box-shadow:0 4px 12px rgba(0,0,0,.12);

}

.remove-preview-btn{

    position:absolute;

    top:-6px;

    right:-6px;

    width:24px;

    height:24px;

    border:none;

    border-radius:50%;

    background:#ef4444;

    color:#fff;

    font-size:12px;

    cursor:pointer;

    display:flex;

    align-items:center;

    justify-content:center;

}

.chat-input-bar{
    display:flex;
    align-items:flex-end;
    gap:8px;
    background:#f5f7fb;
    border:1px solid var(--border);
    border-radius:22px;
    padding:8px 10px;
}

.chat-input-bar label.icon-btn{
    cursor:pointer;
}

.chat-input-bar textarea{
    flex:1;
    min-width:0;
    border:none;
    background:transparent;
    outline:none;
    resize:none;
    font-family:inherit;
    font-size:14.5px;
    padding:8px 6px;
    max-height:120px;
    line-height:1.4;
}

.send-btn{
    width:40px;
    height:40px;
    border-radius:50%;
    border:none;
    background:#4f7cff;
    color:#fff;
    font-size:16px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    flex-shrink:0;
    transition:.2s;
}

.send-btn:hover{
    background:#16a34a;
    transform:scale(1.05);
}


.send-btn:disabled{

    cursor:not-allowed;

    opacity:.9;

    transform:none;

}

.sending-text{

    margin-right:10px;

    color:#6b7280;

    font-size:13px;

    font-weight:600;

    white-space:nowrap;

    animation:pulse .9s infinite;

}

@keyframes pulse{

    0%{opacity:.45;}

    50%{opacity:1;}

    100%{opacity:.45;}

}

/* =====================================================
   Scrollbars
===================================================== */

.sidebar-list::-webkit-scrollbar,
.chat-body::-webkit-scrollbar{
    width:7px;
}

.sidebar-list::-webkit-scrollbar-thumb,
.chat-body::-webkit-scrollbar-thumb{
    background:#d5dbe4;
    border-radius:30px;
}

.sidebar-list::-webkit-scrollbar-thumb:hover,
.chat-body::-webkit-scrollbar-thumb:hover{
    background:#b7c0cc;
}

/* =====================================================
   RESPONSIVE
===================================================== */

/* Tablette : sidebar plus étroite */
@media(max-width:1100px){

    .messenger-wrapper{
        grid-template-columns:300px 1fr;
    }

    .chat-body{
        padding:18px 20px;
    }
}

/* Mobile : layout en une seule colonne, bascule sidebar <-> chat */
@media (max-width:860px){

    .messenger-wrapper{
        display:block;
        height:auto;
    }

    /* On masque simplement la sidebar */
    .messenger-sidebar{
        display:none;
    }

    /* Le chat prend toute la largeur */
    .messenger-chat{
        position:relative;
        inset:auto;
        width:100%;
        height:100vh;
    }

    .chat-header{
        padding:12px 14px;
    }

    .chat-body{
        padding:14px;
    }

    .msg-row{
        max-width:90%;
    }

    .chat-input-form{
        padding:10px 12px;
    }
}

.chat-back-btn{
    display:none;
    width:38px;
    height:38px;
    border-radius:50%;
    border:none;
    background:#f5f7fb;
    color:var(--text-muted);
    align-items:center;
    justify-content:center;
    font-size:17px;
    margin-right:6px;
    cursor:pointer;
    text-decoration:none;
    flex-shrink:0;
}

@media(max-width:576px){

    .chat-header{
        padding:12px 14px;
    }

    .chat-header-avatar img{
        width:42px;
        height:42px;
    }

    .chat-header-name{
        font-size:15px;
    }

    .chat-header-meta{
        font-size:12px;
    }

    .chat-body{
        padding:14px 12px;
    }

.msg-row{

    max-width:100%;

}

.msg-row.me{

    padding-left:18%;

    padding-right:4px;

}

.msg-row.them{

    padding-right:18%;

}

    .msg-bubble{
        font-size:14px;
        padding:9px 12px;
    }

    .chat-input-form{
        padding:10px 12px;
    }

    .link-preview-card{
        max-width:220px;
    }

    .sidebar-topbar{
        padding:14px 14px 10px;
    }

    .sidebar-search{
        padding:0 14px 12px;
    }

    .sidebar-tabs{
        padding:0 14px;
    }

    .sidebar-label{
        padding:12px 14px 6px;
    }

    .sidebar-footer{
        padding:10px 14px 14px;
    }
    
    
     .msg-gallery{

        max-width:100%;

        gap:4px;

    }

    .msg-gallery img{

        border-radius:10px;

    }

    .gallery-more{

        font-size:22px;

    }

}
}


/*=========================================
Search Conversation
=========================================*/

.conversation-search{

    background:#ffffff;

    border-bottom:1px solid #e8edf5;

    padding:16px 22px;

}

.search-box{

    display:flex;

    align-items:center;

    gap:12px;

    background:#f7f9fc;

    border:1px solid #e6edf5;

    border-radius:14px;

    padding:10px 14px;

}

.search-box i{

    color:#6b7280;

    font-size:18px;

}

.search-box input{

    flex:1;

    border:none;

    background:transparent;

    outline:none;

    font-size:15px;

}

.search-close{

    border:none;

    background:none;

    font-size:18px;

    color:#6b7280;

}

.search-result-info{

    margin-top:10px;

    font-size:13px;

    color:#6b7280;

}


/*ONLINE CSS*/
.online-text{

    color:#16a34a;

    font-size:13px;

    font-weight:600;

}

.last-seen{

    color:#94a3b8;

    font-size:12px;

    font-weight:500;

}


.typing-text{

    color:#4f7cff;

    font-size:13px;

    font-weight:600;

    animation:typingPulse .9s infinite;

}

@keyframes typingPulse{

    0%{opacity:.45;}

    50%{opacity:1;}

    100%{opacity:.45;}

}


/*=========================================
IMAGE VIEWER PREMIUM
=========================================*/

.image-viewer{

    position:fixed;

    inset:0;

    background:rgba(8,15,30,.92);

    backdrop-filter:blur(10px);

    opacity:0;

    visibility:hidden;

    pointer-events:none;

    transition:
    opacity .25s ease,
    visibility .25s ease;

    z-index:5000;

}

.image-viewer.active{

    opacity:1;

    visibility:visible;

    pointer-events:auto;

}

/*=========================================
Overlay
=========================================*/

.viewer-overlay{

    position:absolute;

    inset:0;

    cursor:zoom-out;

}

/*=========================================
Toolbar
=========================================*/

.viewer-toolbar{

    position:absolute;

    top:18px;

    left:50%;

    transform:translateX(-50%);

    display:flex;

    align-items:center;

    gap:10px;

    padding:10px 14px;

    background:rgba(255,255,255,.08);

    backdrop-filter:blur(18px);

    border:1px solid rgba(255,255,255,.12);

    border-radius:999px;

    z-index:10;

    box-shadow:
    0 12px 40px rgba(0,0,0,.30);

}

/*=========================================
Buttons
=========================================*/

.viewer-btn{

    width:42px;

    height:42px;

    border:none;

    border-radius:50%;

    display:flex;

    align-items:center;

    justify-content:center;

    background:rgba(255,255,255,.12);

    color:#fff;

    font-size:18px;

    cursor:pointer;

    transition:.25s;

}

.viewer-btn:hover{

    background:#4f7cff;

    transform:translateY(-2px);

}

.viewer-btn:active{

    transform:scale(.94);

}

/*=========================================
Zoom
=========================================*/

.viewer-zoom{

    min-width:70px;

    text-align:center;

    color:#fff;

    font-size:14px;

    font-weight:700;

    letter-spacing:.3px;

}


.viewer-counter{

    min-width:70px;

    text-align:center;

    color:#fff;

    font-size:14px;

    font-weight:700;

    opacity:.9;

}

/*=========================================
Stage
=========================================*/

.viewer-stage{

    position:absolute;

    inset:0;

    display:flex;

    align-items:center;

    justify-content:center;

    overflow:hidden;

    padding:90px 30px 40px;

}

/*=========================================
Image
=========================================*/

.viewer-image{

    max-width:92vw;

    max-height:84vh;

    object-fit:contain;

    user-select:none;

    cursor:grab;

    transition:

    transform .18s ease,

    box-shadow .25s ease;

    transform-origin:center center;

    box-shadow:

    0 25px 70px rgba(0,0,0,.45);

    border-radius:18px;

}

.viewer-image.dragging{

    cursor:grabbing;

    transition:none;

}

/*=========================================
Animation
=========================================*/

.image-viewer.active .viewer-image{

    animation:

    viewerZoomIn .22s ease;

}

@keyframes viewerZoomIn{

    from{

        opacity:0;

        transform:scale(.92);

    }

    to{

        opacity:1;

        transform:scale(1);

    }

}

/*=========================================
Scrollbar
=========================================*/

.viewer-stage::-webkit-scrollbar{

    width:8px;

    height:8px;

}

.viewer-stage::-webkit-scrollbar-thumb{

    background:rgba(255,255,255,.25);

    border-radius:20px;

}

/*=========================================
Tablet
=========================================*/

@media(max-width:991px){

.viewer-toolbar{

    gap:8px;

    padding:8px 12px;

}

.viewer-btn{

    width:38px;

    height:38px;

    font-size:16px;

}

.viewer-image{

    max-width:95vw;

    max-height:80vh;

}

}


/*=========================================
Mobile
=========================================*/

@media (max-width:768px){

    /* Viewer */

    .viewer-toolbar{

        top:12px;

        width:calc(100% - 24px);

        justify-content:space-between;

        padding:8px 10px;

        border-radius:18px;

    }

    #viewerPrev,
    #viewerNext,
    #viewerReset{

        display:none;

    }

    .viewer-btn{

        width:36px;

        height:36px;

        font-size:15px;

    }

    .viewer-zoom{

        min-width:auto;

        font-size:13px;

    }

    .viewer-stage{

        padding:70px 10px 20px;

    }

    .viewer-image{

        max-width:100%;

        max-height:78vh;

        border-radius:14px;

    }

    /* Chat */

    .icon-btn{

        width:36px;

        height:36px;

        font-size:18px;

    }

    .chat-input-bar{

        gap:6px;

    }

    #messageBox{

        flex:1;

        min-width:0;

    }

    .chat-input-form{

        position:fixed;

        left:0;

        right:0;

        bottom:0;

        z-index:1000;

        background:#fff;

        border-top:1px solid var(--border);

    }
    
.chat-header{

    position:fixed;

    top:0;

    left:0;

    right:0;

    z-index:1000;

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:14px 22px;

    background:#fff;

    border-bottom:1px solid var(--border);

}

    .chat-body{

        padding-bottom:90px;

    }

    label[for="cameraInput"]{

        display:none;

    }

}


/*=========================================
Very Small Mobile
=========================================*/

@media(max-width:480px){

.viewer-toolbar{

    gap:6px;

}

.viewer-btn{

    width:34px;

    height:34px;

    font-size:14px;

}

.viewer-zoom{

    font-size:12px;

}

}


/*=========================================
Drag & Drop
=========================================*/

.chat-input-bar.drag-over{

    border:2px dashed #4f7cff;

    background:#eef4ff;

    transition:.2s;

}

.chat-input-bar.drag-over::after{

    content:"📷 Drop your image here";

    position:absolute;

    left:50%;

    top:-34px;

    transform:translateX(-50%);

    background:#4f7cff;

    color:#fff;

    padding:6px 14px;

    border-radius:20px;

    font-size:13px;

    font-weight:600;

}

.chat-input-bar{

    position:relative;

}


/*=========================================
MESSAGE MENU - OPTIONS
=========================================*/

.message-dropdown{

    position:absolute;

    top:-8px;
    right:12px;

    z-index:5;

    opacity:.85;

    transition:
        opacity .18s ease,
        transform .18s ease;

}

.msg-row:hover .message-dropdown{

    opacity:1;

}

.message-menu{

    border:none;

    background:transparent;

    color:#94a3b8;

    font-size:18px;

    cursor:pointer;

    /*padding:4px;*/

    border-radius:50%;

    transition:.18s;
    padding-top: 8px;

}

.message-menu:hover{

    color:#4f7cff;

    background:#eef4ff;

    transform:scale(1.08);

}

@media (max-width:768px){

    .message-dropdown{

        opacity:1;

    }

}


/*=========================================
MESSAGE REPLY
=========================================*/

.reply-card{

    width:100%;

    max-width:100%;

    overflow:hidden;

    cursor:pointer;
    background-color: #d6d6d6;
    padding: 3px;
    border-radius: 10px;
    font-size: 13px;

}

.reply-card:hover{

    background:#dbeafe;

}

.reply-author{

    font-size:12px;

    font-weight:700;

    color:#2563eb;

    margin-bottom:2px;

}

.reply-snippet{

    display:flex;

    align-items:center;

    gap:8px;

}

.reply-snippet{

    flex:1;

    min-width:0;

    overflow:hidden;

    text-overflow:ellipsis;

    overflow-wrap:anywhere;

}


/*=========================================
REPLY HIGHLIGHT
=========================================*/

.message-highlight{

    animation:replyFlash 1.8s ease;

}

@keyframes replyFlash{

    0%{

        transform:scale(1);

        box-shadow:none;

    }

    20%{

        transform:scale(1.02);

        box-shadow:0 0 0 5px rgba(79,124,255,.18);

        background:#fff7cc;

    }

    100%{

        transform:scale(1);

        box-shadow:none;

        background:inherit;

    }

}


/*=========================================
REPLY PREVIEW
=========================================*/

.reply-preview{

    display:flex;

    justify-content:space-between;

    align-items:flex-start;

    gap:14px;

    background:#eef4ff;

    border-left:4px solid #4f7cff;

    border-radius:12px;

    padding:12px 14px;

    margin-bottom:10px;

}

.reply-preview-content{

    flex:1;

    min-width:0;

}

.reply-preview-body{

    display:flex;

    align-items:center;

    gap:10px;

}

.reply-preview-thumb{

    width:42px;

    height:42px;

    border-radius:8px;

    object-fit:cover;

    flex-shrink:0;

    border:1px solid #dbe5f1;

}

.reply-preview-title{

    font-size:13px;

    font-weight:700;

    color:#4f7cff;

    margin-bottom:4px;

}

.reply-preview-text{

    font-size:13px;

    color:#475569;

    white-space:nowrap;

    overflow:hidden;

    text-overflow:ellipsis;

}

.reply-close{

    border:none;

    background:none;

    color:#94a3b8;

    font-size:18px;

    cursor:pointer;

}

.reply-close:hover{

    color:#ef4444;

}

/*=========================================
COPY TOAST
=========================================*/

.copy-toast{

    position:fixed;

    left:50%;

    bottom:28px;

    transform:translateX(-50%);

    background:#111827;

    color:#fff;

    padding:10px 18px;

    border-radius:24px;

    font-size:14px;

    font-weight:600;

    opacity:0;

    transition:.25s;

    z-index:99999;

}

.copy-toast.show{

    opacity:1;

}

.forward-label{

    display:flex;

    align-items:center;

    gap:6px;

    font-size:12px;

    font-style:italic;

    color:#6c757d;

    margin-bottom:6px;

    opacity:.9;

}

.forward-label i{

    font-size:12px;

}

/*=========================================
FORWARD MODAL
=========================================*/

#forwardConversationList{

    max-height:420px;

    overflow-y:auto;

}

.forward-user{

    display:flex;

    align-items:center;

    gap:12px;

    padding:10px 12px;

    border-radius:12px;

    cursor:pointer;

    transition:.2s;

    margin-bottom:6px;

}

.forward-user:hover{

    background:#f5f7fb;

}

.forward-user input{

    margin:0;

}

.forward-user img{

    width:46px;

    height:46px;

    border-radius:50%;

    object-fit:cover;

    flex-shrink:0;

}

.forward-user span{

    font-weight:600;

    color:#1f2937;

    font-size:15px;

    overflow:hidden;

    text-overflow:ellipsis;

    white-space:nowrap;

}

#forwardSearch{

    border-radius:14px;

    margin-bottom:15px;

}

#forwardSendBtn{

    border-radius:12px;

    padding:8px 22px;

}


.forward-avatar{

    position:relative;

    width:46px;

    height:46px;

    flex-shrink:0;

}

.forward-avatar img{

    width:46px;

    height:46px;

    border-radius:50%;

    object-fit:cover;

}

.forward-avatar .online-dot{

    position:absolute;

    right:2px;

    bottom:2px;

    width:10px;

    height:10px;

    background:#22c55e;

    border:2px solid #fff;

    border-radius:50%;

}


/*==================================================
MESSAGE ACTION MENU (Reply • Copy • Edit • Forward)
==================================================*/

.dropdown-menu{

    border:none;
    border-radius:18px;
    padding:8px;
    min-width:220px;

    background:#ffffff;

    box-shadow:
        0 18px 45px rgba(15,23,42,.16);

    overflow:hidden;

    animation:menuFade .18s ease;
}

@keyframes menuFade{

    from{

        opacity:0;
        transform:translateY(8px) scale(.98);

    }

    to{

        opacity:1;
        transform:none;

    }

}

.dropdown-item{

    display:flex;
    align-items:center;
    gap:12px;

    border-radius:12px;

    padding:11px 14px;

    font-size:14px;
    font-weight:600;

    color:#334155 !important;

    text-decoration:none !important;

    transition:.18s;
}

.dropdown-item:hover{

    background:#eef4ff;
    color:#4f7cff !important;

    transform:translateX(3px);

    text-decoration:none !important;
}

.dropdown-item:focus{

    background:#eef4ff;
    color:#4f7cff !important;

    text-decoration:none !important;

    box-shadow:none;
}

.dropdown-item:active{

    background:#dbeafe;
}

.dropdown-item.text-danger{

    color:#ef4444 !important;
}

.dropdown-item.text-danger:hover{

    background:#fef2f2;
    color:#dc2626 !important;
}

.dropdown-divider{

    margin:6px 0;

    border-color:#eef2f7;

    opacity:1;
}


/*HOME BTN */

.home-chat-btn{

    position:relative;

}

.home-chat-btn{

    position:relative;

}

.chat-home-badge{

    position:absolute;

    top:-4px;

    right:-4px;

    min-width:18px;

    height:18px;

    padding:0 5px;

    border-radius:999px;

    background:#ef4444;

    color:#fff;

    font-size:10px;

    font-weight:700;

    display:flex;

    align-items:center;

    justify-content:center;

    line-height:1;

}

.home-badge{

    position:absolute;

    top:-4px;

    right:-4px;

    min-width:18px;

    height:18px;

    border-radius:999px;

    background:#ef4444;

    color:#fff;

    font-size:11px;

    font-weight:700;

    display:flex;

    align-items:center;

    justify-content:center;

    padding:0 5px;

}

/*FETCH MESSAGE SCRIPT*/
.live-message-images{

    display:flex;

    flex-wrap:wrap;

    gap:8px;

    margin-top:8px;

}

.live-message-image{

    width:180px;

    max-width:100%;

    border-radius:12px;

    cursor:pointer;

    object-fit:cover;

}


/*AppendMessage Script For image*/
.live-gallery{

    display:grid;

    grid-template-columns:repeat(2,1fr);

    gap:6px;

    margin-top:8px;

}

.live-gallery-image{

    width:100%;

    aspect-ratio:1/1;

    object-fit:cover;

    border-radius:10px;

    display:block;

}

.message-images{

    display:grid;

    grid-template-columns:repeat(2,minmax(0,1fr));

    gap:8px;

    margin-top:8px;

}

.message-image{

    width:100%;

    height:160px;

    object-fit:cover;

    border-radius:12px;

    cursor:pointer;

    display:block;

}
