/* ==========================================
   CSS SYSTEM - AURA CHAT PREMIUM INTERFACE
   ========================================== */

/* 1. TOKENS & CHỦ ĐỀ CHUNG */
:root {
    /* Bảng màu Dark Mode */
    --bg-primary: #0a0d16;
    --bg-secondary: #121826;
    --bg-card: rgba(20, 27, 45, 0.6);
    --glass-bg: rgba(22, 32, 54, 0.55);
    --glass-bg-hover: rgba(28, 41, 69, 0.75);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-shadow: rgba(0, 0, 0, 0.35);

    /* Màu nhấn & Gradients */
    --accent-start: #8b5cf6; /* Tím Violet */
    --accent-end: #06b6d4;   /* Xanh Cyan */
    --accent-gradient: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
    --accent-glow: 0 0 15px rgba(139, 92, 246, 0.4);
    
    --success: #10b981;      /* Xanh lục */
    --warning: #f59e0b;      /* Vàng */
    --danger: #ef4444;       /* Đỏ */
    
    /* Màu chữ */
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Cấu trúc */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Light mode override (khi người dùng tắt dark mode trong cài đặt) */
body.light-theme {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-hover: rgba(243, 244, 246, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.05);
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
}

/* Các tinh chỉnh bổ sung cho Giao diện sáng */
body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
body.light-theme .search-bar-wrapper input {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}
body.light-theme .search-bar-wrapper input:focus {
    background-color: #ffffff;
    border-color: var(--accent-start);
}
body.light-theme .tabs-menu {
    background-color: rgba(0, 0, 0, 0.02);
}
body.light-theme .tab-btn.active {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
body.light-theme .chat-item.active {
    background-color: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.15);
}
body.light-theme .chat-item:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.02);
}
body.light-theme .input-message-box-wrapper {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
body.light-theme .form-group input[type="text"] {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}
body.light-theme .modal-card {
    background-color: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
body.light-theme .modal-footer {
    background-color: rgba(0, 0, 0, 0.02);
}
body.light-theme .emoji-picker-popup {
    background-color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
body.light-theme .message-actions-menu {
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
body.light-theme .chat-messages {
    background-color: #f9fafb;
    background-image: radial-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 0);
}
body.light-theme .msg-file-card,
body.light-theme .msg-location-card,
body.light-theme .detail-pinned-card {
    background-color: rgba(0, 0, 0, 0.025);
    border-color: rgba(0, 0, 0, 0.06);
}
body.light-theme .detail-pinned-card:hover {
    background-color: rgba(0, 0, 0, 0.04);
}
body.light-theme .chat-header {
    background-color: rgba(255, 255, 255, 0.7);
}
body.light-theme .msg-audio-player {
    color: #111827;
}
body.light-theme .audio-control-btn {
    background-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}
body.light-theme .audio-control-btn:hover {
    background-color: rgba(0, 0, 0, 0.15);
}
body.light-theme .audio-timeline {
    background-color: rgba(0, 0, 0, 0.1);
}
body.light-theme .audio-progress {
    background-color: var(--accent-start);
}
body.light-theme .audio-duration {
    color: var(--text-secondary);
}
body.light-theme .slider-round {
    background-color: rgba(0, 0, 0, 0.1);
}
body.light-theme .slider-round:before {
    background-color: #ffffff;
}
body.light-theme .message-row.incoming .message-content-box {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
body.light-theme .btn-map-link {
    background-color: rgba(0, 0, 0, 0.02);
}
body.light-theme .btn-map-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
body.light-theme .recording-overlay {
    background-color: #ffffff;
}
body.light-theme .modal-friends-list {
    background-color: rgba(0, 0, 0, 0.02);
}


/* 2. BASE STYLES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hidden {
    display: none !important;
}

/* Nút bấm mặc định */
button {
    font-family: var(--font-main);
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    color: inherit;
}

input, textarea {
    font-family: var(--font-main);
    outline: none;
    border: none;
    color: inherit;
    background: none;
}

/* 3. APP CONTAINER & GRID */
.app-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: 100%;
    width: 100%;
    position: relative;
    background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 45%),
                radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 45%);
}

.app-container.show-detail {
    grid-template-columns: 360px 1fr 340px;
}

/* 4. SIDEBAR TRÁI */
.sidebar-left {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

/* Profile Header */
.profile-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.user-avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
}

.user-avatar, .avatar-sm, .avatar-lg, .chat-header-avatar, .detail-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.avatar-sm {
    width: 38px;
    height: 38px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    background-color: var(--text-muted);
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background-color: var(--text-muted);
}

.status-dot.away {
    background-color: var(--warning);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: var(--glass-bg-hover);
    transform: scale(1.05);
}

.icon-btn iconify-icon {
    font-size: 1.25rem;
}

.icon-btn-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.icon-btn-sm:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.icon-btn-sm iconify-icon {
    font-size: 1.1rem;
}

/* Tabs Menu */
.tabs-menu {
    display: flex;
    padding: 10px;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    position: relative;
}

.tab-btn iconify-icon {
    font-size: 1.3rem;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.tab-btn.active iconify-icon {
    color: #a78bfa;
}

.badge {
    position: absolute;
    top: 5px;
    right: 12px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 10px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Search Bar Wrapper */
.search-bar-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.search-bar-wrapper input {
    width: 100%;
    padding: 11px 15px 11px 40px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.search-bar-wrapper input:focus {
    border-color: var(--accent-start);
    background-color: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Chat & Friend List Items */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-item, .friend-card, .member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    position: relative;
    border: 1px solid transparent;
}

.chat-item:hover, .friend-card:hover {
    background-color: var(--glass-bg);
    border-color: var(--glass-border);
    transform: translateY(-1px);
}

.chat-item.active {
    background-color: var(--glass-bg-hover);
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: var(--glass-shadow);
}

.chat-item.unread .chat-item-name {
    font-weight: 700;
}

.chat-item.unread .chat-item-msg {
    color: var(--text-primary);
    font-weight: 500;
}

.chat-item-avatar-wrap, .friend-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.chat-item-details {
    flex: 1;
    overflow: hidden;
}

.chat-item-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.chat-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-item-row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-msg {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 80%;
}

.chat-badge {
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Friends Section Styles */
.friends-section {
    margin-top: 20px;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-left: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.friend-card .info {
    flex: 1;
    overflow: hidden;
}

.friend-card .name {
    font-size: 0.88rem;
    font-weight: 600;
    display: block;
}

.friend-card .status {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.actions-row {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.65);
}

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

.btn-secondary:hover {
    background-color: var(--glass-bg-hover);
    transform: translateY(-1px);
}

.btn-outline {
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    background-color: transparent;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger-sm {
    padding: 6px 12px;
    background-color: var(--danger);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.btn-success-sm {
    padding: 6px 12px;
    background-color: var(--success);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.group-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* 5. KHU VỰC CHAT CHÍNH (MAIN AREA) */
.chat-main-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-primary);
    overflow: hidden;
    position: relative;
}

/* Empty chat state */
.empty-chat-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.empty-illustration {
    font-size: 5rem;
    color: var(--accent-start);
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
    animation: float 4s ease-in-out infinite;
}

.empty-chat-state h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.empty-chat-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 400px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.active-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Chat Header */
.chat-header {
    height: 72px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background-color: rgba(18, 24, 38, 0.4);
    backdrop-filter: blur(12px);
    z-index: 5;
}

.chat-avatar-wrapper {
    position: relative;
    width: 42px;
    height: 42px;
    margin-right: 12px;
}

.chat-header-avatar {
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.chat-header-info {
    flex: 1;
    overflow: hidden;
}

.chat-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.chat-subtitle {
    font-size: 0.72rem;
    color: var(--success);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

/* Pinned messages banner */
.pinned-messages-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    padding: 8px 20px;
    height: 44px;
    animation: slideDown 0.3s ease;
    z-index: 4;
}

.pin-banner-icon {
    color: var(--warning);
    font-size: 1.1rem;
    transform: rotate(45deg);
}

.pinned-banner-content {
    flex: 1;
    font-size: 0.78rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.pinned-banner-content strong {
    color: var(--warning);
}

.pinned-banner-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.text-link-btn {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-end);
    text-decoration: underline;
}

.text-link-btn:hover {
    color: var(--text-primary);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background-color: var(--bg-primary);
    background-image: radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0);
    background-size: 24px 24px;
}

/* Chat Message Bubbles */
.message-row {
    display: flex;
    gap: 10px;
    max-width: 75%;
    animation: msgPop 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.message-row.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-row.incoming {
    align-self: flex-start;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    align-self: flex-end;
}

.message-bubble-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-sender-name {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.message-content-box {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    position: relative;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-row.incoming .message-content-box {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

.message-row.outgoing .message-content-box {
    background: var(--accent-gradient);
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: var(--accent-glow);
}

/* Rich media inside bubbles */
.msg-image {
    max-width: 250px;
    max-height: 250px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: block;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-smooth);
}

.msg-image:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* File Attachment Card */
.msg-file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: var(--radius-md);
    margin-top: 4px;
    min-width: 200px;
}

.msg-file-icon {
    font-size: 1.8rem;
    color: var(--accent-end);
}

.msg-file-info {
    flex: 1;
    overflow: hidden;
}

.msg-filename {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.msg-filesize {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.msg-file-download {
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.msg-file-download:hover {
    color: var(--accent-end);
    transform: scale(1.1);
}

/* Audio Player Bubble */
.msg-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    padding: 4px 0;
}

.audio-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.audio-control-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.audio-timeline-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.audio-timeline {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.audio-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #ffffff;
    width: 0%;
}

.audio-duration {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
}

/* Location Card */
.msg-location-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    margin-top: 4px;
    width: 240px;
}

.map-mockup {
    height: 120px;
    background: linear-gradient(45deg, #101524 25%, #182035 25%, #182035 50%, #101524 50%, #101524 75%, #182035 75%, #182035 100%);
    background-size: 40px 40px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-end);
}

.map-mockup iconify-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.6));
    animation: pulse 2s infinite;
}

.location-info {
    padding: 8px 12px;
}

.location-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.location-coords {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.btn-map-link {
    width: 100%;
    padding: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-end);
    display: block;
    text-decoration: none;
    transition: var(--transition-fast);
}

.btn-map-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Message Footer */
.msg-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.message-row.incoming .msg-footer {
    justify-content: flex-start;
}

.msg-pinned-tag {
    color: var(--warning);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
}

.msg-pinned-tag iconify-icon {
    font-size: 0.7rem;
    transform: rotate(45deg);
}

/* Hover Menu Actions on Messages */
.message-actions-menu {
    position: absolute;
    top: -10px;
    right: 10px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    display: flex;
    gap: 2px;
    padding: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(5px);
    transition: var(--transition-fast);
    z-index: 2;
    pointer-events: none;
}

.message-row.incoming .message-actions-menu {
    right: auto;
    left: 10px;
}

.message-row:hover .message-actions-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.message-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.message-action-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.message-action-btn.pin-btn:hover {
    color: var(--warning);
}

.message-action-btn.delete-btn:hover {
    color: var(--danger);
}

/* 6. CHAT INPUT AREA */
.chat-input-container {
    padding: 15px 20px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    border-top: 1px solid var(--glass-border);
    background-color: var(--bg-secondary);
    position: relative;
}

.input-actions-left, .input-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 2px;
}

.input-actions-left {
    position: relative;
}

.input-message-box-wrapper {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
}

.input-message-box-wrapper textarea {
    width: 100%;
    border: none;
    background: none;
    resize: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.4;
    padding: 0;
    max-height: 100px;
}

.hidden-input {
    display: none !important;
}

.send-btn {
    background: var(--accent-gradient);
    color: white !important;
    box-shadow: var(--accent-glow);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

/* Emoji Picker Popup */
.emoji-picker-popup {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 250px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 100;
    animation: popUp 0.2s ease;
}

.emoji-picker-header {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    text-align: center;
}

.emoji-grid span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.emoji-grid span iconify-icon {
    font-size: 1.8rem;
}

.emoji-grid span:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.15);
}

.inline-emoji {
    font-size: 1.5rem;
    vertical-align: middle;
    display: inline-block;
    margin: 0 3px;
    transform: translateY(-1px);
}


/* Attachment preview drawer */
.attachment-preview-drawer {
    position: absolute;
    bottom: 73px;
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    padding: 12px 20px;
    animation: slideUp 0.25s ease;
    z-index: 4;
}

.preview-item-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    max-width: 320px;
}

.image-preview-img {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.file-preview-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-end);
}

.preview-info {
    flex: 1;
    overflow: hidden;
}

.preview-filename {
    font-size: 0.78rem;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.preview-filesize {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Voice Recording Overlay */
.recording-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
    animation: fadeIn 0.2s ease;
}

.recording-wave-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--danger);
    animation: flash 1s infinite alternate;
}

.recording-timer {
    font-size: 0.9rem;
    font-weight: 600;
}

.recording-visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.wave-bar {
    width: 3px;
    height: 100%;
    background-color: var(--danger);
    border-radius: 1px;
    animation: soundWave 0.8s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 60%; }
.wave-bar:nth-child(3) { animation-delay: 0.25s; height: 30%; }
.wave-bar:nth-child(4) { animation-delay: 0.15s; height: 80%; }
.wave-bar:nth-child(5) { animation-delay: 0.3s; height: 50%; }
.wave-bar:nth-child(6) { animation-delay: 0.05s; height: 70%; }
.wave-bar:nth-child(7) { animation-delay: 0.2s; height: 40%; }
.wave-bar:nth-child(8) { animation-delay: 0.35s; height: 90%; }

.recording-actions {
    display: flex;
    gap: 8px;
}

/* 7. SIDEBAR PHẢI - THÔNG TIN CHI TIẾT */
.sidebar-right {
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    z-index: 9;
    animation: slideLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-right-header {
    height: 72px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-right-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-right-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.detail-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 25px;
}

.detail-avatar {
    width: 90px;
    height: 90px;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.detail-profile-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.detail-profile-card p {
    font-size: 0.78rem;
    color: var(--success);
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section .section-title {
    margin-bottom: 12px;
}

.detail-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.member-card {
    padding: 8px;
}

.member-card .name {
    font-size: 0.82rem;
    font-weight: 600;
}

.member-card .role {
    font-size: 0.65rem;
    color: var(--accent-end);
    background-color: rgba(6, 182, 212, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

/* Shared media */
.shared-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.shared-media-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: var(--transition-fast);
}

.shared-media-item:hover {
    transform: scale(1.05);
    border-color: rgba(255,255,255,0.3);
}

.shared-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shared-file-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: var(--transition-fast);
}

.shared-file-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Detail pinned list */
.detail-pinned-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-pinned-card {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--warning);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    position: relative;
    cursor: pointer;
    transition: var(--transition-fast);
}

.detail-pinned-card:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.detail-pinned-card p {
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 4px;
    padding-right: 15px;
    word-break: break-all;
}

.detail-pinned-card span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.detail-pinned-card .btn-unpin-card {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--text-muted);
}

.detail-pinned-card .btn-unpin-card:hover {
    color: var(--danger);
}

/* 8. MODAL DIALOGS STYLE */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 460px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    overflow: hidden;
    animation: modalScale 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.15);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.15);
}

