/* ---- Base ---- */
html { font-size: 14px; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; color: #1a1a1a; background: #f4f6f9; }

.header {
    background: #fff;
    border-bottom: 1px solid #e8ecef;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* ---- Message Centre ---- */

.msg-centre-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.msg-centre-page-header h1 {
    font-weight: 700 !important;
    margin: 0;
    font-size: 1.6rem;
}
.msg-centre-page-header .fa {
    font-size: 1.5rem;
    color: #0078d4;
}
.msg-centre-breadcrumb {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}
.msg-centre-breadcrumb a {
    color: #0078d4;
}
.msg-centre-breadcrumb .fa-chevron-right {
    font-size: 10px;
    color: #aaa;
    margin: 0 4px;
}

.msg-centre-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.msg-centre-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 8px;
}
.msg-centre-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
}
.msg-centre-header .badge {
    background: rgba(255,255,255,.2);
    color: #fff;
    font-weight: 500;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
}
.msg-centre-search {
    position: relative;
}
.msg-centre-search input {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    border-radius: 20px;
    padding: 5px 14px 5px 32px;
    font-size: 13px;
    width: 180px;
    transition: background .2s, width .2s;
}
.msg-centre-search input::placeholder {
    color: rgba(255,255,255,.6);
}
.msg-centre-search input:focus {
    background: rgba(255,255,255,.25);
    outline: none;
    width: 220px;
    box-shadow: none;
}
.msg-centre-search .fa {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.6);
    font-size: 13px;
}

.msg-centre-body {
    height: 460px;
    overflow-y: auto;
    padding: 16px 20px;
    background: #f7f9fc;
}
.msg-centre-body::-webkit-scrollbar {
    width: 6px;
}
.msg-centre-body::-webkit-scrollbar-thumb {
    background: #c0c6cc;
    border-radius: 3px;
}

.msg-centre-footer {
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid #e8ecef;
}
.msg-reply-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.msg-reply-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.msg-reply-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.msg-centre-footer textarea {
    flex: 1;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
    transition: border-color .2s;
    font-family: inherit;
}
.msg-centre-footer textarea:focus {
    border-color: #0078d4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}
.msg-centre-footer .btn-send,
.btn-send {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.msg-centre-footer .btn-send:hover:not(:disabled),
.btn-send:hover:not(:disabled) {
    opacity: .9;
    transform: translateY(-1px);
}
.msg-centre-footer .btn-send:disabled,
.btn-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Message bubbles */
.msg-bubble-wrap {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: flex-start;
}
.msg-bubble-wrap--self {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    letter-spacing: .5px;
}
.msg-avatar--other {
    background: #0078d4;
}
.msg-avatar--self {
    background: #107c10;
}

.msg-bubble {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.45;
}
.msg-bubble--other {
    background: #fff;
    border: 1px solid #e0e4ea;
    border-top-left-radius: 2px;
    color: #1a1a1a;
}
.msg-bubble--self {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-top-right-radius: 2px;
    color: #1a1a1a;
}

.msg-sender {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}
.msg-bubble--other .msg-sender {
    color: #0078d4;
}
.msg-bubble--self .msg-sender {
    color: #107c10;
}

.msg-text {
    font-size: 14px;
    color: #333;
    white-space: pre-wrap;
}

.msg-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

/* Sidebar card */
.msg-info-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    padding: 20px;
}

.msg-sidebar-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    overflow: hidden;
}
.msg-sidebar-header {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.msg-sidebar-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.35);
}
.msg-sidebar-name {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
}
.msg-sidebar-role {
    font-size: 12px;
    color: rgba(255,255,255,.75);
    margin-top: 2px;
}
.msg-status-dot {
    font-size: 8px;
    color: #4caf50;
    margin-right: 3px;
}
.msg-sidebar-body {
    padding: 16px 20px;
}
.msg-sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 8px;
}
.msg-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 13.5px;
    color: #444;
}
.msg-sidebar-item .fa {
    color: #0078d4;
    width: 16px;
    text-align: center;
    font-size: 14px;
}
.msg-sidebar-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 12px 0;
}

/* Conversation list items */
.msg-conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid #f5f5f5;
}
.msg-conversation-item:last-child {
    border-bottom: none;
}
.msg-conversation-item:hover {
    background: #f0f4ff;
}
.msg-conversation-item.active {
    background: #e3f0fc;
}
.msg-conversation-item .msg-conv-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e0e4ea;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.msg-conversation-item .msg-conv-avatar.has-unread {
    background: #0078d4;
    color: #fff;
}
.msg-conversation-item .msg-conv-info {
    flex: 1;
    min-width: 0;
}
.msg-conversation-item .msg-conv-name {
    font-size: 13.5px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-conversation-item .msg-conv-name.unread {
    font-weight: 700;
}
.msg-conversation-item .msg-conv-preview {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.msg-conversation-item .msg-conv-meta {
    text-align: right;
    flex-shrink: 0;
}
.msg-conversation-item .msg-conv-time {
    font-size: 11px;
    color: #999;
}
.msg-conversation-item .msg-conv-badge {
    background: #0078d4;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 4px;
}

/* Empty state */
.msg-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #aaa;
    text-align: center;
    padding: 40px 20px;
}
.msg-empty-state .fa {
    font-size: 48px;
    margin-bottom: 16px;
    color: #d0d5dd;
}
.msg-empty-state p {
    font-size: 15px;
    margin: 0;
}

/* Attach button */
.btn-attach {
    background: none;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    color: #555;
    font-size: 16px;
    transition: background .15s, color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-attach:hover {
    background: #f0f4ff;
    color: #0078d4;
    border-color: #0078d4;
}

/* Attachment preview chips (pending files before send) */
.attachment-preview {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0 4px 0;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f4ff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #333;
}
.attachment-chip .fa {
    color: #0078d4;
    font-size: 13px;
}
.attachment-chip span {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-chip small {
    color: #999;
    margin-left: 2px;
}
.attachment-chip-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
    margin-left: 2px;
}
.attachment-chip-remove:hover {
    color: #d32f2f;
}

/* In-bubble attachments */
.msg-attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.msg-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0,120,212,.06);
    border: 1px solid rgba(0,120,212,.15);
    border-radius: 6px;
    color: #0078d4;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s;
}
.msg-attachment-link:hover {
    background: rgba(0,120,212,.12);
    text-decoration: none;
}
.msg-attachment-link .fa {
    font-size: 15px;
}
.msg-attachment-link span {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-attachment-link small {
    color: #888;
    font-size: 11px;
}
.msg-attachment-thumb {
    display: inline-block;
    text-decoration: none;
}
.msg-attachment-thumb img {
    max-width: 220px;
    max-height: 160px;
    border-radius: 6px;
    border: 1px solid #e0e4ea;
    display: block;
}
.msg-attachment-thumb .msg-attachment-name {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Alert */
.alert {
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 991px) {
    .msg-centre-body {
        height: 360px;
    }
    .msg-bubble {
        max-width: 85%;
    }
    .msg-centre-search input {
        width: 140px;
    }
    .msg-centre-search input:focus {
        width: 160px;
    }
}
@media (max-width: 575px) {
    .msg-centre-header {
        padding: 12px 14px;
    }
    .msg-centre-footer {
        padding: 10px 14px;
    }
    .msg-centre-body {
        padding: 12px 14px;
        height: 300px;
    }
}
