/*
---------------------------------------------------------
 File        : chat.css
 Location    : /cr/assets/chat.css
 Description : Gaya untuk chat box, message bubble, notif popup
               dan file attachment viewer
 Updated     : 26-11-2025 21:15
 Developer   : Rizal Phoenix - SystemMate
---------------------------------------------------------
*/

/* ---------------------------------------------------------
   CHAT WRAPPER
--------------------------------------------------------- */
.chat-box {
    height: 540px;
    overflow-y: auto;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 10px;
    border: 1px solid #ddd;
}

/* ---------------------------------------------------------
   EACH MESSAGE
--------------------------------------------------------- */
.msg {
    margin-bottom: 14px;
    max-width: 78%;
    padding: 12px;
    border-radius: 10px;
    line-height: 1.4;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.msg.me {
    background: #ff7a00;
    color: #fff;
    margin-left: auto;
}

.msg.other {
    background: #ffffff;
    border: 1px solid #ddd;
}

/* SENDER NAME */
.msg-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    opacity: 0.9;
}

/* MESSAGE BODY */
.msg-body a {
    text-decoration: underline;
}

.msg.me .msg-body a {
    color: #ffe4c4;
}

.msg.other .msg-body a {
    color: #ff7a00;
}

/* ---------------------------------------------------------
   ATTACHMENT PREVIEW DALAM BUBBLE
--------------------------------------------------------- */
.msg-attachment {
    margin-top: 8px;
    font-size: 12px;
}

.msg-attachment-thumb {
    display: inline-block;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
}

.msg-attachment-thumb img {
    display: block;
    max-width: 180px;
    max-height: 140px;
}

.msg-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.04);
    cursor: pointer;
}

.msg.me .msg-attachment-link {
    background: rgba(0,0,0,0.12);
    color: #fff;
}

.msg.other .msg-attachment-link {
    background: #f2f2f2;
    color: #333;
}

.msg-attachment-link i {
    font-size: 13px;
}

/* ---------------------------------------------------------
   CHAT INPUT BAR
--------------------------------------------------------- */
.chat-input {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.chat-input input[type="text"] {
    flex: 1 1 auto;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.chat-input input[type="file"] {
    flex: 0 0 auto;
    font-size: 12px;
}

.chat-input button {
    background: #ff7a00;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    flex: 0 0 auto;
}

.chat-input button i {
    font-size: 16px;
}

.chat-input button:hover {
    filter: brightness(0.95);
}

/* ---------------------------------------------------------
   NAV BADGE UNTUK CHAT
--------------------------------------------------------- */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    margin-left: 4px;
    border-radius: 999px;
    background: #d40000;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
}

/* ---------------------------------------------------------
   TOAST NOTIFICATION
--------------------------------------------------------- */
.notif-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    max-width: 280px;
    font-size: 13px;
}

.notif-toast-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #222;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

.notif-toast-inner i {
    color: #ffcc00;
}

/* ---------------------------------------------------------
   FILE VIEWER MODAL
--------------------------------------------------------- */
.file-viewer {
    position: fixed;
    inset: 0;
    z-index: 9998;
}

.file-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
}

.file-viewer-modal {
    position: relative;
    max-width: 900px;
    margin: 40px auto;
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}

.file-viewer-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: #666;
}

.file-viewer-close:hover {
    color: #000;
}

.file-viewer-content {
    margin-top: 10px;
    text-align: center;
}

/* ---------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------- */
@media (max-width: 768px) {
    .chat-box {
        height: 420px;
        padding: 14px;
    }

    .msg {
        max-width: 100%;
    }

    .notif-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .file-viewer-modal {
        margin: 30px 10px;
        max-width: none;
    }
}