/* Form inputs in Modals */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.form-group input[type="text"]:focus {
    border-color: var(--accent-start);
    background-color: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* Selection list inside Modals */
.modal-friends-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 8px;
    background-color: rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.select-friend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    cursor: pointer;
}

.select-friend-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.select-friend-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.select-friend-row img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.select-friend-row span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Alert styles inside modals */
.alert-info {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background-color: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--accent-end);
    font-size: 0.8rem;
    margin-top: 12px;
}

.alert-info.error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.alert-info.success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.search-result-friend {
    margin-top: 15px;
}

.friend-card-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background-color: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.friend-card-search .info {
    flex: 1;
}

.friend-card-search .name {
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
}

.friend-card-search .status {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Settings elements */
.divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 15px 0;
}

.settings-profile-summary {
    display: flex;
    align-items: center;
    gap: 15px;
}

.settings-profile-summary h4 {
    font-size: 1rem;
    font-weight: 700;
}

.settings-profile-summary p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.setting-info h5 {
    font-size: 0.85rem;
    font-weight: 600;
}

.setting-info p {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Switch toggle button styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.15);
    transition: .3s;
    border-radius: 34px;
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch input:checked + .slider-round {
    background-image: var(--accent-gradient);
}

.switch input:checked + .slider-round:before {
    transform: translateX(20px);
}

