/**
 * TeamTalk - Premium Messaging Experience
 * Ultra-luxe design with divine light effects
 * Desert gold + cosmic glow aesthetic
 */

/* ========== CSS Variables for TeamTalk ========== */
:root {
    --tt-gold: #d4a574;
    --tt-gold-light: #e8c9a8;
    --tt-gold-glow: rgba(212, 165, 116, 0.4);
    --tt-amber: #e07b39;
    --tt-cosmic: #7c9fff;
    --tt-cosmic-glow: rgba(124, 159, 255, 0.3);
    --tt-glass: rgba(255, 255, 255, 0.03);
    --tt-glass-border: rgba(255, 255, 255, 0.08);
    --tt-divine-glow: 0 0 60px rgba(212, 165, 116, 0.15),
                       0 0 100px rgba(124, 159, 255, 0.1);
}

/* ========== Main Container - Divine Aura ========== */
.msg-container {
    display: flex;
    height: 100%;
    background: linear-gradient(135deg,
        rgba(20, 18, 24, 0.98) 0%,
        rgba(30, 25, 35, 0.98) 50%,
        rgba(25, 22, 30, 0.98) 100%);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--tt-divine-glow),
                0 25px 80px -20px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--tt-glass-border);
    position: relative;
}

/* Divine light rays overlay */
.msg-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(212, 165, 116, 0.03) 30deg,
        transparent 60deg,
        rgba(124, 159, 255, 0.02) 90deg,
        transparent 120deg
    );
    animation: divineRotate 60s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes divineRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== Sidebar - Conversations List ========== */
.msg-sidebar {
    width: 340px;
    min-width: 300px;
    background: linear-gradient(180deg,
        rgba(30, 28, 35, 0.95) 0%,
        rgba(25, 23, 30, 0.98) 100%);
    border-right: 1px solid var(--tt-glass-border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(20px);
}

/* Sidebar ambient glow */
.msg-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--tt-gold) 30%,
        var(--tt-cosmic) 70%,
        transparent 100%);
    opacity: 0.3;
}

.msg-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--tt-glass-border);
    background: linear-gradient(180deg,
        rgba(212, 165, 116, 0.05) 0%,
        transparent 100%);
}

.msg-sidebar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tt-gold-light);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: -0.5px;
}

.msg-sidebar-title span {
    background: linear-gradient(135deg, var(--tt-gold-light), var(--tt-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px var(--tt-gold-glow);
}

/* New conversation button - Luxe */
.msg-new-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-amber));
    color: #1a1a1a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px var(--tt-gold-glow),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.msg-new-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.3) 0%,
        transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.msg-new-btn:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 8px 30px var(--tt-gold-glow);
}

.msg-new-btn:hover::before {
    opacity: 1;
}

.msg-new-btn svg {
    stroke-width: 2.5;
}

/* Search bar - Premium glass */
.msg-search {
    position: relative;
}

.msg-search-input {
    width: 100%;
    padding: 14px 18px 14px 48px;
    border-radius: 14px;
    border: 1px solid var(--tt-glass-border);
    background: var(--tt-glass);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

.msg-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.msg-search-input:focus {
    outline: none;
    border-color: var(--tt-gold);
    background: rgba(212, 165, 116, 0.05);
    box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.1),
                0 8px 30px rgba(0, 0, 0, 0.2);
}

.msg-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tt-gold);
    width: 20px;
    height: 20px;
    opacity: 0.6;
}

/* ========== Conversations List ========== */
.msg-conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--tt-gold-glow) transparent;
}

.msg-conv-list::-webkit-scrollbar {
    width: 6px;
}

.msg-conv-list::-webkit-scrollbar-track {
    background: transparent;
}

.msg-conv-list::-webkit-scrollbar-thumb {
    background: var(--tt-gold-glow);
    border-radius: 3px;
}

.msg-conv-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 6px;
    position: relative;
    border: 1px solid transparent;
    background: var(--tt-glass);
}

.msg-conv-item:hover {
    background: rgba(212, 165, 116, 0.08);
    border-color: rgba(212, 165, 116, 0.15);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.msg-conv-item.active {
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.15) 0%,
        rgba(124, 159, 255, 0.1) 100%);
    border-color: var(--tt-gold);
    box-shadow: 0 0 0 1px var(--tt-gold),
                0 0 30px var(--tt-gold-glow),
                0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Conversation Avatar - Luxury */
