/* Chat Tabs */
.chat-tabs {
    display: flex;
    background: #111;
    border-bottom: 1px solid var(--border-color);
}

.chat-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.chat-tab.active {
    color: var(--accent-color);
}

.chat-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
}

.chat-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-back-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.8rem;
    font-weight: 900;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    margin-right: 4px;
    transform: translateY(-5px);
}

.chat-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1;
    display: flex;
    align-items: center;
    transform: translateY(-5px);
}

.sheet-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-5px);
}

/* --- Global Inbox (Messenger Style) --- */

.inbox-list {

    display: flex;

    flex-direction: column;

}



.inbox-item {

    display: flex;

    align-items: center;

    padding: 16px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.05);

    cursor: pointer;

    transition: background-color 0.2s;

}



.inbox-item:hover {

    background-color: rgba(255, 255, 255, 0.05);

}



.inbox-item.unread {

    background-color: rgba(230, 0, 35, 0.05);

}



.inbox-item.unread .msg-snippet {

    color: var(--text-primary);

    font-weight: 600;

}



.avatar {

    width: 50px;

    height: 50px;

    background-color: #333;

    border-radius: 50%;

    margin-right: 16px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 700;

    color: #888;

    flex-shrink: 0;

}



.msg-content {

    flex: 1;

    display: flex;

    flex-direction: column;

    justify-content: center;

    overflow: hidden;

}



.msg-name {

    font-size: 1rem;

    font-weight: 600;

    color: var(--text-primary);

    margin-bottom: 4px;

}



.msg-snippet {

    font-size: 0.9rem;

    color: var(--text-secondary);

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

}



.msg-meta {

    display: flex;

    flex-direction: column;

    align-items: flex-end;

    margin-left: 10px;

}



.msg-time {

    font-size: 0.75rem;

    color: var(--text-secondary);

    margin-bottom: 6px;

}



.unread-dot {

    width: 12px;

    height: 12px;

    background-color: var(--accent-color);

    border-radius: 50%;

}



/* --- Thread View (Chat Bubbles) --- */

.chat-thread-container {

    display: flex;

    flex-direction: column;

    height: 100%;

}



/* --- 3-Tier Chat Layout --- */

.chat-header-details-tier {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    top: -15px;
    z-index: 5;
}

.details-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-align: center;
    width: 100%;
}

.chat-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar for clean look */
}

.chat-header-info::-webkit-scrollbar { display: none; }

.info-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}

.info-item strong {
    color: var(--accent-color);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.info-item span {
    color: var(--text-primary);
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px; /* More consistent padding */
    display: flex;
    flex-direction: column;
    gap: 12px;
}



.chat-messages {

    flex: 1;

    overflow-y: auto;

    padding: 10px;

    display: flex;

    flex-direction: column;

    gap: 10px;

}



.bubble {

    max-width: 75%;

    padding: 12px 16px;

    border-radius: 18px;

    font-size: 0.95rem;

    line-height: 1.4;

    position: relative;

}



.bubble.received {

    align-self: flex-start;

    background-color: #333;

    color: white;

    border-bottom-left-radius: 4px;

}



.bubble.sent {

    align-self: flex-end;

    background-color: var(--accent-color);

    color: white;

    border-bottom-right-radius: 4px;

}



.chat-input-area {

    padding: 16px;

    border-top: 1px solid var(--border-color);

    display: flex;

    gap: 10px;

    background-color: #1a1a1a;

}



.chat-input {

    flex: 1;

    padding: 12px;

    border-radius: 20px;

    border: none;

    background-color: #333;

    color: white;

}



/* --- Chat Polish & Typing --- */



.bubble-time {



    font-size: 0.65rem;



    color: var(--text-secondary);



    margin-top: 4px;



    display: block;



}







.sent .bubble-time { text-align: right; }







.receipt {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6); /* Soft white */
    margin-top: 2px;
    text-align: right;
    display: block;
}







.receipt.read { color: var(--success-color); }







/* Typing Dots Animation */
.typing-bubble {
    align-self: flex-start;
    background-color: #333;
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    width: fit-content;
    margin-bottom: 5px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

#staff-typing-label {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#staff-typing-label .typing-bubble {
    margin-bottom: 0;
    padding: 8px 12px;
    background-color: #2a2a2a;
}

#staff-typing-label .typing-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

#staff-typing-label .username {
    color: var(--accent-color);
    font-weight: 700;
}

.hidden { display: none !important; }













/* Card Level Chat Icon (Notification Bubble) */
.card-chat-trigger {
    display: none; /* Hidden by default */
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 20; /* High z-index to float above */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.card-chat-trigger.has-unread {
    display: flex;
    animation: pulse-glow 2s infinite;
}

.card-chat-trigger:hover {
    transform: scale(1.1);
}

.card-chat-trigger svg {
    width: 20px !important;
    height: 20px !important;
    fill: var(--accent-color); /* Red Icon */
    pointer-events: none;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(230, 0, 35, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(230, 0, 35, 0); }
    100% { box-shadow: 0 0 0 0 rgba(230, 0, 35, 0); }
}

/* Modern Send Button */
.send-btn {
    background-color: var(--accent-color);
    border: none;
    color: white;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.send-btn:hover {
    background-color: var(--accent-hover);
}

/* 2026 Sleek Chat Link Buttons */
.chat-action-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #E60023;
    color: white !important;
    text-decoration: none !important;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 10px 0;
    box-shadow: 0 4px 15px rgba(230, 0, 35, 0.3);
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.chat-action-link-btn:hover {
    background: #ff002b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 0, 35, 0.4);
}

.chat-action-link-btn .icon {
    font-size: 1rem;
}

.bubble.sent .chat-action-link-btn {
    background: white;
    color: #E60023 !important;
}

.bubble.sent .chat-action-link-btn:hover {
    background: #f0f0f0;
}

/* Tab Unread Badges */
.chat-tab {
    position: relative;
    padding: 12px 10px;
}

.tab-badge {
    position: absolute;
    top: 4px;
    right: 2px;
    background: #E60023;
    color: white;
    font-size: 0.6rem;
    font-weight: 900;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #121212;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