/* 9. RESPONSIVENESS AND MOBILE ADAPTATION */
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }
    
    .app-container {
        grid-template-columns: 100vw !important;
        overflow: hidden;
    }
    
    .app-container.show-detail {
        grid-template-columns: 100vw !important;
    }
    
    .sidebar-left {
        width: 100vw;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transition: transform 0.3s ease;
    }
    
    .chat-main-area {
        width: 100vw;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar-right {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 80vw;
        max-width: 320px;
        z-index: 100;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    /* Khi đang ở màn hình chat */
    .app-container.chat-active .sidebar-left {
        transform: translateX(-100%);
    }
    
    .app-container.chat-active .chat-main-area {
        transform: translateX(0);
    }
    
    /* Khi mở thông tin chi tiết trên mobile */
    .app-container.detail-active .sidebar-right {
        transform: translateX(0);
    }
}

/* 10. ANIMATIONS KEYFRAMES */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideLeft {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes modalScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes msgPop {
    from { transform: scale(0.9) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

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

@keyframes flash {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

@keyframes soundWave {
    from { transform: scaleY(0.2); }
    to { transform: scaleY(1); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* 11. VIDEO CALL OVERLAY SYSTEM */
.video-call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0b0f19;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    animation: fadeIn 0.4s ease;
}

.remote-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-avatar-placeholder {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.remote-call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

.pulse-ring {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--accent-start);
    animation: wavePulse 2.5s infinite ease-out;
    opacity: 0;
    z-index: 2;
}

.pulse-ring:nth-child(2) {
    animation-delay: 1.25s;
}

@keyframes wavePulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.2); opacity: 0; }
}

.local-video-container {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 140px;
    height: 200px;
    background-color: #1a2035;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    overflow: hidden;
    z-index: 10;
    transition: var(--transition-smooth);
}

.local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror effect */
}

.local-video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-secondary);
    z-index: 1;
}