.msg-conv-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.2) 0%,
        rgba(124, 159, 255, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--tt-glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.msg-conv-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 50%);
}

.msg-conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-conv-info {
    flex: 1;
    min-width: 0;
}

.msg-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.msg-conv-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    letter-spacing: -0.3px;
}

.msg-conv-item.active .msg-conv-name {
    color: var(--tt-gold-light);
}

.msg-conv-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.msg-conv-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Unread badge - Gold glow */
.msg-conv-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-amber));
    color: #1a1a1a;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    animation: badgeGlow 2s ease-in-out infinite;
    box-shadow: 0 0 15px var(--tt-gold-glow);
}

@keyframes badgeGlow {
    0%, 100% { box-shadow: 0 0 15px var(--tt-gold-glow); }
    50% { box-shadow: 0 0 25px var(--tt-gold-glow), 0 0 40px rgba(212, 165, 116, 0.2); }
}

/* ========== Chat Zone ========== */
.msg-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    min-width: 0;
    position: relative;
    z-index: 1;
}

/* Chat header - Glass + gold accent */
.msg-chat-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--tt-glass-border);
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(180deg,
        rgba(212, 165, 116, 0.05) 0%,
        transparent 100%);
    backdrop-filter: blur(20px);
    position: relative;
}

.msg-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--tt-gold) 50%,
        transparent 100%);
    opacity: 0.3;
}

.msg-chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.2) 0%,
        rgba(124, 159, 255, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--tt-glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.msg-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-chat-avatar.group {
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-cosmic));
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
}

/* Online status indicator */
.msg-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #52525b;
    border: 2px solid rgba(30, 28, 35, 0.95);
    transition: all 0.3s ease;
}

.msg-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e,
                0 0 20px rgba(34, 197, 94, 0.4);
    animation: pulseOnline 2s ease-in-out infinite;
}

@keyframes pulseOnline {
    0%, 100% { box-shadow: 0 0 10px #22c55e; }
    50% { box-shadow: 0 0 15px #22c55e, 0 0 25px rgba(34, 197, 94, 0.5); }
}

.msg-chat-info {
    flex: 1;
}

.msg-chat-name {
    font-weight: 600;
    color: var(--tt-gold-light);
    font-size: 1.1rem;
    letter-spacing: -0.3px;
}

.msg-chat-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Header actions */
.msg-chat-actions {
    display: flex;
    gap: 8px;
}

.msg-chat-action {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--tt-glass);
    border: 1px solid var(--tt-glass-border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.msg-chat-action:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: var(--tt-gold);
    color: var(--tt-gold);
    transform: scale(1.05);
}

.msg-chat-action svg {
    width: 20px;
    height: 20px;
}

/* ========== Messages Area ========== */
.msg-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 165, 116, 0.2) transparent;
}

.msg-messages::-webkit-scrollbar {
    width: 6px;
}

.msg-messages::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 116, 0.2);
    border-radius: 3px;
}

/* Message bubbles */
.msg-bubble-wrapper {
    display: flex;
    flex-direction: column;
    animation: bubbleSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bubbleSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-bubble-wrapper.mine {
    align-items: flex-end;
}

.msg-bubble-wrapper.theirs {
    align-items: flex-start;
}

.msg-bubble {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    word-break: break-word;
}

/* My messages - Gold gradient */
.msg-bubble-wrapper.mine .msg-bubble {
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-amber));
    color: #1a1a1a;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 20px var(--tt-gold-glow),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Their messages - Glass */
.msg-bubble-wrapper.theirs .msg-bubble {
    background: var(--tt-glass);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--tt-glass-border);
    backdrop-filter: blur(10px);
}

.msg-bubble-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.7;
}

.msg-bubble-wrapper.mine .msg-bubble-time {
    justify-content: flex-end;
}

.msg-check {
    font-size: 0.8rem;
}

.msg-check.read {
    color: var(--tt-gold);
}

/* Sender info in groups */
.msg-bubble-sender {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding-left: 2px;
}

.msg-bubble-sender-avatar {
    font-size: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.msg-bubble-sender-name {
    font-size: 0.78rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-cosmic));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.msg-edited {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

/* ========== File Attachments ========== */
.msg-attachment {
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--tt-glass-border);
}