.call-status-wrapper {
    position: absolute;
    top: 80px;
    text-align: center;
    z-index: 5;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.call-status-wrapper h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.call-status-wrapper p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
}

.call-controls {
    position: absolute;
    bottom: 50px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 5;
}

.call-control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.5rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.call-control-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.call-control-btn.active {
    background-color: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.call-control-btn.btn-hangup {
    background-color: #ef4444;
    border-color: #ef4444;
    font-size: 1.6rem;
    transform: rotate(135deg); /* xoay ngang hình điện thoại */
}

.call-control-btn.btn-hangup:hover {
    background-color: #dc2626;
    transform: scale(1.08) rotate(135deg);
}

@media (max-width: 768px) {
    .local-video-container {
        width: 100px;
        height: 140px;
        top: 16px;
        right: 16px;
    }
    
    .call-status-wrapper h2 {
        font-size: 1.4rem;
    }
}

/* 12. VIDEO FILTERS SYSTEM */
.filter-normal {
    filter: none;
}
.filter-mono {
    filter: grayscale(1) contrast(1.1);
}
.filter-sepia {
    filter: sepia(0.8) contrast(0.95);
}
.filter-warm {
    filter: sepia(0.2) saturate(1.4) brightness(1.02);
}
.filter-cold {
    filter: hue-rotate(40deg) saturate(0.85) brightness(0.95);
}
.filter-neon {
    filter: hue-rotate(270deg) saturate(1.8) contrast(1.1);
}

.filter-toast {
    position: absolute;
    top: 240px;
    right: 24px;
    width: 140px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.75rem;
    color: #ffffff;
    text-align: center;
    z-index: 100;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .filter-toast {
        top: 170px;
        right: 16px;
        width: 100px;
        font-size: 0.65rem;
    }
}

/* 13. AUTH OVERLAY SYSTEM */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 30% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
                var(--bg-primary);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    transition: var(--transition-smooth);
}

.auth-overlay.hidden {
    display: none !important;
}

.auth-card {
    width: 90%;
    max-width: 420px;
    padding: 35px 30px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px var(--glass-shadow);
    backdrop-filter: blur(16px);
    transition: var(--transition-smooth);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    text-align: center;
}

.auth-logo iconify-icon {
    font-size: 3rem;
    color: var(--accent-start);
    filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.4));
}

.auth-logo h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-form-wrapper h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-form-wrapper p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.auth-form-wrapper .form-group {
    margin-bottom: 16px;
}

.auth-form-wrapper label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-form-wrapper input {
    width: 100%;
    padding: 11px 14px;
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

body.light-theme .auth-form-wrapper input {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}

.auth-form-wrapper input:focus {
    border-color: var(--accent-start);
    background-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

body.light-theme .auth-form-wrapper input:focus {
    background-color: #ffffff;
    border-color: var(--accent-start);
}

.auth-switch-text {
    font-size: 0.8rem !important;
    color: var(--text-secondary);
}

.auth-switch-text a {
    transition: var(--transition-fast);
}

.auth-switch-text a:hover {
    color: var(--accent-start) !important;
}

/* 14. INCOMING CALL POPUP SYSTEM */
.incoming-call-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.incoming-call-popup.hidden {
    display: none !important;
}

.incoming-call-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px var(--glass-shadow);
    padding: 40px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .incoming-call-card {
    background-color: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.caller-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
}

.caller-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--accent-start);
    object-fit: cover;
    z-index: 3;
    position: relative;
}