.msg-attachment-image {
    max-width: 300px;
    max-height: 200px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.msg-attachment-image:hover {
    transform: scale(1.02);
}

.msg-attachment-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--tt-glass);
    backdrop-filter: blur(10px);
    min-width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.msg-attachment-file:hover {
    background: rgba(212, 165, 116, 0.1);
}

.msg-attachment-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.msg-attachment-icon.pdf {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.msg-attachment-icon.doc {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.msg-attachment-icon.default {
    background: var(--tt-glass);
    border: 1px solid var(--tt-glass-border);
}

.msg-attachment-info {
    flex: 1;
    min-width: 0;
}

.msg-attachment-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-attachment-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.msg-attachment-download {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--tt-gold);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.msg-attachment-file:hover .msg-attachment-download {
    opacity: 1;
}

/* ========== Typing Indicator ========== */
.msg-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: linear-gradient(90deg,
        rgba(212, 165, 116, 0.05) 0%,
        transparent 100%);
}

.msg-typing-dots {
    display: flex;
    gap: 5px;
}

.msg-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tt-gold);
    animation: typingPulse 1.4s infinite ease-in-out;
}

.msg-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px) scale(1.1);
        opacity: 1;
    }
}

/* ========== Input Area - Luxury ========== */
.msg-input-area {
    padding: 20px 28px;
    border-top: 1px solid var(--tt-glass-border);
    display: flex;
    align-items: flex-end;
    gap: 14px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(212, 165, 116, 0.03) 100%);
    backdrop-filter: blur(20px);
    position: relative;
}

.msg-input-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    width: 90%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--tt-gold) 50%,
        transparent 100%);
    opacity: 0.2;
}

/* File upload buttons */
.msg-input-actions {
    display: flex;
    gap: 6px;
}

.msg-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--tt-glass);
    border: 1px solid var(--tt-glass-border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.msg-action-btn:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: var(--tt-gold);
    color: var(--tt-gold);
    transform: translateY(-2px);
}

.msg-action-btn svg {
    width: 20px;
    height: 20px;
}

.msg-action-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Input wrapper */
.msg-input-wrapper {
    flex: 1;
    position: relative;
}

.msg-input {
    width: 100%;
    padding: 16px 20px;
    padding-right: 54px;
    border-radius: 18px;
    border: 1px solid var(--tt-glass-border);
    background: var(--tt-glass);
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: none;
    min-height: 52px;
    max-height: 150px;
    line-height: 1.5;
    transition: all 0.3s ease;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

.msg-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.msg-input:focus {
    outline: none;
    border-color: var(--tt-gold);
    background: rgba(212, 165, 116, 0.05);
    box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.1),
                0 8px 30px rgba(0, 0, 0, 0.2);
}

.msg-emoji-btn {
    position: absolute;
    right: 16px;
    bottom: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    opacity: 0.5;
    transition: all 0.3s ease;
    filter: grayscale(0.3);
}

.msg-emoji-btn:hover {
    opacity: 1;
    transform: scale(1.15) rotate(10deg);
    filter: grayscale(0);
}

/* Send button - Premium gold */
.msg-send-btn {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-amber));
    color: #1a1a1a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px var(--tt-gold-glow),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.msg-send-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.3) 0%,
        transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.msg-send-btn:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 8px 30px var(--tt-gold-glow);
}

.msg-send-btn:hover::before {
    opacity: 1;
}

.msg-send-btn:active {
    transform: scale(0.95);
}

.msg-send-btn svg {
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 1;
}

/* ========== File Upload Preview ========== */
.msg-upload-preview {
    display: flex;
    gap: 10px;
    padding: 12px 28px;
    background: rgba(212, 165, 116, 0.05);
    border-bottom: 1px solid var(--tt-glass-border);
    flex-wrap: wrap;
}

.msg-upload-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tt-glass-border);
    background: var(--tt-glass);
}

.msg-upload-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.msg-upload-item.file {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.msg-upload-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.msg-upload-remove:hover {
    background: #ef4444;
    transform: scale(1.1);
}

/* ========== Empty State - Divine ========== */
.msg-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    position: relative;
}

/* Floating particles */
.msg-empty::before,
.msg-empty::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--tt-gold-glow) 0%, transparent 70%);
    animation: floatParticle 8s ease-in-out infinite;
    opacity: 0.3;
}