.incoming-pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid var(--accent-start);
    animation: incomingWave 2s infinite ease-out;
    opacity: 0;
    z-index: 1;
}

.incoming-pulse-ring:nth-child(2) {
    animation-delay: 1s;
}

@keyframes incomingWave {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

.incoming-call-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.incoming-call-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.incoming-call-actions {
    display: flex;
    gap: 30px;
    margin-top: 15px;
}

.call-action-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.5rem;
    transition: var(--transition-smooth);
    border: none;
    cursor: pointer;
}

.call-action-btn.decline {
    background-color: #ef4444;
    transform: rotate(135deg);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.call-action-btn.decline:hover {
    background-color: #dc2626;
    transform: scale(1.08) rotate(135deg);
}

.call-action-btn.accept {
    background-color: #10b981;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.call-action-btn.accept:hover {
    background-color: #059669;
    transform: scale(1.08);
}

/* 15. CALL LOG HISTORIES SYSTEM */
.msg-call-log-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    min-width: 200px;
    max-width: 280px;
    margin: 4px 0;
}

body.light-theme .msg-call-log-card {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

.msg-call-icon {
    font-size: 1.4rem;
    color: var(--accent-start);
}

.msg-call-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.msg-call-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 16. GROUP VIDEO/VOICE CALL STYLING */
.group-call-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.15));
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
    animation: slideDown 0.3s ease;
    z-index: 5;
}

body.light-theme .group-call-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.08));
    border-bottom-color: rgba(16, 185, 129, 0.12);
}

.group-call-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #10b981;
}

.call-banner-icon {
    font-size: 1.2rem;
    animation: flash 1.5s infinite alternate;
}

.group-video-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: grid;
    gap: 16px;
    justify-content: center;
    align-content: center;
    z-index: 2;
    overflow-y: auto;
}

/* Các ô camera thành viên */
.video-cell {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 150px;
    background-color: #111827;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.video-cell:hover {
    border-color: var(--accent-start);
}

.video-cell video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Nhãn hiển thị tên thành viên trong ô camera */
.video-label {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background-color: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Trạng thái tắt camera hoặc ảnh đại diện khi không bật cam */
.video-avatar-fallback {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
    z-index: 2;
}

/* Khi cuộc gọi chỉ có camera thoại hoặc cam bị tắt */
.video-cell.camera-off video {
    display: none;
}

/* 17. ADVANCED GROUP MANAGEMENT & SEARCH RESULTS */

/* Kết quả tìm kiếm bạn bè trong modal */
.search-results-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-card-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
}

body.light-theme .friend-card-search {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

.friend-card-search:hover {
    background-color: rgba(255, 255, 255, 0.07);
    border-color: var(--accent-start);
}

body.light-theme .friend-card-search:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.friend-card-search .info {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: left;
}

.friend-card-search .info .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.friend-card-search .info .status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Nút Kick thành viên trong sidebar phải */
.member-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}

.member-card:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

body.light-theme .member-card:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Nút xóa thành viên */
.btn-kick-member {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transition: var(--transition-smooth);
    opacity: 0; /* Ẩn mặc định, hiện khi hover member card */
}

.member-card:hover .btn-kick-member {
    opacity: 1;
}

.btn-kick-member:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.btn-kick-member iconify-icon {
    font-size: 1.1rem;
}

/* Modal chọn bạn bè thêm vào nhóm */
.select-member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
    box-sizing: border-box;
}

body.light-theme .select-member-row {
    background-color: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.04);
}

.select-member-row:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-start);
}

body.light-theme .select-member-row:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.select-member-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.select-member-row img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.select-member-row span {
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--text-primary);
}

.settings-avatar-wrapper:hover .avatar-edit-overlay {
    opacity: 1 !important;
}

/* --- TOAST NOTIFICATIONS STYLE --- */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(18, 24, 38, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 550;
    min-width: 250px;
    max-width: 350px;
    pointer-events: auto;
    animation: toastSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: all 0.3s ease;
    z-index: 99999;
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-info {
    border-left: 4px solid var(--accent-start);
}

.toast-icon {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.toast.toast-success .toast-icon {
    color: var(--success);
}

.toast.toast-error .toast-icon {
    color: var(--danger);
}

.toast.toast-info .toast-icon {
    color: var(--accent-start);
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

body.light-theme .toast {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    color: #111827;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}