.msg-empty::before {
    top: 20%;
    left: 20%;
}

.msg-empty::after {
    bottom: 20%;
    right: 20%;
    animation-delay: 4s;
    background: radial-gradient(circle, var(--tt-cosmic-glow) 0%, transparent 70%);
}

@keyframes floatParticle {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -20px) scale(1.1); }
}

.msg-empty-icon {
    width: 100px;
    height: 100px;
    border-radius: 28px;
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.2) 0%,
        rgba(124, 159, 255, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 28px;
    border: 1px solid var(--tt-glass-border);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3),
                0 0 60px var(--tt-gold-glow);
    position: relative;
    z-index: 1;
    animation: iconFloat 4s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.msg-empty-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, var(--tt-gold-light), var(--tt-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.msg-empty-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

/* ========== New Conversation Modal ========== */
.msg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.msg-modal {
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    background: linear-gradient(180deg,
        rgba(35, 32, 42, 0.98) 0%,
        rgba(28, 25, 35, 0.98) 100%);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--tt-glass-border);
    box-shadow: 0 0 80px var(--tt-gold-glow),
                0 30px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--tt-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg,
        rgba(212, 165, 116, 0.08) 0%,
        transparent 100%);
}

.msg-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--tt-gold-light), var(--tt-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.msg-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--tt-glass);
    border: 1px solid var(--tt-glass-border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.msg-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

.msg-modal-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

/* User selection for new conversation */
.msg-user-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    border: 1px solid transparent;
    background: var(--tt-glass);
}

.msg-user-option:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: var(--tt-gold);
    transform: translateX(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.msg-user-option.selected {
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.2) 0%,
        rgba(124, 159, 255, 0.1) 100%);
    border-color: var(--tt-gold);
}

.msg-user-avatar {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.2) 0%,
        rgba(124, 159, 255, 0.15) 100%);
    border: 1px solid var(--tt-glass-border);
}

.msg-user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

.msg-user-option:hover .msg-user-name {
    color: var(--tt-gold-light);
}

/* Group creation */
.msg-group-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--tt-glass-border);
    background: var(--tt-glass);
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.msg-group-input:focus {
    outline: none;
    border-color: var(--tt-gold);
    box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.1);
}

.msg-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--tt-glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.msg-modal-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.msg-modal-btn.primary {
    background: linear-gradient(135deg, var(--tt-gold), var(--tt-amber));
    color: #1a1a1a;
    box-shadow: 0 4px 20px var(--tt-gold-glow);
}

.msg-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--tt-gold-glow);
}

.msg-modal-btn.secondary {
    background: var(--tt-glass);
    color: var(--text-primary);
    border: 1px solid var(--tt-glass-border);
}

.msg-modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ========== View Container ========== */
#view-team-messaging {
    padding: 28px;
    height: calc(100vh - 56px);
    position: relative;
    overflow: hidden;
}

/* ========== Image Lightbox ========== */
.msg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: zoom-out;
    animation: fadeIn 0.3s ease;
}

.msg-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.5);
}

.msg-lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--tt-glass);
    border: 1px solid var(--tt-glass-border);
    color: white;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.msg-lightbox-close:hover {
    background: #ef4444;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .msg-sidebar {
        width: 280px;
        min-width: 260px;
    }
}

@media (max-width: 768px) {
    .msg-container {
        border-radius: 0;
    }

    .msg-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 85%;
        max-width: 320px;
    }

    .msg-sidebar.visible {
        transform: translateX(0);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
    }

    .msg-chat {
        width: 100%;
    }

    #view-team-messaging {
        padding: 0;
        height: 100vh;
    }

    .msg-messages {
        padding: 16px;
    }

    .msg-input-area {
        padding: 16px;
    }
}

/* ========== Loading Skeleton ========== */
.msg-skeleton {
    background: linear-gradient(90deg,
        var(--tt-glass) 0%,
        rgba(212, 165, 116, 0.1) 50%,
        var(--tt-glass) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.msg-skeleton-conv {
    height: 72px;
    margin-bottom: 8px;
}

.msg-skeleton-bubble {
    height: 60px;
    max-width: 60%;
    margin-bottom: 12px;
}

.msg-skeleton-bubble.mine {
    margin-left: auto;
}
