/* ==========================================================================
   MIATECH CHAT - iOS CLASSIC THEME (VIBRANT JUICY ORANGE / MÀU CAM SINH ĐỘNG)
   Designed & Optimized for Mobile & Desktop
   ========================================================================== */

:root {
    /* Primary Brand - Vibrant Lively Orange / Màu Cam Sinh Động */
    --primary: #FF7700;
    --primary-hover: #E66600;
    --primary-active: #CC5500;
    --primary-gradient: linear-gradient(135deg, #FFA000 0%, #FF6600 50%, #FF4D00 100%);
    --primary-gradient-hover: linear-gradient(135deg, #FFB300 0%, #FF7700 50%, #FF5A00 100%);
    --primary-gradient-subtle: linear-gradient(135deg, rgba(255, 160, 0, 0.16) 0%, rgba(255, 102, 0, 0.08) 100%);
    --primary-light: rgba(255, 119, 0, 0.12);
    --primary-lighter: rgba(255, 119, 0, 0.06);
    --primary-glow: 0 4px 18px rgba(255, 119, 0, 0.38);
    --primary-border: rgba(255, 119, 0, 0.28);
    --primary-color: var(--primary);
    --accent: var(--primary);
    --accent-hover: var(--primary-hover);
    --accent-blue: var(--primary);
    --accent-red: var(--primary);

    /* iOS System Semantic Colors */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-yellow: #FF9500;
    --ios-orange: #FF5E3A;
    --ios-red: #FF3B30;
    --ios-gray: #8E8E93;
    --ios-gray2: #AEAEB2;
    --ios-gray3: #C7C7CC;
    --ios-gray4: #D1D1D6;
    --ios-gray5: #E5E5EA;
    --ios-gray6: #F2F2F7;

    --green: #34C759;
    --yellow: #FF9500;
    --red: #FF3B30;
    --danger: #FF3B30;

    /* Surfaces & iOS Light Aesthetic */
    --bg-body: #FFFFFF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAFAFC;
    --bg-tertiary: #E5E5EA;
    --bg-surface: #FFFFFF;
    --bg-surface-translucent: rgba(255, 255, 255, 0.88);
    --bg-header: rgba(248, 248, 250, 0.88);
    --bg-input: #E9E9EB;
    --bg-input-focus: #FFFFFF;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.07);
    --bg-bubble-received: #FFFFFF;

    /* Typography */
    --text-primary: #1C1C1E;
    --text-secondary: #636366;
    --text-muted: #8E8E93;
    --text-color: #1C1C1E;

    /* Dividers & Borders */
    --border: rgba(60, 60, 67, 0.12);
    --border-color: rgba(60, 60, 67, 0.12);
    --border-light: rgba(60, 60, 67, 0.06);

    /* Shadows & Elevations */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.12);
    --shadow-sheet: 0 -8px 30px rgba(0, 0, 0, 0.12);
    --shadow: var(--shadow-md);

    /* Blur & Glassmorphism */
    --blur-glass: blur(14px) saturate(160%);
    --webkit-blur-glass: blur(14px) saturate(160%);

    /* Radii */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --radius-full: 9999px;

    /* Fonts */
    --font-primary: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Layout Constants */
    --app-height: 100dvh;
    --header-height: 56px;
    --bottom-nav-height: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

/* High Performance Hardware Accelerated Smooth Scrolling */
html, body {
    width: 100%;
    height: 100%;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    background-color: var(--bg-body);
    font-family: var(--font-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overscroll-behavior-y: none;
}

.message-area,
.sidebar-channels,
.online-users-scroll,
.media-content,
.modal-body,
.friends-body,
.chat-settings-body,
.seen-list-body,
.notifications-body,
.admin-content,
.stickers-body {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    transform: translateZ(0);
    will-change: scroll-position;
    contain: content;
}

.app-header,
.sidebar-header,
.input-bar-container,
.mobile-bottom-nav,
.desktop-nav-rail {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Scrollbars - Minimal iOS style */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28);
}

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--ios-red); }
.text-accent { color: var(--primary); }
.mt-4 { margin-top: 16px; }

/* Buttons (iOS Classic Translucent Glassmorphism & Frosted Glass System) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: -0.2px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    outline: none;
}

.btn:active {
    transform: scale(0.96);
    opacity: 0.88;
}

/* iOS Primary Glass Button (Translucent Juicy Orange Glass) */
.btn-primary,
.btn-game-primary,
.btn-submit {
    background: linear-gradient(135deg, #FFA000 0%, #FF6600 50%, #FF4D00 100%) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 8px 24px rgba(255, 119, 0, 0.32), 0 2px 6px rgba(255, 119, 0, 0.2), inset 0 1px 1.5px rgba(255, 255, 255, 0.6) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    font-weight: 600 !important;
}

.btn-primary:hover,
.btn-game-primary:hover,
.btn-submit:hover {
    background: linear-gradient(135deg, rgba(255, 136, 18, 0.96) 0%, rgba(255, 95, 15, 0.90) 100%) !important;
    box-shadow: 0 10px 28px rgba(255, 119, 0, 0.42), 0 3px 8px rgba(255, 119, 0, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.8) !important;
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-game-primary:active,
.btn-submit:active {
    transform: scale(0.96) !important;
    box-shadow: 0 4px 14px rgba(255, 119, 0, 0.25), inset 0 1px 1px rgba(0, 0, 0, 0.1) !important;
    opacity: 0.92;
}

/* iOS Danger Glass Button (Translucent Apple Red Glass) */
.btn-danger {
    background: linear-gradient(135deg, #FF3B30 0%, #E02020 100%) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 8px 20px rgba(255, 59, 48, 0.28), inset 0 1px 1.5px rgba(255, 255, 255, 0.5) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    font-weight: 600 !important;
}

.btn-danger:hover {
    background: linear-gradient(135deg, rgba(255, 75, 65, 0.95) 0%, rgba(235, 30, 30, 0.88) 100%) !important;
    box-shadow: 0 10px 24px rgba(255, 59, 48, 0.38), inset 0 1px 2px rgba(255, 255, 255, 0.7) !important;
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: scale(0.96) !important;
    box-shadow: 0 4px 10px rgba(255, 59, 48, 0.2) !important;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 12px;
}

/* iOS Ghost / Secondary Translucent Glass Button */
.btn-ghost,
.btn-secondary,
.btn-text-link {
    background: rgba(255, 255, 255, 0.88) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
    font-weight: 600 !important;
}

.btn-ghost:hover,
.btn-secondary:hover,
.btn-text-link:hover {
    background: rgba(255, 255, 255, 0.88) !important;
    color: var(--primary) !important;
    border-color: rgba(255, 119, 0, 0.35) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(255, 119, 0, 0.15) !important;
    transform: translateY(-1px);
}

.btn-ghost:active,
.btn-secondary:active,
.btn-text-link:active {
    transform: scale(0.96) !important;
    background: rgba(255, 255, 255, 0.55) !important;
}

/* Icon Buttons (iOS Classic Translucent Glass Circle / Pill) */
.btn-icon {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.78) !important;
    color: var(--primary) !important;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.9);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.btn-icon:hover {
    color: var(--primary-hover, #E66600) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(255, 119, 0, 0.35) !important;
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(255, 119, 0, 0.18), inset 0 1px 1px #FFFFFF;
}

.btn-icon:active {
    transform: scale(0.92) !important;
    opacity: 0.85;
}

.btn-icon svg {
    display: block;
    color: var(--primary) !important;
}

/* ==========================================================================
   UNIFIED VIBRANT ORANGE ICONS SYSTEM (ĐỒNG BỘ TOÀN BỘ ICON MÀU CAM)
   ========================================================================== */
.btn-icon,
.btn-icon svg,
.btn-icon i,
.header-btn svg,
.header-btn i,
.chat-tool-btn svg,
.chat-tool-btn i,
.nav-item svg,
.nav-item i,
.input-left-icon,
.input-icon-wrapper svg,
.settings-item-icon,
.settings-group-title i,
.admin-menu-item svg,
.admin-menu-item i,
.tab-btn svg,
.tab-btn i,
.action-sheet-item svg,
.action-sheet-item i,
.hash-icon,
.chat-history-start-icon,
.empty-state svg,
.search-icon svg,
.media-tab svg,
.btn-member-action svg,
.btn-timer-opt svg,
.btn-news-action svg,
.channel-item svg,
.member-item svg,
.menu-item svg,
.badge-creator svg {
    color: var(--primary) !important;
}

/* Maintain crisp white icon on filled primary/danger glass buttons */
.btn-primary svg,
.btn-primary i,
.btn-game-primary svg,
.btn-danger svg,
.btn-danger i,
.ios-confirm-btn-ok.btn-danger svg,
.ios-confirm-btn-ok.btn-primary svg,
.btn-send svg {
    color: #FFFFFF !important;
}

/* Avatars */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    background-color: var(--bg-tertiary);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    background-color: var(--ios-gray, #8E8E93);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.status-indicator.online,
.avatar.online .status-indicator,
.status-indicator.status-online {
    background-color: #34C759 !important;
    box-shadow: 0 0 6px rgba(52, 199, 89, 0.8) !important;
}

.status-indicator.offline,
.avatar.offline .status-indicator,
.status-indicator.status-offline {
    background-color: var(--ios-gray, #8E8E93) !important;
    box-shadow: none !important;
}

.status-indicator.idle,
.avatar.idle .status-indicator,
.status-indicator.status-idle {
    background-color: var(--ios-yellow, #FF9500) !important;
}

.status-indicator.dnd,
.avatar.dnd .status-indicator,
.status-indicator.status-dnd {
    background-color: var(--ios-red, #FF3B30) !important;
}

[data-theme="dark"] .status-indicator {
    border-color: #161b22 !important;
}

/* Avatar Grid & Group Composite Avatar (Multi-user group avatar) */
.avatar-grid,
.group-composite-avatar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1px;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    max-width: 50px;
    max-height: 50px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--bg-tertiary, #E5E5EA);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.avatar-grid img,
.group-composite-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-grid.count-1 img,
.group-composite-avatar.grid-1 img { grid-column: 1 / 3; grid-row: 1 / 3; }

.avatar-grid.count-2,
.group-composite-avatar.grid-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}
.avatar-grid.count-2 img:first-child,
.group-composite-avatar.grid-2 img:first-child { grid-row: 1 / 2; }
.avatar-grid.count-2 img:last-child,
.group-composite-avatar.grid-2 img:last-child { grid-row: 1 / 2; }

.avatar-grid.count-3 img:first-child,
.group-composite-avatar.grid-3 img:first-child { grid-column: 1 / 3; grid-row: 1 / 2; }
.avatar-grid.count-3 img:nth-child(2),
.group-composite-avatar.grid-3 img:nth-child(2) { grid-column: 1 / 2; grid-row: 2 / 3; }
.avatar-grid.count-3 img:last-child,
.group-composite-avatar.grid-3 img:last-child { grid-column: 2 / 3; grid-row: 2 / 3; }

.avatar-grid.count-4,
.group-composite-avatar.grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: var(--app-height, 100dvh);
}

/* Instant App Load (Zero-flash transition) */
html.user-authenticated #login-screen {
    display: none !important;
}
html.user-authenticated #app-screen {
    display: flex !important;
}

/* ==========================================================================
   MIATECH POS GOLDEN LUXURY AUTHENTICATION SCREEN (CHUẨN THEO ẢNH MẪU)
   ========================================================================== */

#login-screen.auth-screen {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: radial-gradient(ellipse at 50% 40%, #2D1A08 0%, #1A1008 50%, #100A04 100%) !important;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-primary);
}

/* Background Video for Register Tab (Mobile only) */
.auth-video-bg-container {
    display: none !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 768px) {
    .auth-video-bg-container {
        display: block !important;
    }
    .auth-video-bg-container.active,
    #login-screen.is-register-tab .auth-video-bg-container {
        opacity: 1;
        visibility: visible;
    }
}

.auth-video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.auth-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.35) 100%);
    z-index: 1;
}

/* Unified Luxury Dark Card with Frosted Depth */
.miatech-luxury-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 840px;
    background: rgba(19, 17, 15, 0.9) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    border: 1px solid rgba(245, 166, 35, 0.22) !important;
    border-radius: 24px !important;
    box-shadow: 
        0 24px 70px rgba(0, 0, 0, 0.85),
        0 0 40px rgba(245, 166, 35, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
    overflow: hidden;
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, backdrop-filter 0.4s ease;
    animation: luxuryCardAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Trong suốt tinh tế khi ở Tab Đăng ký để thấy rõ video nền sống động */
#login-screen.is-register-tab .miatech-luxury-card {
    background: rgba(16, 12, 8, 0.22) !important;
    backdrop-filter: blur(6px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
    border: 1px solid rgba(245, 166, 35, 0.5) !important;
    box-shadow: 
        0 24px 70px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(245, 166, 35, 0.25),
        inset 0 1px 2px rgba(255, 255, 255, 0.3) !important;
}

#login-screen.is-register-tab .auth-tab-segmented {
    background: rgba(20, 16, 12, 0.35) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

#login-screen.is-register-tab .auth-field-wrapper {
    background: rgba(24, 19, 14, 0.35) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    border-color: rgba(245, 166, 35, 0.35) !important;
}

#login-screen.is-register-tab .auth-field-wrapper:focus-within {
    background: rgba(35, 28, 18, 0.65) !important;
    border-color: #F5A623 !important;
}

@keyframes luxuryCardAppear {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-unified-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 480px;
}

/* Left Brand Side: Golden Phone Mascot Logo */
.auth-brand-side {
    flex: 1 1 44%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    text-align: center;
    user-select: none;
}

.brand-logo-glow-box {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.brand-golden-aura {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 166, 35, 0.65) 0%, rgba(245, 166, 35, 0.2) 50%, transparent 70%);
    filter: blur(18px);
    animation: pulseBrandAura 3.5s infinite alternate ease-in-out;
}

@keyframes pulseBrandAura {
    0% { transform: scale(0.92); opacity: 0.6; }
    100% { transform: scale(1.08); opacity: 1; }
}

.brand-golden-logo {
    position: relative;
    z-index: 2;
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(245, 166, 35, 0.85));
    transition: transform 0.3s ease;
}

.brand-golden-logo:hover {
    transform: scale(1.04);
}

.brand-name-gold {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #F5A623;
    margin: 0 0 6px 0;
    text-shadow: 0 0 12px rgba(245, 166, 35, 0.45);
}

.brand-desc-gold {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #C6933A;
    margin: 0;
    text-transform: uppercase;
    line-height: 1.45;
    max-width: 240px;
}

/* Vertical Divider */
.auth-card-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 32px 0;
}

/* Right Form Side */
.auth-form-side {
    flex: 1 1 56%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 44px 38px;
}

.form-header-note {
    font-size: 13px;
    color: rgba(245, 166, 35, 0.8);
    margin-bottom: 16px;
    font-weight: 500;
}

/* Segmented Tab Switcher (Đăng nhập / Đăng ký) */
.auth-tab-segmented {
    display: flex;
    gap: 6px;
    background: #1C1B1A;
    border: 1px solid rgba(245, 166, 35, 0.22);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.auth-tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #888884;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.auth-tab-btn:hover {
    color: #CCCCCC;
}

.auth-tab-btn.active {
    background: #F5A623 !important;
    color: #161003 !important;
    box-shadow: 0 2px 10px rgba(245, 166, 35, 0.35);
}

.tab-btn-icon {
    flex-shrink: 0;
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.auth-input-label {
    font-size: 11px;
    font-weight: 700;
    color: #E5A93C;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.auth-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #1C1B1A;
    border: 1px solid #333230;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.auth-field-wrapper:focus-within {
    border-color: #F5A623;
    box-shadow: 0 0 12px rgba(245, 166, 35, 0.28);
    background: #232220;
}

.field-icon-box {
    position: absolute;
    left: 14px;
    color: #E5A93C;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.auth-text-input {
    width: 100% !important;
    padding: 13px 40px 13px 42px !important;
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    font-size: 14px !important;
    outline: none !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
}

.auth-text-input::placeholder {
    color: #666560 !important;
    font-size: 13.5px !important;
}

.btn-toggle-password {
    position: absolute;
    right: 10px;
    background: transparent !important;
    border: none !important;
    color: #777670 !important;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.btn-toggle-password:hover {
    color: #E5A93C !important;
}

/* Extra row: Remember me & Forgot Password */
.auth-extra-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -2px;
    margin-bottom: 4px;
    font-size: 12.5px;
}

.auth-custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #CCCCCC;
    user-select: none;
}

.auth-custom-checkbox input {
    display: none;
}

.checkbox-box {
    width: 16px;
    height: 16px;
    border: 1.5px solid #444340;
    border-radius: 4px;
    background: #1C1B1A;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: transparent;
}

.auth-custom-checkbox input:checked + .checkbox-box {
    background: #F5A623;
    border-color: #F5A623;
    color: #161003;
}

.auth-forgot-link {
    color: #E5A93C;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    transition: color 0.15s ease;
}

.auth-forgot-link:hover {
    color: #FFAF38;
    text-decoration: underline;
}

/* Golden Submit Button */
.btn-auth-gold {
    width: 100% !important;
    padding: 13px 20px !important;
    background: #F5A623 !important;
    border: none !important;
    border-radius: 12px !important;
    color: #161003 !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 8px 24px rgba(245, 166, 35, 0.35) !important;
    transition: all 0.2s ease !important;
    margin-top: 4px;
}

.btn-auth-gold:hover {
    background: #FFAF38 !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(245, 166, 35, 0.45) !important;
}

.btn-auth-gold:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px rgba(245, 166, 35, 0.3) !important;
}

.btn-auth-gold:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn-auth-gold .btn-text-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Password Strength Indicator */
.password-strength-widget {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.strength-bars {
    display: flex;
    gap: 4px;
    height: 4px;
}

.strength-bar-seg {
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    transition: background-color 0.25s ease;
}

.strength-bar-seg.active-lvl1 { background: #FF4D4F; }
.strength-bar-seg.active-lvl2 { background: #FAAD14; }
.strength-bar-seg.active-lvl3 { background: #F5A623; }
.strength-bar-seg.active-lvl4 { background: #52C41A; }

.strength-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888880;
}

.strength-result-text {
    font-weight: 700;
}

.strength-result-text.lvl1 { color: #FF4D4F; }
.strength-result-text.lvl2 { color: #FAAD14; }
.strength-result-text.lvl3 { color: #F5A623; }
.strength-result-text.lvl4 { color: #52C41A; }

/* Password Match Badge */
.password-match-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #52C41A;
    font-weight: 600;
    margin-top: 4px;
}

.password-match-badge.mismatch,
.password-match-badge.unmatched {
    color: #FF4D4F;
}

.password-match-badge.matched {
    color: #52C41A;
}

/* Footer Brand Notes matching screenshot */
.auth-footer-brand {
    margin-top: 28px;
    text-align: center;
    font-size: 11px;
    color: #666560;
    line-height: 1.6;
}

.auth-footer-brand .footer-copy strong {
    color: #A09885;
}

.auth-footer-brand .footer-sub strong {
    color: #F5A623;
}

/* ==========================================================================
   STEP 2: PROFILE ONBOARDING (DARK GOLDEN THEME)
   ========================================================================== */

.auth-step-onboarding {
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.onboarding-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(245, 166, 35, 0.15);
    border: 1px solid rgba(245, 166, 35, 0.35);
    color: #F5A623;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.pulse-step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #F5A623;
    box-shadow: 0 0 8px #F5A623;
}

.onboarding-title {
    font-size: 22px;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0 0 6px 0;
}

.onboarding-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    max-width: 440px;
    line-height: 1.5;
    margin: 0 auto 20px auto;
}

.onboarding-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.onboarding-avatar-ring {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #F5A623 0%, #FF6000 100%);
    cursor: pointer;
    box-shadow: 0 0 20px rgba(245, 166, 35, 0.4);
    transition: transform 0.2s ease;
}

.onboarding-avatar-ring:hover {
    transform: scale(1.05);
}

.onboarding-avatar-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-camera-overlay {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #FFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
    font-size: 11px;
    font-weight: 700;
}

.onboarding-avatar-ring:hover .avatar-camera-overlay {
    opacity: 1;
}

.avatar-hint-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 8px;
}

/* Preset Avatars */
.onboarding-presets-container {
    width: 100%;
    max-width: 400px;
    text-align: left;
    margin-bottom: 14px;
}

.presets-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #E5A93C;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.onboarding-preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.onboarding-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: #1C1B1A !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    user-select: none;
}

.preset-img-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.preset-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.onboarding-preset-btn span {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.onboarding-preset-btn:hover {
    transform: translateY(-2px);
    background: #242320 !important;
    border-color: rgba(245, 166, 35, 0.4) !important;
}

.onboarding-preset-btn.active {
    border-color: #F5A623 !important;
    background: rgba(245, 166, 35, 0.15) !important;
    box-shadow: 0 0 12px rgba(245, 166, 35, 0.35) !important;
    transform: translateY(-2px) !important;
}

.onboarding-preset-btn.active .preset-img-wrap {
    border-color: #F5A623;
}

.onboarding-preset-btn.active span {
    color: #F5A623;
}

.onboarding-actions {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.btn-skip-subtle {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    cursor: pointer;
    padding: 6px 16px !important;
    border-radius: 8px !important;
    transition: color 0.15s ease !important;
}

.btn-skip-subtle:hover {
    color: #F5A623 !important;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (DESKTOP & MOBILE)
   ========================================================================== */

@media (max-width: 768px) {
    .auth-unified-layout {
        flex-direction: column;
    }

    .auth-card-divider {
        width: 100%;
        height: 1px;
        margin: 0;
    }

    .auth-brand-side {
        padding: 28px 20px 16px;
    }

    .brand-logo-glow-box {
        width: 100px;
        height: 100px;
        margin-bottom: 12px;
    }

    .brand-golden-logo {
        width: 85px;
        height: 85px;
    }

    .brand-name-gold {
        font-size: 22px;
    }

    .brand-desc-gold {
        font-size: 9.5px;
    }

    .auth-form-side {
        padding: 20px 20px 28px;
    }

    .miatech-luxury-card {
        border-radius: 20px;
        max-width: 440px;
    }
}

@media (max-width: 480px) {
    #login-screen.auth-screen {
        padding: 16px 12px max(24px, env(safe-area-inset-bottom, 24px)) !important;
    }

    .auth-form-side {
        padding: 16px 16px 24px;
    }

    .brand-logo-glow-box {
        width: 85px;
        height: 85px;
    }

    .brand-golden-logo {
        width: 72px;
        height: 72px;
    }

    .auth-text-input {
        font-size: 15px !important;
    }
}

/* Native Keyboard Active State */
#login-screen.keyboard-active .brand-logo-glow-box,
body.keyboard-open #login-screen .brand-logo-glow-box {
    display: none !important;
}

#login-screen.keyboard-active .brand-desc-gold,
body.keyboard-open #login-screen .brand-desc-gold {
    display: none !important;
}

.input-group {
    text-align: left;
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.1px;
}

.input-group input,
.input-group textarea,
.file-input {
    width: 100%;
    padding: 13px 16px;
    background-color: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    outline: none;
}

.input-group input:focus,
.input-group textarea:focus {
    background-color: var(--bg-input-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 78, 39, 0.15);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

/* ==========================================================================
   APP CONTAINER & LAYOUT
   ========================================================================== */

.app-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    background-color: var(--bg-body);
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   SIDEBAR (iOS Classic Grouped List / Navigation)
   ========================================================================== */

.sidebar {
    width: 350px;
    height: 100%;
    background-color: var(--bg-surface);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    min-height: 0;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 12;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--primary, #FF7700) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sidebar-header h2::before {
    display: none;
}

/* Mobile Header Avatar & Title Wrapper */
.sidebar-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.sidebar-title-wrapper:active {
    transform: scale(0.97);
    opacity: 0.85;
}

.header-user-avatar-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    max-width: 38px;
    max-height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
}

.header-user-avatar-wrap img,
#header-current-user-avatar {
    width: 100% !important;
    height: 100% !important;
    max-width: 38px !important;
    max-height: 38px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid var(--primary, #FF7700);
    box-shadow: 0 2px 8px rgba(255, 119, 0, 0.25);
    display: block;
    background: var(--bg-tertiary, #f1f5f9);
}

.header-user-avatar-wrap .status-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--bg-surface, #FFFFFF);
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

[data-theme="dark"] .header-user-avatar-wrap .status-indicator {
    border-color: #161b22 !important;
}

/* iOS Classic Translucent Search Bar */
.sidebar-search {
    padding: 10px 16px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 9px 14px 9px 38px !important;
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08)) !important;
    border-radius: 14px !important;
    background-color: var(--bg-surface, #FFFFFF) !important;
    color: var(--text-primary) !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    outline: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    transition: all 0.18s ease !important;
}

.sidebar-search input:focus {
    background-color: #FFFFFF !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 119, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

/* Channels & DMs List */
.sidebar-channels {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
}

.category {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 10px 18px 6px;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.category-header:hover {
    color: var(--primary);
}

.category-header svg {
    margin-right: 4px;
    transition: transform 0.2s ease;
}

.category.collapsed .category-header svg {
    transform: rotate(-90deg);
}

.category-channels {
    display: flex;
    flex-direction: column;
}

.category.collapsed .category-channels {
    display: none;
}

/* Chat Item (Zalo / iOS Messages row) */
.zalo-chat-item, .channel-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    background-color: transparent;
    transition: background-color 0.15s ease, transform 0.1s ease;
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.zalo-chat-item:hover, .channel-item:hover {
    background-color: var(--bg-hover);
}

.zalo-chat-item:active, .channel-item:active {
    background-color: var(--bg-active);
}

.zalo-chat-item.active, .channel-item.active {
    background-color: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.chat-avatar-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    max-width: 50px;
    max-height: 50px;
    margin-right: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    max-width: 50px;
    max-height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: block;
}

.chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.chat-name {
    font-weight: 600;
    font-size: 15.5px;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
    font-weight: 500;
}

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

.chat-snippet {
    font-size: 13.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    line-height: 1.3;
}

/* Badges Wrapper in Sidebar List */
.chat-badges-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* iOS Unread Badge */
.chat-unread-badge {
    background: var(--primary-gradient);
    color: #FFFFFF;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    min-width: 20px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 78, 39, 0.4);
}

/* Mention Badge in Sidebar List */
.chat-mention-badge {
    background: linear-gradient(135deg, #FF3B30 0%, #FF2D55 100%);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    width: 19px;
    height: 19px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 45, 85, 0.4);
    animation: mentionPulse 2s infinite ease-in-out;
}

@keyframes mentionPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chat Mention Pill in Snippet */
.chat-mention-pill {
    color: #FF3B30;
    font-weight: 700;
    font-size: 12px;
    display: inline-block;
    margin-right: 4px;
}

[data-theme="dark"] .chat-mention-pill {
    color: #FF453A;
}

/* Sidebar User Footer */
.sidebar-user {
    background: var(--bg-header);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
}

.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex: 1;
    min-width: 0;
    transition: background-color 0.15s;
}

.sidebar-user .user-info:hover {
    background-color: var(--bg-hover);
}

.sidebar-user .user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

.sidebar-user .user-details .status {
    font-size: 12px;
    color: var(--ios-green);
    font-weight: 500;
}

.sidebar-user .user-actions {
    display: flex;
    gap: 4px;
}

/* ==========================================================================
   APP MAIN CONTENT & HEADER
   ========================================================================== */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    background-color: var(--bg-body);
    position: relative;
}

/* Header */
.app-header {
    height: var(--header-height);
    flex-shrink: 0;
    background: var(--bg-surface-translucent);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    z-index: 15;
    position: relative;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    cursor: default;
    padding: 4px 8px;
    border-radius: 12px;
    user-select: none;
}

.header-avatar-wrapper {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-channel-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 119, 0, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-composite-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    gap: 1px;
    background: var(--border, #E5E7EB);
    border: 1.5px solid rgba(255, 119, 0, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-composite-avatar.grid-2 { grid-template-columns: 1fr 1fr; }
.header-composite-avatar.grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.header-composite-avatar.grid-3 img:first-child { grid-column: span 2; }
.header-composite-avatar.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.header-composite-avatar img { width: 100%; height: 100%; object-fit: cover; }

.header-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10B981;
    border: 2px solid var(--bg-surface, #FFFFFF);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.6);
}

.header-meta-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header-meta-wrap h2 {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.header-channel-status {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .header-online-dot {
    border-color: #161b22;
}

.hash-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.chat-more-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12), 0 3px 12px rgba(255, 119, 0, 0.08);
    z-index: 250;
    min-width: 230px;
    padding: 8px;
    animation: scaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.chat-more-dropdown .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.chat-more-dropdown .menu-item svg {
    color: var(--primary) !important;
    flex-shrink: 0;
}

.chat-more-dropdown .menu-item:hover {
    background: rgba(255, 119, 0, 0.1);
    color: var(--primary);
    transform: translateX(3px);
}

.chat-more-dropdown .menu-item:active {
    transform: scale(0.97);
}

.chat-more-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 6px 0;
}

[data-theme="dark"] .chat-more-dropdown {
    background: rgba(22, 27, 34, 0.94) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .chat-more-dropdown .menu-item {
    color: #e6edf3;
}

[data-theme="dark"] .chat-more-dropdown .menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .chat-more-divider {
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   HOME WELCOME AREA
   ========================================================================== */

.home-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 20%, rgba(255, 104, 56, 0.08) 0%, transparent 50%),
                var(--bg-body);
    overflow-y: auto;
}

.home-content {
    background: var(--bg-surface);
    padding: 44px 32px;
    border-radius: var(--radius-xl);
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: scaleUp 0.3s ease;
}

.home-illustration {
    width: 96px;
    height: 96px;
    margin-bottom: 20px;
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(255, 78, 39, 0.3);
    object-fit: cover;
}

.home-content h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.4px;
    color: var(--text-primary);
}

.home-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 14.5px;
    line-height: 1.5;
}

.home-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-actions .btn {
    padding: 14px 20px;
    font-size: 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   MESSAGE AREA & iOS BUBBLES
   ========================================================================== */

.message-area {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    overflow-anchor: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    background-color: #F4F4F7;
    background-image: url('../images/chat_wallpaper.png');
    background-repeat: repeat;
    background-size: 380px auto;
    position: relative;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.message,
.message * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.message-text::selection,
.message-content::selection,
.message::selection,
.message *::selection {
    background: transparent !important;
    color: inherit !important;
}

.brand-chat-3d-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    filter: drop-shadow(0 12px 28px rgba(255, 78, 39, 0.36));
    margin-bottom: 14px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-chat-3d-logo:hover {
    transform: scale(1.08) rotate(-3deg);
}

.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 18px 0 14px;
    position: relative;
}

.date-separator span {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.message {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 4px 6px;
    position: relative;
    max-width: 100%;
    border-radius: 18px;
    transition: background-color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

/* While Pressing Message (Touch visual feedback) */
.message.message-pressed {
    background-color: rgba(255, 119, 0, 0.08) !important;
}

.message.message-pressed .message-text,
.message.message-pressed .media-card,
.message.message-pressed .voice-message-player,
.message.message-pressed .poll-card {
    filter: brightness(0.95);
    transform: scale(0.985);
    transition: transform 0.15s ease, filter 0.15s ease;
}

[data-theme="dark"] .message.message-pressed {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

/* When Long-Press / Context Menu is Active */
.message.message-context-active {
    z-index: 1205 !important;
    background-color: rgba(255, 119, 0, 0.14) !important;
    box-shadow: 0 0 0 2px rgba(255, 119, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.08);
}

.message.message-context-active .message-text,
.message.message-context-active .media-card,
.message.message-context-active .voice-message-player,
.message.message-context-active .poll-card {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(255, 119, 0, 0.25) !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

[data-theme="dark"] .message.message-context-active {
    background-color: rgba(255, 130, 0, 0.2) !important;
    box-shadow: 0 0 0 2px rgba(255, 119, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.message-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    align-self: flex-end;
}

.message-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.message-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
    padding-left: 4px;
}

.message-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-time-inline {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 3px;
    padding: 0 4px;
    align-self: flex-start;
}

.message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 78%;
    min-width: 0;
}

/* Message Bubble - Others (Received) */
.message-text {
    font-size: 15px;
    line-height: 1.42;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    background-color: var(--bg-bubble-received);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: inline-block;
}

.message-link {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all;
}

/* Message Bubble - Self (Sent) - CAM ĐỎ GRADIENT */
.message-self {
    flex-direction: row-reverse;
}

.message-self .message-avatar {
    display: none;
}

.message-self .message-header {
    display: none;
}

.message-self .message-body {
    align-items: flex-end;
}

.message-self .message-content {
    align-items: flex-end;
}

.message-self .message-text {
    background: var(--primary-gradient);
    color: #FFFFFF;
    border-radius: 18px 18px 4px 18px;
    box-shadow: var(--primary-glow);
    border: none;
}

.message-self .message-link {
    color: #FFFFFF;
    text-decoration: underline;
    font-weight: 500;
}

.message-self .message-time-inline {
    align-self: flex-end;
}

/* Grouped consecutive messages */
.message-group {
    margin-top: 3px;
}

.message-group .message-header {
    display: none;
}

/* Message Replies */
.message-reply-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #1f2937;
    background: #FFFFFF;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 3.5px solid var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 5px;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: transform 0.15s ease, background 0.15s ease;
}

.message-reply-banner:hover {
    transform: scale(1.01);
}

.message-reply-banner svg {
    color: var(--primary);
    flex-shrink: 0;
}

.message-reply-banner strong {
    color: var(--primary);
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.message-reply-banner span {
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-self .message-reply-banner {
    background: #FFFFFF;
    color: #1f2937;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 3.5px solid var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.message-self .message-reply-banner svg {
    color: var(--primary);
}

.message-self .message-reply-banner strong {
    color: var(--primary);
    font-weight: 700;
}

.message-self .message-reply-banner span {
    color: #374151;
}

/* System Message Pill (Centered Notification) */
.message-system-pill {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    align-self: center !important;
    width: 100% !important;
    margin: 12px auto !important;
    padding: 2px 10px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    user-select: none;
    clear: both !important;
    animation: fadeIn 0.25s ease;
}

.message-system-pill span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px;
    background: rgba(255, 255, 255, 0.88) !important;
    
    color: var(--text-secondary) !important;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.85);
    max-width: 90%;
    word-break: break-word;
}

[data-theme="dark"] .message-system-pill span {
    background: rgba(30, 36, 44, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: var(--text-secondary) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

/* History Top Loader */
.history-top-loader {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 8px;
}

.history-top-loader.hidden {
    display: none !important;
}

/* Chat History Start Banner */
.chat-history-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 16px 14px;
    margin: 8px 0 16px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    
    -webkit-
    max-width: 480px;
    align-self: center;
    width: 100%;
}

.chat-history-start-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 78, 39, 0.12), rgba(255, 149, 0, 0.18));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 8px;
}

.chat-history-start-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.chat-history-start-desc {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Scroll To Bottom Button */
.btn-scroll-bottom {
    position: absolute;
    bottom: 85px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 25;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    
}

.btn-scroll-bottom:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: var(--primary);
}

.btn-scroll-bottom:active {
    transform: translateY(0) scale(0.95);
}

.btn-scroll-bottom.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.8);
}

.scroll-bottom-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 78, 39, 0.4);
    border: 2px solid #fff;
}

.scroll-bottom-badge.hidden {
    display: none !important;
}

@media (max-width: 767px) {
    .btn-scroll-bottom {
        bottom: 80px;
        right: 16px;
        width: 38px;
        height: 38px;
    }
}

/* Media Attachments & Multi-Image Gallery */
.attachment-gallery {
    display: grid;
    gap: 4px;
    max-width: 320px;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    margin-top: 4px;
    margin-bottom: 4px;
}

.attachment-gallery.attachment-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    aspect-ratio: 16/9;
    max-height: 220px;
}

.attachment-gallery.attachment-grid-3 {
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: repeat(2, 1fr);
    aspect-ratio: 1/1;
    max-height: 280px;
}
.attachment-gallery.attachment-grid-3 .gallery-item-wrap:first-child {
    grid-row: span 2;
}

.attachment-gallery.attachment-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    aspect-ratio: 1/1;
    max-height: 280px;
}

.gallery-item-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 70px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}

.gallery-item-thumb {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-wrap:hover .gallery-item-thumb {
    transform: scale(1.04);
}

.gallery-more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #FFFFFF;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    letter-spacing: 0.5px;
    pointer-events: none;
}

.gallery-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    color: var(--primary, #FF7700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.message-image {
    max-width: 280px !important;
    max-height: 320px !important;
    width: auto;
    height: auto;
    min-height: 60px;
    min-width: 60px;
    border-radius: 14px;
    cursor: pointer;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
    display: block;
    background-color: rgba(0, 0, 0, 0.04);
}

.message-image:active {
    transform: scale(0.98);
}

@media (max-width: 767px) {
    .attachment-gallery {
        max-width: 250px;
    }
    .message-image {
        max-width: 240px !important;
        max-height: 280px !important;
    }
}

/* Cute Transparent Sticker (PNG & GIF) */
.message-sticker {
    width: 110px;
    height: 110px;
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 8px;
    display: block;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s ease;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
    user-select: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
}

.message-sticker:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.18));
}

.message-sticker:active {
    transform: scale(0.92);
}

/* Chat bubble styling when message contains a sticker */
.message.message-has-sticker .message-content,
.message.message-has-sticker.message-self .message-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.message.message-has-sticker .message-text,
.message.message-has-sticker.message-self .message-text {
    display: none !important;
}

.message-video {
    max-width: 300px;
    max-height: 280px;
    min-height: 100px;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    background: #000;
    display: block;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 280px;
}

.message-file svg {
    color: var(--primary);
    flex-shrink: 0;
}

.message-file .file-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.message-album {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-width: 320px;
}

.message-album img {
    width: 100%;
    height: 120px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
}

.message-deleted {
    font-style: italic;
    color: var(--text-muted);
    font-size: 13px;
}

.message-edited {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 4px;
}

/* Message Hover Actions (Desktop) */
.message-actions {
    position: absolute;
    right: 16px;
    top: -12px;
    background: var(--bg-surface-translucent);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    display: none;
    padding: 2px 6px;
    box-shadow: var(--shadow-md);
    z-index: 10;
    gap: 2px;
}

.message:hover .message-actions {
    display: flex;
}

@media (hover: none), (max-width: 768px) {
    .message-actions, .message:hover .message-actions {
        display: none !important;
    }
}

.message-self .message-actions {
    right: auto;
    left: 16px;
}

/* Reactions */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.reaction-pill:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.reaction-pill.active {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.reaction-count {
    font-size: 11.5px;
    font-weight: 600;
}

/* Floating Reaction Picker (Classic Translucent Glassmorphism) */
.reaction-picker {
    position: fixed;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(28px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
    border-radius: var(--radius-full);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    padding: 5px 10px;
    display: none;
    align-items: center;
    gap: 6px;
}
.reaction-picker.show {
    display: flex;
    animation: scaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.reaction-picker .emoji-btn {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: transform 0.15s ease, background-color 0.15s;
}
.reaction-picker .emoji-btn:hover {
    transform: scale(1.35);
    background-color: rgba(255, 78, 39, 0.15);
}

/* ==========================================================================
   INPUT BAR (iOS MESSENGER STYLE)
   ========================================================================== */

.input-bar-container {
    padding: 6px 12px calc(4px + env(safe-area-inset-bottom, 0px) * 0.35);
    background: var(--bg-surface-translucent);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 20;
}

.input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
}

/* iOS Translucent Glass Attach Button */
.btn-attach {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7) !important;
    
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 1px #FFFFFF !important;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
    margin-bottom: 2px;
    user-select: none;
}

.btn-attach:hover {
    background: rgba(255, 255, 255, 0.92) !important;
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(255, 78, 39, 0.18), inset 0 1px 1px #FFFFFF !important;
}

.btn-attach:active {
    transform: scale(0.92) !important;
}

/* iOS Translucent Glass Attach Menu Popover */
.attach-menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

.attach-menu-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12), 0 3px 12px rgba(255, 119, 0, 0.08);
    z-index: 250;
    min-width: 240px;
    padding: 8px;
    animation: scaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom left;
}

.attach-menu-dropdown .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.attach-menu-dropdown .menu-item svg {
    color: var(--primary) !important;
    flex-shrink: 0;
}

.attach-menu-dropdown .menu-item:hover {
    background: rgba(255, 119, 0, 0.1);
    color: var(--primary);
    transform: translateX(3px);
}

.attach-menu-dropdown .menu-item:active {
    transform: scale(0.97);
}

[data-theme="dark"] .attach-menu-dropdown {
    background: rgba(22, 27, 34, 0.94) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .attach-menu-dropdown .menu-item {
    color: #e6edf3;
}

[data-theme="dark"] .attach-menu-dropdown .menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* iOS Translucent Glass Input Wrapper */
.input-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.72) !important;
    
    border-radius: 20px !important;
    padding: 4px 14px !important;
    display: flex;
    flex-direction: column;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 78, 39, 0.15), 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

.input-wrapper textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    padding: 6px 0;
    user-select: text;
    -webkit-user-select: text;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

/* Reply Preview (Bar above input) */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #FFFFFF;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    margin-bottom: 6px;
    font-size: 12.5px;
}

.reply-content-preview {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    gap: 2px;
}

.reply-content-preview strong,
#reply-preview-author {
    font-weight: 700;
    color: var(--primary);
    font-size: 12.5px;
}

#reply-preview-text {
    color: #4b5563;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   MENTION AUTOCOMPLETE & TAGS (@mention & @all)
   ========================================================================== */

.input-wrapper {
    position: relative;
}

.mention-autocomplete-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 250px;
    background: var(--bg-surface, #FFFFFF);
    border-radius: 16px;
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.1));
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    z-index: 1000;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: mentionPopUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.mention-autocomplete-dropdown.hidden {
    display: none !important;
}

@keyframes mentionPopUp {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
}

.mention-item:hover,
.mention-item.selected {
    background: rgba(255, 119, 0, 0.12);
}

.mention-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.mention-item-icon-all {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF7700 0%, #FF4500 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(255, 119, 0, 0.35);
}

.mention-item-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.mention-item-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-normal, #1E293B);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-item-username {
    font-size: 11.5px;
    color: var(--text-muted, #64748B);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-item.is-all .mention-item-name {
    color: #FF5500;
    font-weight: 800;
}

/* Mention Tags inside message content */
.mention-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13.5px;
    background: rgba(255, 119, 0, 0.12);
    color: #D94800;
    border: 1px solid rgba(255, 119, 0, 0.25);
    margin: 0 1px;
    vertical-align: baseline;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: all 0.15s ease;
}

.mention-tag-all {
    background: #FFF0E6;
    color: #C23800;
    border: 1px solid #FFB280;
    font-weight: 800;
    box-shadow: 0 1px 3px rgba(255, 119, 0, 0.12);
}

.mention-tag-me {
    background: #FFE8D9;
    color: #B32E00;
    border: 1.5px solid #FF8C42;
    font-weight: 800;
}

/* Mention Tags inside Self Sent Messages (High Contrast on Orange Bubble) */
.message-self .mention-tag {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    font-weight: 700;
}

.message-self .mention-tag-all {
    background: #FFFFFF !important;
    color: #E64A00 !important;
    border: 1px solid rgba(255, 255, 255, 0.95) !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18) !important;
}

.message-self .mention-tag-me {
    background: #FFFFFF !important;
    color: #D94800 !important;
    border: 1px solid rgba(255, 255, 255, 0.95) !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18) !important;
}

/* Message Mention Highlight */
.message.is-mentioned:not(.message-self) .message-text {
    background-color: #FFF9F5 !important;
    border: 1.5px solid #FF9433 !important;
    box-shadow: 0 2px 10px rgba(255, 119, 0, 0.15) !important;
}

[data-theme="dark"] .mention-autocomplete-dropdown {
    background: rgba(22, 27, 34, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .mention-item-name {
    color: #F0F6FC;
}

[data-theme="dark"] .mention-tag {
    background: rgba(255, 148, 51, 0.18);
    color: #FFB366;
    border: 1px solid rgba(255, 148, 51, 0.35);
}

[data-theme="dark"] .mention-tag-all {
    background: rgba(255, 119, 0, 0.28);
    color: #FFC285;
    border: 1px solid #FF9433;
}

[data-theme="dark"] .mention-tag-me {
    background: rgba(255, 119, 0, 0.35);
    color: #FFD4A8;
    border: 1.5px solid #FFA85C;
}

[data-theme="dark"] .message.is-mentioned:not(.message-self) .message-text {
    background-color: #231c18 !important;
    border: 1.5px solid #FF9433 !important;
    box-shadow: 0 2px 12px rgba(255, 119, 0, 0.25) !important;
}

/* Upload Preview Drawer */
.upload-preview {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-light);
    overflow-x: auto;
    align-items: center;
    transition: all 0.2s ease;
}

.preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface-elevated, #f3f4f6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.preview-item:hover {
    transform: translateY(-2px);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-item.preview-loading-item {
    border: 1.5px dashed var(--primary);
    background: rgba(255, 119, 0, 0.05);
    animation: preview-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes preview-pulse {
    0% { opacity: 0.7; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.preview-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.preview-filename {
    font-size: 9.5px;
    font-weight: 600;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
    margin-top: 2px;
}

.btn-cancel-upload {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.65);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-cancel-upload:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.15);
}

/* iOS Glass Orb Send Button */
.btn-send {
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.95) 0%, rgba(255, 59, 48, 0.95) 100%) !important;
    
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(255, 78, 39, 0.4), inset 0 1px 1.5px rgba(255, 255, 255, 0.6) !important;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
    margin-bottom: 2px;
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

@keyframes popIn {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.btn-send:hover {
    background: linear-gradient(135deg, rgba(255, 120, 20, 0.98) 0%, rgba(255, 70, 60, 0.98) 100%) !important;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(255, 78, 39, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.btn-send:active {
    transform: scale(0.92) !important;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION BAR (iOS TAB BAR)
   ========================================================================== */

.mobile-bottom-nav {
    display: none;
}

/* ==========================================================================
   iOS CLASSIC TRANSLUCENT CONFIRMATION & ALERT DIALOG
   ========================================================================== */
.ios-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.ios-confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ios-confirm-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(35px) saturate(200%);
    -webkit-backdrop-filter: blur(35px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    width: 100%;
    max-width: 360px;
    padding: 26px 22px 22px 22px;
    text-align: center;
    transform: scale(0.9) translateY(12px);
    transition: transform 0.26s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    -webkit-user-select: none;
}

.ios-confirm-overlay.active .ios-confirm-card {
    transform: scale(1) translateY(0);
}

.ios-confirm-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.8), 0 4px 14px rgba(0, 0, 0, 0.06);
}

.ios-confirm-icon.danger {
    background: rgba(255, 59, 48, 0.14);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #FF3B30 !important;
}

.ios-confirm-icon.danger svg {
    color: #FF3B30 !important;
}

.ios-confirm-icon.primary {
    background: rgba(255, 119, 0, 0.14);
    border: 1px solid rgba(255, 119, 0, 0.3);
    color: var(--primary) !important;
}

.ios-confirm-icon.primary svg {
    color: var(--primary) !important;
}

.ios-confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.ios-confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 22px;
    padding: 0 4px;
    word-break: break-word;
}

.ios-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ios-confirm-actions .btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14.5px;
    border-radius: 14px;
}

.ios-confirm-actions.single .btn {
    flex: 1;
}

[data-theme="dark"] .ios-confirm-card {
    background: rgba(28, 28, 30, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 1px 1.5px rgba(255, 255, 255, 0.12) !important;
}

/* ==========================================================================
   MODALS & ACTION SHEETS (iOS CLASSIC TRANSLUCENT GLASS)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.42);
    
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

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

.modal {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    overflow: hidden;
    animation: slideModalUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.admin-header, .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent !important;
}

.admin-header h2, .modal-header h2, .modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin: 0;
}

.admin-content, .modal-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Search Modal */
.search-modal {
    max-width: 540px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    gap: 12px;
    background: transparent;
}

.search-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    outline: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-input-wrapper input:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 78, 39, 0.15);
}

.search-results {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
}

.search-result-item {
    padding: 14px;
    background: rgba(255, 255, 255, 0.65);
    
    border-radius: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.search-result-item:hover {
    border-color: rgba(255, 78, 39, 0.35);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.search-result-item:active {
    transform: scale(0.98);
}

.search-result-author {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-channel-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(255, 78, 39, 0.1);
    color: var(--primary);
}

.search-result-content {
    font-size: 13.5px;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

.search-result-content mark {
    background: rgba(255, 193, 7, 0.35);
    color: inherit;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.search-result-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.search-attachment-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    margin-top: 5px;
    color: var(--text-secondary);
}

/* Glow highlight for message when jumped to from search */
.message-search-highlight {
    animation: searchPulse 2.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes searchPulse {
    0% {
        background-color: rgba(255, 193, 7, 0.45);
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
    }
    50% {
        background-color: rgba(255, 193, 7, 0.25);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
        box-shadow: none;
    }
}

/* Media Gallery Enhancements */
.media-grid-item {
    aspect-ratio: 1 / 1;
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.media-grid-item:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.media-grid-item img,
.media-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
    background: #000;
    transition: transform 0.3s ease;
}

.media-grid-item:hover img,
.media-grid-item:hover video {
    transform: scale(1.06);
}

.media-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    
    -webkit-
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background 0.2s;
}

.media-grid-item:hover .media-play-overlay {
    transform: translate(-50%, -50%) scale(1.15);
    background: var(--primary);
}

.media-file-card {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    gap: 12px;
}

.media-file-card:hover {
    border-color: rgba(255, 78, 39, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.media-file-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 78, 39, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.media-file-details {
    flex: 1;
    min-width: 0;
}

.media-file-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-file-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-result-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

/* Media Storage Modal */
.media-modal {
    border-radius: var(--radius-xl) !important;
}

.media-tab-btn {
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    font-size: 14.5px;
}

.media-tab-btn.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
}

/* Context Menu Backdrop Overlay */
.context-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1199;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.context-menu-backdrop.show {
    opacity: 1;
}

/* Context Menu (Classic Translucent Glassmorphism Style) */
.context-menu {
    position: fixed;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.76) !important;
    backdrop-filter: blur(28px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
    border-radius: 20px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    padding: 8px !important;
    min-width: 220px;
    animation: scaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.context-menu.menu-opening {
    pointer-events: none !important;
}

.context-reactions {
    display: flex;
    justify-content: space-around;
    padding: 6px 4px;
    gap: 4px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 14px;
    margin-bottom: 6px;
}

.emoji-btn-context {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: transform 0.15s ease, background-color 0.15s;
    line-height: 1;
}

.emoji-btn-context:hover {
    transform: scale(1.3);
    background-color: rgba(255, 78, 39, 0.15);
}

.emoji-btn-context:active {
    transform: scale(0.9);
}

.context-divider {
    display: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    margin: 2px 0;
}

.menu-item:hover {
    background-color: rgba(255, 78, 39, 0.12);
    color: var(--primary);
    transform: translateX(3px);
}

.menu-item.text-danger:hover {
    background-color: rgba(255, 59, 48, 0.12);
    color: var(--ios-red);
}

/* Lightbox Gallery (Swipeable, Touch-friendly with Prev/Next Navigation) */
.lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: pan-y;
}

.lightbox-toolbar {
    position: absolute;
    top: calc(16px + var(--safe-top));
    right: 16px;
    display: flex;
    align-items: center;
    z-index: 2010;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-counter {
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    padding: 2px 8px;
    letter-spacing: 0.3px;
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2005;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.lightbox-nav-btn.prev {
    left: 20px;
}

.lightbox-nav-btn.next {
    right: 20px;
}

.lightbox-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.lightbox-media-item {
    max-width: 92vw;
    max-height: 86vh;
    border-radius: 14px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
    object-fit: contain;
    image-orientation: from-image;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.slide-in-right {
    animation: lightboxSlideRight 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-in-left {
    animation: lightboxSlideLeft 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in {
    animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxSlideRight {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes lightboxSlideLeft {
    from { opacity: 0; transform: translateX(-60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes lightboxFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
    .lightbox-nav-btn {
        width: 42px;
        height: 42px;
    }
    .lightbox-nav-btn.prev {
        left: 10px;
    }
    .lightbox-nav-btn.next {
        right: 10px;
    }
}

/* Loading Dots */
.loading-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
    animation: bounceDot 1.2s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounceDot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Toast Notifications - Floating Banner (Classic Translucent Glass with Orange Accent) */
#toast-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.84) !important;
    backdrop-filter: blur(28px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
    color: var(--text-primary) !important;
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 16px 40px rgba(255, 78, 39, 0.14), 0 4px 12px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.7) inset !important;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    border-left: 4px solid var(--primary) !important;
}

@keyframes toastSlideDown {
    from { opacity: 0; transform: translateY(-24px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.toast-error {
    border-left-color: #FF3B30 !important;
    box-shadow: 0 16px 40px rgba(255, 59, 48, 0.14), 0 4px 12px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.7) inset !important;
}

.toast.toast-success {
    border-left-color: #34C759 !important;
    box-shadow: 0 16px 40px rgba(52, 199, 89, 0.14), 0 4px 12px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.7) inset !important;
}

/* Members Panel (Classic Translucent Glass) */
.member-panel {
    width: 270px;
    height: 100%;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.7) !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.08) !important;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.member-panel.open {
    transform: translateX(0);
}

.member-header {
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: transparent !important;
}

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.45);
    
    border: 1px solid rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateX(-2px);
    border-color: var(--primary);
}

.member-item .name {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Badge helpers */
.badge {
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}
.badge-accent, .badge-admin {
    background: var(--primary-light);
    color: var(--primary);
}
.badge-default, .badge-user {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ==========================================================================
   MOBILE-FIRST RESPONSIVE OPTIMIZATIONS (SMARTPHONES)
   ========================================================================== */

.btn-mobile-back { display: none; }
.btn-mobile-more { display: none; }

@media (max-width: 768px) {
    .hidden-on-mobile {
        display: none !important;
    }

    .app-container {
        flex-direction: column;
        height: 100%;
        height: var(--app-height, 100dvh);
        max-height: var(--app-height, 100dvh);
        overflow: hidden;
        min-height: 0;
    }

    /* Fullscreen View Toggling on Mobile */
    .sidebar {
        position: relative;
        width: 100%;
        height: 100%;
        height: var(--app-height, 100dvh);
        max-height: var(--app-height, 100dvh);
        flex: 1;
        min-height: 0;
        overflow: hidden;
        z-index: 10;
        transform: none;
        display: flex;
        flex-direction: column;
        border-right: none;
        padding-bottom: 0 !important;
        box-sizing: border-box;
    }

    .sidebar-header {
        padding-top: var(--safe-top);
        height: calc(var(--header-height) + var(--safe-top));
        flex-shrink: 0;
    }

    .sidebar-search {
        flex-shrink: 0;
    }

    .sidebar-filter-tabs {
        flex-shrink: 0;
    }

    .online-users-bar {
        flex-shrink: 0;
    }

    .sidebar-channels {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
        -webkit-overflow-scrolling: touch;
    }

    .app-main {
        width: 100%;
        height: 100%;
        height: var(--app-height, 100dvh);
        max-height: var(--app-height, 100dvh);
        flex: 1;
        min-height: 0;
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .input-bar-container {
        padding: 6px 10px calc(4px + env(safe-area-inset-bottom, 0px) * 0.3) !important;
    }

    .app-header {
        padding-top: var(--safe-top);
        height: calc(var(--header-height) + var(--safe-top));
    }

    #btn-sidebar-toggle {
        display: none !important;
    }

    .btn-mobile-back {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--primary);
        padding: 8px 4px 8px 0;
        margin-right: 4px;
        cursor: pointer;
    }

    .btn-mobile-back svg {
        width: 26px;
        height: 26px;
    }

    /* Mobile Bottom Tab Bar (Ultra-Stylish Translucent Orange Glass Capsule Dock) */
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        background: linear-gradient(135deg, rgba(255, 119, 0, 0.36) 0%, rgba(230, 60, 20, 0.24) 100%) !important;
        backdrop-filter: blur(28px) saturate(240%) contrast(105%) !important;
        -webkit-backdrop-filter: blur(28px) saturate(240%) contrast(105%) !important;
        border: 1.5px solid rgba(255, 150, 60, 0.55) !important;
        border-radius: 36px !important;
        box-shadow: 0 16px 40px rgba(255, 119, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.12), inset 0 1px 2px rgba(255, 220, 180, 0.75) !important;
        padding: 6px 10px !important;
        position: fixed;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: calc(100% - 28px) !important;
        max-width: 390px !important;
        height: 68px !important;
        box-sizing: border-box !important;
        z-index: 150;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #FFFFFF !important;
        font-size: 11.5px;
        font-weight: 600;
        text-decoration: none;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
        gap: 3px;
        position: relative;
        cursor: pointer;
        padding: 6px 14px;
        border-radius: 26px;
        transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
        flex: 1;
        background: transparent;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-item.active {
        color: #FFFFFF !important;
        background: linear-gradient(135deg, rgba(255, 119, 0, 0.55), rgba(255, 78, 39, 0.4)) !important;
        font-weight: 700;
        text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
        box-shadow: 0 4px 14px rgba(255, 119, 0, 0.35), inset 0 1px 1.5px rgba(255, 255, 255, 0.8) !important;
    }

    .nav-item:active {
        transform: scale(0.92);
    }

    .nav-item svg {
        width: 26px;
        height: 26px;
    }

    .sidebar-user {
        display: none !important; /* Managed through "Cá nhân" tab on mobile */
    }

    #sidebar-overlay {
        display: none !important;
    }

    /* Mobile Context Menu Position */
    .context-menu {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: calc(20px + var(--safe-bottom)) !important;
        top: auto !important;
        width: 90%;
        max-width: 320px;
    }

    /* Mobile Modals -> iOS Bottom Sheets */
    /* FULLSCREEN MODALS & OVERLAYS ON MOBILE (Mở toàn màn hình không để ở dưới) */
    .modal-overlay {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        z-index: 2000 !important;
        background: rgba(0, 0, 0, 0.6) !important;
    }

    .modal,
    .profile-modal,
    .friends-modal,
    .chat-settings-modal,
    .media-modal,
    .seen-list-modal,
    .search-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        animation: fadeIn 0.2s ease !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(30px) saturate(190%) !important;
        -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    }

    .modal::before {
        display: none !important;
    }

    .admin-header, .modal-header {
        padding-top: max(16px, calc(12px + var(--safe-top))) !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
        border-radius: 0 !important;
        flex-shrink: 0 !important;
        background: rgba(255, 255, 255, 0.9) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    .admin-content,
    .modal-body,
    .friends-body,
    .media-content,
    .chat-settings-body,
    .seen-list-body {
        flex: 1 !important;
        max-height: none !important;
        height: auto !important;
        overflow-y: auto !important;
        padding: 18px 16px calc(40px + var(--safe-bottom)) !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .message-content {
        max-width: 86%;
    }
}

/* Upload Loading Spinner Overlay */
.upload-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #FFFFFF;
}

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

.spinner {
    border: 3.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top: 3.5px solid var(--primary);
    width: 44px;
    height: 44px;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.upload-loading-text {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

/* ==========================================================================
   CUTE STICKERS & AVATAR PRESETS
   ========================================================================== */

/* Cute Preset Avatars Picker */
.preset-avatar-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.preset-avatar-btn:hover {
    transform: scale(1.15);
    border-color: var(--primary);
    box-shadow: var(--primary-glow);
}

.preset-avatar-btn:active {
    transform: scale(0.95);
}

/* Cute Sticker Drawer (Classic Translucent Glass) */
.sticker-drawer {
    position: absolute;
    bottom: calc(var(--header-height) + 16px);
    right: 16px;
    width: 320px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
    padding: 14px;
    z-index: 100;
    animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 768px) {
    .sticker-drawer {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(70px + var(--safe-bottom));
        width: 92%;
    }
}

.sticker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sticker-tabs-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.06);
    padding: 3px;
    border-radius: 10px;
}

.sticker-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
}

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

.sticker-tab-btn.active {
    background: #FFFFFF;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    max-height: 270px;
    overflow-y: auto;
    padding: 4px 2px;
}

.sticker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.sticker-item:hover {
    background: rgba(255, 78, 39, 0.12);
    transform: translateY(-2px) scale(1.05);
    border-color: var(--primary);
}

.sticker-item:active {
    transform: scale(0.94);
}

.sticker-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    background: transparent;
    border-radius: 8px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.1));
}

.sticker-item span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Empty chat state illustration */
.empty-chat-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto;
    padding: 30px 20px;
    text-align: center;
    max-width: 320px;
    animation: fadeIn 0.4s ease;
}

.empty-chat-state img {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(255, 78, 39, 0.2);
    margin-bottom: 16px;
    object-fit: cover;
}

.empty-chat-state h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-chat-state p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ==========================================================================
   ONLINE USERS BAR (Stories / Active Users Row)
   ========================================================================== */

.online-users-bar {
    padding: 8px 14px 10px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.online-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.online-users-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-count-badge {
    background-color: rgba(52, 199, 89, 0.16);
    color: #248A3D;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
}

.online-users-scroll {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding: 2px 2px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.online-users-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.online-user-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    width: 52px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.online-user-item:hover {
    transform: translateY(-2px);
}

.online-user-item:active {
    transform: scale(0.92);
}

.online-avatar-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.online-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background-color: var(--bg-hover);
}

.online-pulse-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background-color: var(--ios-green);
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(52, 199, 89, 0.7);
}

.online-user-name {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.online-user-empty {
    font-size: 11.5px;
    color: var(--text-muted);
    font-style: italic;
    padding: 2px 0;
}

/* 3D Tab Icons in Mobile Navigation (Floating Capsule) */
.mobile-bottom-nav .nav-item .tab-icon-3d {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 9px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease, opacity 0.2s ease;
}

.mobile-bottom-nav .nav-item:not(.active) .tab-icon-3d {
    opacity: 0.82;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

.mobile-bottom-nav .nav-item.active .tab-icon-3d {
    opacity: 1;
    transform: scale(1.2) translateY(-2px);
    filter: drop-shadow(0 6px 14px rgba(255, 119, 0, 0.5));
}

.mobile-bottom-nav .nav-item:active .tab-icon-3d {
    transform: scale(0.92);
}

/* ==========================================================================
   CHAT SETTINGS & WALLPAPER MODAL
   ========================================================================== */

.chat-settings-modal {
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.chat-settings-body {
    padding: 16px 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-section-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-section-title span {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Wallpaper Preset Grid */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 480px) {
    .wallpaper-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

.wallpaper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    background: rgba(255, 255, 255, 0.5);
    
}

.wallpaper-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 78, 39, 0.12);
    border-color: var(--primary);
}

.wallpaper-item.active {
    border-color: var(--primary);
    background: rgba(255, 78, 39, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 78, 39, 0.25);
}

.wallpaper-thumb {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wallpaper-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-default { background: #F4F4F7; }
.thumb-logo-brand { background: #FFF8F2; }
.thumb-logo-pattern { background: #FFF6EE; }
.thumb-sunset { background: linear-gradient(135deg, #FFA000 0%, #FF6600 100%); }
.thumb-cat { background: #FFF5EB; }
.thumb-peach { background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 100%); }
.thumb-sky { background: linear-gradient(135deg, #A1C4FD 0%, #C2E9FB 100%); }
.thumb-mint { background: linear-gradient(135deg, #84FAB0 0%, #8FD3F4 100%); }
.thumb-clean { background: #F8F9FA; }

.wallpaper-item span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Settings List Rows (Classic Translucent Glass) */
.settings-list {
    background: rgba(255, 255, 255, 0.55);
    
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    gap: 12px;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-row-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-row-desc {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* iOS Toggle Switch */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

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

.ios-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E5E5EA;
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 34px;
}

.ios-switch .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}

.ios-switch input:checked + .slider {
    background-color: var(--primary);
}

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

/* Font Size Picker Buttons */
.font-size-picker {
    display: flex;
    background: var(--bg-hover);
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
    flex-shrink: 0;
}

.btn-font-size {
    border: none;
    background: transparent;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.btn-font-size.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

/* Font Size Adjustments on Message Area */
#message-area.chat-font-sm .message-text {
    font-size: 13px !important;
}

#message-area.chat-font-md .message-text {
    font-size: 14.5px !important;
}

#message-area.chat-font-lg .message-text {
    font-size: 16px !important;
}

/* ==========================================================================
   SEEN STATUS & READ RECEIPTS (iOS / ZALO STYLE)
   ========================================================================== */

.message-status-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
    padding: 0 4px;
    font-size: 11px;
    color: var(--text-muted);
    user-select: none;
    animation: fadeIn 0.2s ease;
    cursor: pointer;
}

.message:not(.message-self) .message-status-row {
    justify-content: flex-start;
}

.message-seen-badge {
    display: inline-flex;
    align-items: center;
    gap: 3.5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.03);
}

.message-seen-badge:hover {
    background: rgba(255, 78, 39, 0.1);
    color: var(--primary);
}

.message-seen-badge.sending {
    color: var(--text-muted);
    font-style: italic;
}

.sending-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--text-muted);
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.message-seen-badge.sent {
    color: var(--text-secondary);
}

.message-seen-badge.delivered {
    color: #0084FF;
    font-weight: 500;
}

.message-seen-badge.delivered svg {
    color: #0084FF;
}

.message-seen-badge.seen {
    color: var(--primary);
    font-weight: 600;
    background: rgba(255, 78, 39, 0.08);
}

.message-seen-badge.seen svg {
    color: var(--primary);
}

.seen-avatars-group {
    display: inline-flex;
    align-items: center;
    flex-direction: row-reverse;
    margin-top: 3px;
    padding: 0 2px;
    animation: scaleUp 0.2s ease;
}

.seen-mini-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #FFFFFF;
    margin-left: -5px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease;
    background-color: var(--bg-surface);
    cursor: pointer;
}

.seen-mini-avatar:hover {
    transform: scale(1.35);
    z-index: 10;
}

.seen-summary-text {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-right: 4px;
    font-weight: 500;
}

/* Sending State on Input Button */
.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ==========================================================================
   SEEN LIST MODAL (AI ĐÃ XEM - CLASSIC TRANSLUCENT GLASS)
   ========================================================================== */

.seen-list-modal {
    max-width: 440px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
}

.seen-list-modal .admin-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.seen-list-body {
    padding: 12px 18px 18px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
}

.seen-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seen-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.6);
    
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.seen-user-item:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.seen-user-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.seen-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.seen-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

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

.seen-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.seen-user-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.seen-user-tag.seen {
    background: rgba(255, 78, 39, 0.12);
    color: var(--primary);
}

.seen-user-tag.unseen {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
}

.seen-empty-state {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* ==========================================================================
   MOBILE AUTH OPTIMIZATION (Đã hợp nhất vào khối High-Tech Auth ở đầu file)
   ========================================================================== */

/* ==========================================================================
   PROFILE TABS & VIP QR CODE CARD (Xuất mã QR cá nhân độc quyền)
   ========================================================================== */
.profile-tabs-header {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 5px;
    border-radius: 16px;
    margin: 0 16px 14px;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.profile-tab-btn {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.profile-tab-btn.active {
    background: #FFFFFF;
    color: #E63800;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.my-qr-vip-card {
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF5EE 100%);
    border: 2px solid #FFE0D0;
    border-radius: 24px;
    padding: 24px 18px;
    box-shadow: 0 10px 30px rgba(255, 78, 39, 0.12);
    text-align: center;
}

.my-qr-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1.5px dashed #FFD8C2;
}

.my-qr-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid #FF5722;
    box-shadow: 0 4px 12px rgba(255, 78, 39, 0.25);
}

.my-qr-card-user-info h3 {
    font-size: 17px;
    font-weight: 800;
    color: #2D3142;
    margin-bottom: 2px;
}

.my-qr-card-user-info p {
    font-size: 13px;
    font-weight: 700;
    color: #FF5722;
}

.my-qr-code-frame {
    display: inline-block;
    background: #FFFFFF;
    padding: 16px;
    border-radius: 20px;
    border: 2px solid #FFA834;
    box-shadow: 0 8px 20px rgba(255, 168, 52, 0.2);
    margin-bottom: 14px;
}

#profile-my-qrcode img, #profile-my-qrcode canvas {
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.my-qr-card-caption {
    font-size: 12.5px;
    color: #7A5038;
    font-weight: 600;
    margin-bottom: 18px;
    line-height: 1.4;
}

.my-qr-card-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   FRIENDS & QR MODAL (Quản lý bạn bè & Quét QR 3D Game UI)
   ========================================================================== */
.friends-modal {
    max-width: 520px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.friends-tabs {
    display: flex;
    background: #F3EAE2;
    padding: 6px;
    gap: 6px;
    border-bottom: 1px solid #E5D5C8;
    overflow-x: auto;
}

.friends-tab-btn {
    flex: 1;
    white-space: nowrap;
    padding: 9px 12px;
    border: none;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    color: #8C6A54;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.friends-tab-btn.active {
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF5ED 100%);
    color: #E63800;
    border: 1px solid #FFD6C2;
    box-shadow: 0 3px 0 #D49D7E, 0 4px 10px rgba(0, 0, 0, 0.06);
    font-weight: 800;
}

.friends-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}

/* Search Form */
.friends-search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.friends-search-form .input-icon-wrapper {
    flex: 1;
}

.friends-search-form input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border-radius: 16px;
    border: 2px solid #E5D0C2;
    background: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
}

/* Friend Result Card */
.friend-search-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 20px;
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF8F3 100%);
    border: 2px solid #FFE4D6;
    box-shadow: 0 6px 16px rgba(255, 78, 39, 0.08);
}

.friend-card-avatar-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.friend-card-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FF5722;
}

.friend-card-info {
    flex: 1;
    min-width: 0;
}

.friend-card-info h4 {
    font-size: 15.5px;
    font-weight: 800;
    color: #2D3142;
    margin-bottom: 2px;
}

.friend-card-phone {
    font-size: 12.5px;
    color: #8C6A54;
    font-weight: 600;
}

.friend-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Badges & Game Buttons */
.badge-self {
    display: inline-block;
    padding: 6px 12px;
    background: #EFEFEF;
    color: #777777;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.badge-friend-status {
    display: inline-block;
    padding: 6px 10px;
    background: #E8F5E9;
    color: #2E7D32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid #C8E6C9;
}

.badge-pending {
    display: inline-block;
    padding: 6px 12px;
    background: #FFF3E0;
    color: #E65100;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid #FFE0B2;
}

.btn-game-sm {
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 800;
    border: 1.5px solid #FFD0B8;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
    user-select: none;
}

.btn-game-sm.btn-add-friend {
    background: linear-gradient(180deg, #FFA033 0%, #FF5A1F 100%);
    color: #FFFFFF;
    border-color: #FFE0A0;
    box-shadow: 0 4px 0 #941B00, 0 6px 12px rgba(255, 78, 39, 0.35);
}

.btn-game-sm.btn-add-friend:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #941B00, 0 8px 16px rgba(255, 78, 39, 0.45);
}

.btn-game-sm.btn-add-friend:active {
    transform: translateY(2px) scale(0.96);
    box-shadow: 0 1px 0 #941B00;
}

.btn-game-sm.btn-accept {
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
    color: #FFFFFF;
    border-color: #A5D6A7;
    box-shadow: 0 3px 0 #1B5E20;
}

.btn-game-sm.btn-decline {
    background: #F5F5F5;
    color: #666666;
    border-color: #DDDDDD;
    box-shadow: 0 3px 0 #CCCCCC;
}

.btn-game-sm.btn-chat {
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF2E8 100%);
    color: #D35400;
    border-color: #FFCCA8;
    box-shadow: 0 3px 0 #E5A882;
}

/* QR Camera Scanner Viewport */
.qr-scanner-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0;
}

.camera-viewport-frame {
    position: relative;
    width: 240px;
    height: 240px;
    border-radius: 24px;
    overflow: hidden;
    background: #111111;
    border: 3px solid #FF5722;
    box-shadow: 0 8px 24px rgba(255, 78, 39, 0.3);
    margin-bottom: 12px;
}

#friends-camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.laser-scanner-beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FF3D00, #FFE600, #FF3D00, transparent);
    box-shadow: 0 0 12px #FF5722;
    animation: laserScan 2s infinite alternate ease-in-out;
}

@keyframes laserScan {
    0% { top: 8%; opacity: 0.8; }
    100% { top: 92%; opacity: 0.8; }
}

.camera-status-text {
    font-size: 13px;
    font-weight: 700;
    color: #FF5722;
    margin-bottom: 14px;
}

.qr-scanner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Friend Requests & Directory Grid */
.requests-grid, .friends-directory-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.friend-request-card, .friend-directory-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #FFFFFF;
    border: 1.5px solid #FFE4D6;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.req-avatar-wrap, .dir-avatar-wrap {
    position: relative;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
}

.req-avatar-wrap img, .dir-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.req-info, .dir-info {
    flex: 1;
    min-width: 0;
}

.req-info h4, .dir-info h4 {
    font-size: 14.5px;
    font-weight: 800;
    color: #2D3142;
    margin-bottom: 2px;
}

.req-info p, .dir-info p {
    font-size: 12px;
    color: #8C6A54;
    font-weight: 600;
}

.req-time {
    font-size: 10.5px;
    color: #A08070;
}

.req-actions, .dir-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-icon-danger {
    background: #FFEBEE;
    border: 1px solid #FFCDD2;
    color: #D32F2F;
    border-radius: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn-icon-danger:hover {
    background: #D32F2F;
    color: #FFFFFF;
}

.friends-empty-result {
    text-align: center;
    padding: 30px 15px;
    color: #8C6A54;
}

.friends-empty-result .empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.friends-empty-result h4 {
    font-size: 16px;
    font-weight: 800;
    color: #2D3142;
    margin-bottom: 6px;
}

.friends-empty-result p {
    font-size: 13px;
    line-height: 1.5;
}

.friends-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px;
    color: #FF5722;
    font-weight: 700;
    font-size: 13.5px;
}

/* ==========================================================================
   NOTIFICATION CENTER MODAL (iOS Classic Translucent Glass)
   ========================================================================== */

.notifications-modal {
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
}

.notif-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

.notif-tab-btn {
    padding: 7px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
}

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

.notif-tab-btn.active {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--primary) !important;
    border-color: rgba(255, 78, 39, 0.3) !important;
    box-shadow: 0 4px 12px rgba(255, 78, 39, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    font-weight: 700;
}

.notifications-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    min-height: 250px;
    max-height: 60vh;
}

.notif-items-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.65);
    
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03), inset 0 1px 1px rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    position: relative;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 78, 39, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.notif-item:active {
    transform: scale(0.98);
}

.notif-item.is-unread {
    border-left: 4px solid var(--primary) !important;
    background: rgba(255, 255, 255, 0.85) !important;
}

.notif-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.notif-avatar-wrap img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.notif-type-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 13px;
    background: #FFFFFF;
    border-radius: 50%;
    padding: 1px 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.notif-content-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.notif-item-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    background: #FF3B30;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px rgba(255, 59, 48, 0.6);
    flex-shrink: 0;
}

.notif-dismiss-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0.7;
    flex-shrink: 0;
    margin-left: 4px;
}

.notif-item:hover .notif-dismiss-btn {
    opacity: 1;
}

.notif-dismiss-btn:hover {
    background: rgba(255, 59, 48, 0.15);
    color: #FF3B30;
    transform: scale(1.1);
}

.notif-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.notif-title-row h4 {
    font-size: 14.5px;
    font-weight: 800;
    color: #2D3142;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-count-pill {
    background: #FF3B30;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(255, 59, 48, 0.4);
}

.notif-preview-text {
    font-size: 13px;
    color: #6C584C;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.notif-time {
    font-size: 11px;
    color: #A08070;
    font-weight: 600;
}

.notif-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #8C6A54;
}

.notif-empty-state .empty-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.notif-empty-state h4 {
    font-size: 17px;
    font-weight: 800;
    color: #2D3142;
    margin-bottom: 6px;
}

.notif-empty-state p {
    font-size: 13.5px;
    line-height: 1.5;
}

/* =====================================================
   DARK MODE (data-theme="dark")
   ===================================================== */
[data-theme="dark"] {
    --bg-color: #0d1117;
    --bg-surface: #161b22;
    --bg-input: #1c2128;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-color: #e6edf3;
    --border: #30363d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
}

[data-theme="dark"] body { background: #0d1117; color: #e6edf3; }
[data-theme="dark"] .sidebar { background: #161b22; border-color: #30363d; }
[data-theme="dark"] .app-header { background: rgba(22,27,34,0.92); border-color: #30363d; }
[data-theme="dark"] .input-bar-container { background: rgba(22,27,34,0.95); border-color: #30363d; }
[data-theme="dark"] .input-bar { background: #1c2128; border-color: #30363d; }
[data-theme="dark"] #message-input { background: transparent; color: #e6edf3; }
[data-theme="dark"] .message-bubble { background: #1c2128; color: #e6edf3; border-color: #30363d; }
[data-theme="dark"] .message-group.own .message-bubble { background: var(--primary); color: #fff; }
[data-theme="dark"] .modal { background: #161b22; color: #e6edf3; border-color: #30363d; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .admin-header { border-color: #30363d; }
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select { background: #1c2128; color: #e6edf3; border-color: #30363d; }
[data-theme="dark"] .channel-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .channel-item.active { background: rgba(255,119,0,0.12); }
[data-theme="dark"] .sidebar-user { background: #161b22; border-color: #30363d; }
[data-theme="dark"] .context-menu { background: #1c2128; border-color: #30363d; }
[data-theme="dark"] .context-menu .menu-item:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .btn-ghost,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-text-link {
    background: rgba(255, 255, 255, 0.12) !important;
    
    color: #F2F2F7 !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-text-link:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: var(--primary) !important;
    border-color: rgba(255, 119, 0, 0.4) !important;
}
[data-theme="dark"] .btn-icon {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: var(--primary) !important;
}
[data-theme="dark"] .btn-icon:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: rgba(255, 119, 0, 0.5) !important;
}
[data-theme="dark"] .mobile-bottom-nav { background: linear-gradient(135deg, rgba(255, 119, 0, 0.28) 0%, rgba(20, 24, 33, 0.72) 100%) !important; border: 1.2px solid rgba(255, 140, 50, 0.35) !important; box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 119, 0, 0.16), inset 0 1px 1.5px rgba(255, 200, 150, 0.3) !important; }
[data-theme="dark"] .mobile-bottom-nav .nav-item { color: #FFFFFF !important; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .mobile-bottom-nav .nav-item.active { background: linear-gradient(135deg, rgba(255, 119, 0, 0.55), rgba(255, 78, 39, 0.38)) !important; color: #FFFFFF !important; box-shadow: 0 4px 14px rgba(255, 119, 0, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.4) !important; }
[data-theme="dark"] .sidebar-header { border-color: #30363d; }
[data-theme="dark"] .sidebar-search input { background: #1c2128; color: #e6edf3; border-color: #30363d; }
[data-theme="dark"] .reply-preview { background: #1c2128; border-color: #30363d; }
[data-theme="dark"] #create-menu { background: rgba(22,27,34,0.96) !important; border-color: #30363d !important; }
[data-theme="dark"] .menu-item:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .chat-settings-body { color: #e6edf3; }
[data-theme="dark"] .settings-section { border-color: #30363d; }
[data-theme="dark"] .settings-row { border-color: #30363d; }
[data-theme="dark"] .wallpaper-item { border-color: #30363d; }
[data-theme="dark"] .upload-preview { background: #161b22; border-color: #30363d; }
[data-theme="dark"] .home-area { background: #0d1117; }
[data-theme="dark"] .home-content h1 { color: #e6edf3; }
[data-theme="dark"] .home-content p { color: #8b949e; }
[data-theme="dark"] .seen-list-modal,
[data-theme="dark"] .notifications-modal,
[data-theme="dark"] .chat-settings-modal { background: #161b22; }

/* Dark Mode Toggle Button */
.btn-dark-mode {
    position: fixed;
    bottom: 90px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    z-index: 90;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.btn-dark-mode:hover { transform: scale(1.1); box-shadow: var(--shadow-lg); }

@media (max-width: 768px) {
    .btn-dark-mode { bottom: 80px; right: 12px; width: 36px; height: 36px; }
}

/* =====================================================
   VOICE RECORDER UI
   ===================================================== */
.voice-recording-ui {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-surface, #fff);
    border-top: 1px solid var(--border);
}

.voice-recording-indicator {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

/* Live Voice Waveform when recording */
.voice-live-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    padding: 0 6px;
}

.live-wave-bar {
    width: 3px;
    height: 6px;
    background: #ef4444;
    border-radius: 2px;
    animation: liveWave 0.7s ease-in-out infinite alternate;
}

.live-wave-bar:nth-child(1) { animation-delay: 0.0s; height: 6px; }
.live-wave-bar:nth-child(2) { animation-delay: 0.15s; height: 14px; }
.live-wave-bar:nth-child(3) { animation-delay: 0.3s; height: 20px; }
.live-wave-bar:nth-child(4) { animation-delay: 0.45s; height: 10px; }
.live-wave-bar:nth-child(5) { animation-delay: 0.2s; height: 18px; }
.live-wave-bar:nth-child(6) { animation-delay: 0.5s; height: 22px; }
.live-wave-bar:nth-child(7) { animation-delay: 0.35s; height: 12px; }
.live-wave-bar:nth-child(8) { animation-delay: 0.1s; height: 8px; }

@keyframes liveWave {
    0% { transform: scaleY(0.4); opacity: 0.5; }
    100% { transform: scaleY(1.4); opacity: 1; }
}

.voice-timer {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.voice-cancel { color: var(--text-muted) !important; }
.voice-send { background: var(--primary) !important; color: #fff !important; border: none !important; }

/* Voice Note Player in Chat with Sound Waveform */
.voice-note-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    min-width: 180px;
    max-width: 260px;
    width: fit-content;
    user-select: none;
    background-color: var(--bg-bubble-received, #FFFFFF);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    overflow: hidden;
}

[data-theme="dark"] .message:not(.message-self) .voice-note-player {
    background-color: #21262d !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Voice Note Player Bubble - Sent / Self (Người gửi) - CAM ĐỎ GRADIENT */
.message.message-self .voice-note-player {
    background: var(--primary-gradient, linear-gradient(135deg, #FF7700 0%, #FF4D00 100%)) !important;
    border-radius: 18px 18px 4px 18px !important;
    box-shadow: 0 4px 14px rgba(255, 119, 0, 0.35) !important;
    border: none !important;
}

.voice-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary, #FF7700);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, background-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.voice-play-btn:hover { transform: scale(1.08); box-shadow: 0 4px 10px rgba(0,0,0,0.18); }
.voice-play-btn:active { transform: scale(0.95); }

/* Play button for sender: WHITE circle with orange icon */
.message.message-self .voice-play-btn,
.message-group.own .voice-play-btn {
    background: #ffffff !important;
    color: var(--primary, #FF7700) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Sound Waveform Visualization */
.voice-waveform-wrap {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 26px;
    width: 100%;
    justify-content: space-between;
    overflow: hidden;
}

.waveform-bar {
    flex: 1;
    min-width: 2px;
    max-width: 3.5px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.18);
    transition: background 0.12s ease, transform 0.12s ease;
    transform-origin: center;
}

[data-theme="dark"] .message:not(.message-self) .waveform-bar {
    background: rgba(255, 255, 255, 0.22);
}

.waveform-bar.active {
    background: var(--primary, #FF7700);
}

.waveform-bar.current {
    transform: scaleY(1.3);
    background: var(--primary, #FF7700);
}

.voice-note-player.playing .waveform-bar.current {
    animation: waveBarBounce 0.4s ease-in-out infinite alternate;
}

@keyframes waveBarBounce {
    0% { transform: scaleY(1.0); }
    100% { transform: scaleY(1.4); }
}

/* Message Self / Own waveform styling */
.message.message-self .waveform-bar,
.message-group.own .waveform-bar {
    background: rgba(255, 255, 255, 0.45) !important;
}

.message.message-self .waveform-bar.active,
.message.message-self .waveform-bar.current,
.message-group.own .waveform-bar.active,
.message-group.own .waveform-bar.current {
    background: #ffffff !important;
}

.message.message-self .voice-time,
.message-group.own .voice-time {
    color: #ffffff !important;
}

.voice-time {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    letter-spacing: 0.1px;
}

/* =====================================================
   PINNED MESSAGE BANNER
   ===================================================== */
.pinned-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg-surface, #fff);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.pinned-banner:hover { background: rgba(255,119,0,0.04); }

.pinned-banner-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.pinned-banner-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pinned-banner-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pinned-banner-text {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Highlight message when jumped from pinned banner */
.message.highlight-pinned .message-bubble {
    animation: highlightPinnedPulse 2.2s ease-out;
}

@keyframes highlightPinnedPulse {
    0% {
        box-shadow: 0 0 0 4px rgba(255, 119, 0, 0.5);
        transform: scale(1.02);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 119, 0, 0.2);
    }
    100% {
        box-shadow: none;
        transform: scale(1);
    }
}

/* =====================================================
   POLL CARDS IN CHAT
   ===================================================== */
/* =====================================================
   POLL CARDS (CHAT & NEWS FEED)
   ===================================================== */
.poll-card {
    padding: 14px 16px;
    min-width: 240px;
    max-width: 320px;
    background: var(--bg-surface, #FFFFFF);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Full width in Newsfeed */
.news-post-poll-container .poll-card {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    background: var(--bg-surface-elevated, #F9FAFB);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
    padding: 16px 18px;
    margin-top: 6px;
}

[data-theme="dark"] .poll-card {
    background: #1c2128 !important;
    border-color: #30363d !important;
}

[data-theme="dark"] .news-post-poll-container .poll-card {
    background: #161b22 !important;
    border-color: #30363d !important;
}

.poll-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.poll-question-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.45;
    word-break: break-word;
}

.poll-badge {
    display: inline-block;
    font-size: 11px;
    color: var(--primary);
    background: rgba(255, 119, 0, 0.1);
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 10px;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-option {
    position: relative;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border, rgba(0, 0, 0, 0.1));
    background: var(--bg-surface, #FFFFFF);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.poll-option:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 119, 0, 0.12);
}

.poll-option:active {
    transform: scale(0.99);
}

.poll-option.voted {
    border-color: var(--primary) !important;
    background: rgba(255, 119, 0, 0.04) !important;
    font-weight: 600;
}

[data-theme="dark"] .poll-option {
    background: #1c2128;
    border-color: #30363d;
}

[data-theme="dark"] .poll-option.voted {
    background: rgba(255, 119, 0, 0.12) !important;
    border-color: var(--primary) !important;
}

.poll-option-fill,
.poll-option-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 119, 0, 0.12) 0%, rgba(255, 61, 0, 0.18) 100%);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 10px;
    pointer-events: none;
}

.poll-option-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.poll-option-text {
    position: relative;
    z-index: 1;
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
}

.poll-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #FFFFFF;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

[data-theme="dark"] .poll-checkbox {
    border-color: rgba(255, 255, 255, 0.25);
}

.poll-option.voted .poll-checkbox {
    background: var(--primary, #FF7700);
    border-color: var(--primary, #FF7700);
    box-shadow: 0 2px 6px rgba(255, 119, 0, 0.4);
}

.poll-option-stats {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-shrink: 0;
}

.poll-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poll-badge-anon {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

[data-theme="dark"] .poll-badge-anon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

/* Poll Create Modal */
.poll-create-modal,
.poll-modal { 
    max-width: 480px; 
    border-radius: 20px;
}

.poll-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.poll-option-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border, rgba(0, 0, 0, 0.12));
    border-radius: 12px;
    font-size: 14.5px;
    background: var(--bg-input, #FFFFFF);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.poll-option-input:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(255, 119, 0, 0.15);
    outline: none; 
}

.poll-option-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.poll-option-remove:hover { 
    background: rgba(239, 68, 68, 0.12); 
    color: #ef4444; 
    transform: scale(1.1);
}

/* News Create Poll Modal & Form Styling */
#news-create-poll-overlay .poll-modal {
    background: var(--bg-surface, #FFFFFF);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
    overflow: hidden;
}

[data-theme="dark"] #news-create-poll-overlay .poll-modal {
    background: #1c2128;
    border-color: #30363d;
}

#news-create-poll-overlay .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#news-create-poll-overlay .modal-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

#news-create-poll-overlay .form-group label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-normal, #333);
    margin-bottom: 6px;
    display: block;
}

#news-create-poll-overlay .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-light, rgba(0, 0, 0, 0.12));
    border-radius: 12px;
    font-size: 14.5px;
    color: var(--text-normal, #111);
    background: var(--bg-surface-elevated, #FAFAFA);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

#news-create-poll-overlay .form-control:focus {
    border-color: var(--primary, #FF7700);
    background: #FFF;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 119, 0, 0.15);
}

[data-theme="dark"] #news-create-poll-overlay .form-control {
    background: #161b22;
    border-color: #30363d;
    color: #e6edf3;
}

[data-theme="dark"] #news-create-poll-overlay .form-control:focus {
    border-color: var(--primary, #FF7700);
    background: #0d1117;
}

#news-create-poll-overlay .poll-settings {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 14px;
    margin-bottom: 18px;
}

[data-theme="dark"] #news-create-poll-overlay .poll-settings {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

#news-create-poll-overlay .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-normal, #333);
    user-select: none;
}

#news-create-poll-overlay .checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary, #FF7700);
    cursor: pointer;
}

#news-create-poll-overlay #btn-add-news-poll-option {
    border-style: dashed;
    border-width: 1.5px;
    border-color: var(--primary, #FF7700);
    color: var(--primary, #FF7700);
    background: rgba(255, 119, 0, 0.04);
    font-weight: 600;
    transition: all 0.2s ease;
    border-radius: 12px;
}

#news-create-poll-overlay #btn-add-news-poll-option:hover {
    background: rgba(255, 119, 0, 0.12);
    transform: translateY(-1px);
}

/* =====================================================
   CALL OVERLAY
   ===================================================== */
.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 480px;
    padding: 40px 20px;
}

.call-peer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.call-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.2);
    object-fit: cover;
    animation: callPulse 2s ease-in-out infinite;
}

@keyframes callPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.2); }
    50% { box-shadow: 0 0 0 15px rgba(255,255,255,0); }
}

.call-content h3 {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}

.call-status {
    color: rgba(255,255,255,0.6);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.call-video-area {
    position: relative;
    width: 100%;
    max-width: 480px;
}

#call-remote-video {
    width: 100%;
    border-radius: 16px;
    background: #000;
    display: none;
}

.call-overlay[data-type="video"] #call-remote-video { display: block; }

.call-local-pip {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 120px;
    height: 90px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    object-fit: cover;
    display: none;
}

.call-overlay[data-type="video"] .call-local-pip { display: block; }

.call-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.15s, box-shadow 0.15s;
}
.call-btn:hover { transform: scale(1.1); }

.call-btn-accept { background: #22c55e; box-shadow: 0 4px 15px rgba(34,197,94,0.4); }
.call-btn-reject { background: #ef4444; box-shadow: 0 4px 15px rgba(239,68,68,0.4); }
.call-btn-control {
    background: rgba(255,255,255,0.15);
    width: 48px;
    height: 48px;
}
.call-btn-control.active { background: #ef4444; }

/* =====================================================
   LOCATION MESSAGE
   ===================================================== */
.location-message {
    padding: 6px;
    cursor: pointer;
    min-width: 240px;
    max-width: 280px;
    border-radius: 14px;
}

.location-message-map {
    width: 100%;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    background: #e5e3df;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.location-message-map iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    pointer-events: none;
}

.location-message-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
    gap: 8px;
}

.location-message-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-message-coords {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.location-message-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(255, 119, 0, 0.12);
    color: var(--primary);
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 600;
    margin-top: 6px;
    width: 100%;
    text-align: center;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.location-message:hover .location-message-btn {
    background: var(--primary);
    color: #FFFFFF;
}

/* =====================================================
   DISAPPEARING MESSAGE INDICATOR
   ===================================================== */
.msg-disappearing-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}

.msg-disappearing-badge svg {
    opacity: 0.5;
}

/* =====================================================
   MESSAGE PIN BADGE
   ===================================================== */
.msg-pin-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS FOR NEW FEATURES
   ===================================================== */
@media (max-width: 768px) {
    .message .poll-card { min-width: 200px; max-width: 280px; }
    .news-post-poll-container .poll-card { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
    .voice-note-player { min-width: 170px; max-width: 240px; padding: 6px 10px; }
    .call-avatar { width: 80px; height: 80px; }
    .call-content h3 { font-size: 18px; }
    .call-btn { width: 50px; height: 50px; }
    .call-btn-control { width: 42px; height: 42px; }
    /* Hide some less important input buttons on mobile */
    #btn-create-poll,
    #btn-share-location { display: none; }
}

/* =====================================================
   DISAPPEARING MESSAGES UI STYLES
   ===================================================== */
.disappearing-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 119, 0, 0.08);
    border: 1px solid rgba(255, 119, 0, 0.22);
    border-radius: 20px;
    margin: 4px 16px;
    font-size: 12.5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    width: fit-content;
}

.disappearing-pill:hover {
    background: rgba(255, 119, 0, 0.15);
    border-color: rgba(255, 119, 0, 0.4);
}

.disappearing-pill strong {
    color: var(--primary);
}

.disappearing-pill-edit {
    font-size: 11px;
    background: var(--primary);
    color: #fff;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.disappearing-timer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.btn-timer-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.btn-timer-opt svg {
    color: var(--primary) !important;
    flex-shrink: 0;
}

.btn-timer-opt:hover {
    border-color: rgba(255, 119, 0, 0.4) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-1px);
}

.btn-timer-opt:active {
    transform: scale(0.96);
}

.btn-timer-opt.active {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.92) 0%, rgba(255, 80, 0, 0.84) 100%) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 4px 14px rgba(255, 119, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.6) !important;
}

.btn-timer-opt.active svg {
    color: #FFFFFF !important;
}

[data-theme="dark"] .btn-timer-opt {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #F2F2F7;
}

[data-theme="dark"] .btn-timer-opt.active {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.92) 0%, rgba(255, 80, 0, 0.84) 100%) !important;
    color: #FFFFFF !important;
}

[data-theme="dark"] .btn-timer-opt.active svg {
    color: #FFFFFF !important;
}

/* === Group Management & Creator Badges === */
.badge-creator {
    background: linear-gradient(135deg, #FFB800, #FF7700);
    color: #FFFFFF !important;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(255, 119, 0, 0.35);
    letter-spacing: 0.2px;
    flex-shrink: 0;
}

.badge-admin {
    background: rgba(88, 101, 242, 0.12);
    color: #5865F2;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.member-item-creator {
    background: rgba(255, 119, 0, 0.04);
    border-radius: 10px;
}

.member-actions-bar {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    margin-bottom: 8px;
}

.btn-member-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.1));
    background: #FFFFFF;
    color: var(--text-normal, #1C1E21);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-member-action:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(255, 119, 0, 0.05);
    transform: translateY(-1px);
}

.btn-member-action.danger:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #EF4444;
    color: #EF4444;
}

.add-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.add-member-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* System Message Pill */
.message-system-pill {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px auto;
    width: 100%;
    text-align: center;
}

.message-system-pill span {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted, #65676B);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 14px;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    line-height: 1.4;
    max-width: 85%;
}

/* === Modern Member Selection Component === */
.member-select-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
    user-select: none;
    border: 1.5px solid transparent;
    background: transparent;
}

.member-select-card:hover {
    background: rgba(0, 0, 0, 0.03);
    transform: translateY(-1px);
}

.member-select-card.is-selected {
    background: rgba(255, 119, 0, 0.08);
    border-color: rgba(255, 119, 0, 0.28);
}

.member-checkbox-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-light, rgba(0, 0, 0, 0.18));
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
    color: transparent;
}

.member-select-card.is-selected .member-checkbox-circle {
    background: var(--primary, #FF7700);
    border-color: var(--primary, #FF7700);
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(255, 119, 0, 0.4);
}

.member-select-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.member-select-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
}

.member-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #10B981;
    border: 2px solid #FFFFFF;
}

.member-online-dot.offline {
    background: #9CA3AF;
}

.selected-members-bar {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--border-light, rgba(0, 0, 0, 0.12));
}

.selected-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 5px;
    background: #FFFFFF;
    color: var(--text-normal, #1C1E21);
    border: 1px solid rgba(255, 119, 0, 0.25);
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.selected-chip:hover {
    background: rgba(255, 119, 0, 0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.selected-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.selected-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 2px;
    transition: background 0.15s ease;
}

.selected-chip:hover .selected-chip-remove {
    background: var(--danger, #EF4444);
    color: #FFFFFF;
}

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

/* ==========================================================================
   Newsfeed & Bảng Tin Styles
   ========================================================================== */
.news-modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    animation: modalSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-create-card textarea:focus {
    color: var(--text-normal);
}

.news-post-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-post-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.btn-news-action:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-news-action.liked svg {
    animation: heartBounce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.news-comment-bubble {
    transition: background 0.15s ease;
}

.news-comment-item:hover .news-comment-bubble {
    background: rgba(0, 0, 0, 0.07);
}

.btn-sticker-opt:hover {
    transform: scale(1.12);
    background: rgba(255, 119, 0, 0.12) !important;
    border-color: var(--primary) !important;
}

.btn-sticker-opt:active {
    transform: scale(0.95);
}

.news-comment-sticker-drawer {
    animation: popIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-comment-sticker:hover {
    transform: scale(1.15);
}

.news-replying-badge {
    animation: fadeIn 0.15s ease;
}

/* News Comment Action Buttons (Đồng bộ nút Trả lời & Xóa) */
.news-comment-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 6px;
    margin-top: 3px;
}

.news-comment-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1.2;
}

.news-comment-reply-btn {
    color: var(--primary, #FF7700);
}

.news-comment-reply-btn:hover {
    background: rgba(255, 119, 0, 0.1);
}

.news-comment-reply-btn:active {
    transform: scale(0.95);
}

.news-comment-delete-btn {
    color: var(--danger, #EF4444);
}

.news-comment-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.news-comment-delete-btn:active {
    transform: scale(0.95);
}

.news-post-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.news-post-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger, #EF4444);
}

@media (max-width: 600px) {
    #news-create-poll-overlay.modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    #news-create-poll-overlay .poll-modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        animation: modalSlideUpMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
}

/* ==========================================================================
   DESKTOP UI & MULTI-COLUMN ARCHITECTURE (Máy tính & Laptop)
   ========================================================================== */

/* 1. Desktop Left Activity Rail */
.desktop-nav-rail {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 72px;
    height: 100%;
    height: 100dvh;
    background: var(--bg-surface, #FFFFFF);
    border-right: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    z-index: 30;
    flex-shrink: 0;
    align-items: center;
    padding: 16px 0 16px;
    user-select: none;
    transition: background-color 0.25s ease, border-color 0.25s ease;
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.02);
}

.rail-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.rail-brand-logo {
    width: 44px;
    height: 44px;
    position: relative;
    margin-bottom: 22px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rail-brand-logo:hover {
    transform: scale(1.08);
}

.rail-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(255, 119, 0, 0.25);
}

.rail-brand-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--bg-surface, #FFFFFF);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.rail-nav-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 52px;
    border-radius: 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748B);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    outline: none;
}

.rail-item:hover {
    background: rgba(255, 119, 0, 0.08);
    color: var(--primary, #FF7700);
    transform: translateY(-1px);
}

.rail-item.active {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.15), rgba(255, 61, 0, 0.12)) !important;
    color: var(--primary, #FF7700) !important;
    font-weight: 700;
    box-shadow: inset 0 0 0 1.5px rgba(255, 119, 0, 0.35);
}

.rail-item-label {
    font-size: 10.5px;
    font-weight: 600;
    margin-top: 3px;
    letter-spacing: -0.2px;
    line-height: 1;
}

.rail-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    background: var(--primary-gradient, linear-gradient(135deg, #FF7700, #FF3D00));
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 5px;
    min-width: 17px;
    height: 17px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 119, 0, 0.4);
    animation: popIn 0.2s ease;
}

.rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.rail-btn-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    background: var(--bg-surface, #FFFFFF);
    color: var(--text-secondary, #64748B);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.rail-btn-action:hover {
    background: rgba(255, 119, 0, 0.08);
    color: var(--primary, #FF7700);
    transform: scale(1.08);
    border-color: var(--primary, #FF7700);
}

.rail-user-avatar-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rail-user-avatar-wrap:hover {
    transform: scale(1.08);
}

.rail-user-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary, #FF7700);
    box-shadow: 0 2px 10px rgba(255, 119, 0, 0.28);
}

.rail-user-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--bg-surface, #FFFFFF);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* Sidebar Desktop Header & Heading */
.sidebar-desktop-heading {
    font-size: 20px !important;
    font-weight: 800 !important;
    letter-spacing: -0.4px !important;
    color: var(--text-primary, #1E293B) !important;
    margin: 0 !important;
}

.create-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    min-width: 220px;
    padding: 6px;
    animation: scaleUp 0.18s ease;
}

/* 2. Sidebar Filter Tabs (Segmented Tabs) */
.sidebar-filter-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-surface, #FFFFFF);
    border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    flex-shrink: 0;
}

.filter-tab-btn {
    flex: 1;
    padding: 7px 4px;
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #64748B);
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.filter-tab-btn:hover {
    background: rgba(255, 119, 0, 0.08);
    color: var(--primary, #FF7700);
}

.filter-tab-btn.active {
    background: var(--primary, #FF7700) !important;
    color: #FFFFFF !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 119, 0, 0.3);
}

/* 3. Desktop Header Direct Actions Toolbar */
.desktop-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.desktop-header-actions .btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--text-secondary, #64748B);
    transition: all 0.18s ease;
}

.desktop-header-actions .btn-icon:hover {
    background: rgba(255, 119, 0, 0.08);
    color: var(--primary, #FF7700);
    transform: translateY(-1px);
}

/* 4. Drag & Drop File Upload Overlay */
.drop-zone-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border: 3px dashed var(--primary, #FF7700);
    border-radius: 20px;
    margin: 12px;
    animation: fadeIn 0.2s ease;
}

.drop-zone-content {
    text-align: center;
    color: var(--text-primary, #1E293B);
    padding: 28px;
}

.drop-zone-icon-wrap {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(255, 119, 0, 0.12);
    color: var(--primary, #FF7700);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: bounce 1.4s infinite;
}

.drop-zone-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.drop-zone-content p {
    font-size: 14px;
    color: var(--text-secondary, #64748B);
    max-width: 360px;
    margin: 0 auto;
}

/* 5. Desktop Home Dashboard & Shortcuts Guide */
.desktop-home-dashboard {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 24px;
    text-align: center;
}

.home-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 119, 0, 0.12);
    color: var(--primary, #FF7700);
    font-size: 12.5px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 119, 0, 0.2);
}

.desktop-home-dashboard h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary, #1E293B);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.desktop-home-dashboard .home-subtitle {
    font-size: 15px;
    color: var(--text-secondary, #64748B);
    max-width: 580px;
    margin: 0 auto 36px;
    line-height: 1.6;
}

.desktop-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 36px;
    text-align: left;
}

.dashboard-action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface, #FFFFFF);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.dashboard-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(255, 119, 0, 0.12);
    border-color: var(--primary, #FF7700);
}

.dashboard-action-card .card-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-action-card .card-icon-wrap.icon-orange {
    background: rgba(255, 119, 0, 0.12);
    color: #FF7700;
}

.dashboard-action-card .card-icon-wrap.icon-blue {
    background: rgba(14, 165, 233, 0.12);
    color: #0EA5E9;
}

.dashboard-action-card .card-icon-wrap.icon-purple {
    background: rgba(168, 85, 247, 0.12);
    color: #A855F7;
}

.dashboard-action-card .card-icon-wrap.icon-green {
    background: rgba(34, 197, 94, 0.12);
    color: #22C55E;
}

.dashboard-action-card .card-text h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #1E293B);
    margin: 0 0 4px;
}

.dashboard-action-card .card-text p {
    font-size: 12.5px;
    color: var(--text-secondary, #64748B);
    margin: 0;
    line-height: 1.4;
}

.desktop-shortcuts-guide {
    background: var(--bg-surface, #FFFFFF);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    border-radius: 16px;
    padding: 20px 24px;
    text-align: left;
}

.shortcuts-guide-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.shortcuts-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.shortcut-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-hover, rgba(0, 0, 0, 0.03));
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 12.5px;
    color: var(--text-secondary, #64748B);
}

.shortcut-pill kbd {
    background: var(--bg-surface, #FFFFFF);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
    border-radius: 6px;
    padding: 2px 7px;
    color: var(--text-primary, #1E293B);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* 6. Responsive Breakpoints Logic (Desktop vs Mobile) */
@media (min-width: 769px) {
    .mobile-only-header,
    .mobile-only,
    .mobile-bottom-nav,
    .btn-mobile-back,
    .hidden-on-desktop,
    #btn-sidebar-toggle,
    #btn-chat-more-menu,
    .sidebar-user {
        display: none !important;
    }

    .desktop-only-header,
    .desktop-only {
        display: flex !important;
    }

    .desktop-nav-rail {
        display: flex !important;
    }

    .sidebar {
        display: flex !important;
        width: 360px;
        flex-shrink: 0;
    }

    .app-main {
        display: flex !important;
        flex: 1;
    }

    .sidebar-header {
        height: 64px !important;
        padding: 0 18px !important;
    }

    .app-header {
        height: 64px !important;
        padding: 0 20px !important;
    }
}

@media (max-width: 768px) {
    .desktop-only-header,
    .desktop-only,
    .desktop-nav-rail,
    .desktop-header-actions {
        display: none !important;
    }

    .mobile-only-header,
    .mobile-only {
        display: flex !important;
    }

    #btn-chat-more-menu {
        display: flex !important;
    }

    .desktop-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* 7. Dark Mode Styling for Desktop Elements */
[data-theme="dark"] .desktop-nav-rail {
    background: #161b22;
    border-color: #30363d;
}

[data-theme="dark"] .rail-brand-dot {
    border-color: #161b22;
}

[data-theme="dark"] .rail-item {
    color: #8b949e;
}

[data-theme="dark"] .rail-item:hover {
    background: rgba(255, 119, 0, 0.15);
    color: #FF7700;
}

[data-theme="dark"] .rail-item.active {
    background: rgba(255, 119, 0, 0.22) !important;
    color: #FF7700 !important;
    box-shadow: inset 0 0 0 1.5px rgba(255, 119, 0, 0.4);
}

[data-theme="dark"] .rail-btn-action {
    background: #21262d;
    border-color: #30363d;
    color: #8b949e;
}

[data-theme="dark"] .rail-btn-action:hover {
    background: #30363d;
    color: #FF7700;
    border-color: #FF7700;
}

[data-theme="dark"] .rail-user-status-dot {
    border-color: #161b22;
}

[data-theme="dark"] .sidebar-filter-tabs {
    background: #161b22;
    border-color: #30363d;
}

[data-theme="dark"] .filter-tab-btn {
    background: #21262d;
    color: #8b949e;
}

[data-theme="dark"] .filter-tab-btn:hover {
    background: #30363d;
    color: #e6edf3;
}

[data-theme="dark"] .filter-tab-btn.active {
    background: #FF7700 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .desktop-header-actions .btn-icon:hover {
    background: #30363d;
    color: #FF7700;
}

[data-theme="dark"] .dashboard-action-card {
    background: #161b22;
    border-color: #30363d;
}

[data-theme="dark"] .dashboard-action-card:hover {
    background: #1c2128;
    border-color: #FF7700;
    box-shadow: 0 12px 30px rgba(255, 119, 0, 0.18);
}

[data-theme="dark"] .dashboard-action-card .card-text h4 {
    color: #e6edf3;
}

[data-theme="dark"] .dashboard-action-card .card-text p {
    color: #8b949e;
}

[data-theme="dark"] .desktop-shortcuts-guide {
    background: rgba(255, 255, 255, 0.02);
    border-color: #30363d;
}

[data-theme="dark"] .shortcuts-guide-title {
    color: #8b949e;
}

[data-theme="dark"] .shortcut-pill {
    background: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

[data-theme="dark"] .shortcut-pill kbd {
    background: #161b22;
    border-color: #484f58;
    color: #f0f6fc;
}

[data-theme="dark"] .drop-zone-overlay {
    background: rgba(22, 27, 34, 0.94);
    border-color: #FF7700;
}

[data-theme="dark"] .drop-zone-content h3 {
    color: #FF7700;
}

[data-theme="dark"] .drop-zone-content p {
    color: #8b949e;
}

/* ==========================================================================
   CHAT CHUNKED UPLOAD PROGRESS CARD (5GB & COMPRESSION ALGORITHM)
   ========================================================================== */
.chat-upload-progress-card {
    background: rgba(255, 119, 0, 0.05);
    border: 1.5px solid rgba(255, 119, 0, 0.22);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px rgba(255, 119, 0, 0.08);
    animation: slideUpFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.upload-progress-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.upload-spinner-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 119, 0, 0.12);
    color: var(--primary, #FF7700);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-spinner-icon .spin-icon {
    animation: spin 1s linear infinite;
}

.upload-filename-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.upload-filename {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-normal, #1F2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.upload-status-sub {
    font-size: 11px;
    color: var(--text-muted, #6B7280);
    font-weight: 500;
}

.upload-progress-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.upload-percent {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--primary, #FF7700);
    letter-spacing: -0.2px;
}

.btn-cancel-upload-card {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6B7280);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
    padding: 0;
}

.btn-cancel-upload-card:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    transform: scale(1.1);
}

.upload-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF7700, #FF3D00);
    border-radius: 10px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px rgba(255, 119, 0, 0.5);
}

.upload-progress-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted, #6B7280);
    font-weight: 500;
}

[data-theme="dark"] .chat-upload-progress-card {
    background: rgba(255, 119, 0, 0.08);
    border-color: rgba(255, 119, 0, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .upload-filename {
    color: #e6edf3;
}

[data-theme="dark"] .upload-status-sub,
[data-theme="dark"] .upload-progress-footer {
    color: #8b949e;
}

[data-theme="dark"] .upload-progress-track {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .btn-cancel-upload-card {
    background: rgba(255, 255, 255, 0.1);
    color: #8b949e;
}

[data-theme="dark"] .btn-cancel-upload-card:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ff7b72;
}

/* ==========================================================================
   CUSTOM VIDEO PLAYER - THEME JUICY ORANGE iOS
   High-end, responsive, frosted glass HTML5 video player
   ========================================================================== */

.custom-video-player {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0d0e12;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    user-select: none;
    touch-action: manipulation;
    max-width: 100%;
    width: 100%;
    contain: paint;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.custom-video-player:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.36);
    border-color: rgba(255, 119, 0, 0.35);
}

/* Message Video Container Fit (Chat & Bubble) */
.message-content .custom-video-player,
.message .custom-video-player,
.message-body .custom-video-player,
.message-attachments-single .custom-video-player,
.message-bubble .custom-video-player {
    max-width: 360px !important;
    max-height: 380px;
    min-height: 140px;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
}

.message-content .custom-video-player.is-portrait,
.message .custom-video-player.is-portrait,
.message-body .custom-video-player.is-portrait,
.message-attachments-single .custom-video-player.is-portrait,
.message-bubble .custom-video-player.is-portrait {
    max-width: 260px !important;
    max-height: 420px;
    aspect-ratio: 9 / 16;
}

.message-content .custom-video-player.is-landscape,
.message .custom-video-player.is-landscape,
.message-body .custom-video-player.is-landscape,
.message-attachments-single .custom-video-player.is-landscape,
.message-bubble .custom-video-player.is-landscape {
    max-width: 380px !important;
    max-height: 250px;
    aspect-ratio: 16 / 9;
}

.news-post-media .custom-video-player {
    max-height: 480px;
    border-radius: 12px;
}

.news-post-media .custom-video-player.is-portrait {
    max-width: 300px;
    margin: 0 auto;
}

.lightbox-media-item.custom-video-player {
    max-width: 92vw;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* Video Surface */
.cvp-video {
    width: 100%;
    height: 100%;
    max-height: inherit;
    display: block;
    object-fit: contain;
    background: #000;
    cursor: pointer;
    border-radius: inherit;
    z-index: 1;
}

/* Poster / Thumbnail Cover (Lazy Load Video) */
.cvp-poster-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    z-index: 2;
    cursor: pointer;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s ease;
    display: block;
}

.cvp-poster-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(15, 17, 23, 0.25);
    color: #FFFFFF;
    border-radius: inherit;
    z-index: 2;
    cursor: pointer;
    transition: opacity 0.35s ease;
}

.cvp-poster-tag {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.custom-video-player.is-playing .cvp-poster-img,
.custom-video-player.is-playing .cvp-poster-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* Top Bar Quick Actions (Phóng to & Tải về) */
.cvp-top-bar {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 6;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-video-player.controls-hidden .cvp-top-bar {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.cvp-top-btn {
    background: rgba(18, 18, 24, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cvp-top-btn:hover {
    background: var(--primary-gradient, linear-gradient(135deg, #FFA000, #FF6600));
    color: #FFFFFF;
    border-color: transparent;
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 4px 14px rgba(255, 119, 0, 0.45);
}

.cvp-top-btn:active {
    transform: translateY(0) scale(0.96);
}

.cvp-top-btn-label {
    line-height: 1;
}

/* Center Big Play Button */
.cvp-big-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--primary-gradient, linear-gradient(135deg, #FFA000 0%, #FF6600 50%, #FF4D00 100%));
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 119, 0, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.28);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    z-index: 4;
    padding-left: 3px; /* visual optical centering for play triangle */
}

.cvp-big-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 6px 26px rgba(255, 119, 0, 0.8), 0 0 0 5px rgba(255, 255, 255, 0.4);
}

.cvp-big-play-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Center Action Flash Animation */
.cvp-action-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
}

.cvp-action-flash.flash-animate {
    animation: cvpFlashScale 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cvpFlashScale {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

/* Loading Buffering Spinner */
.cvp-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 125px;
    padding: 9px 16px;
    border-radius: 24px;
    background: rgba(13, 14, 18, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 119, 0, 0.4);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 119, 0, 0.25);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    pointer-events: none;
    z-index: 10;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.cvp-loading-spinner.hidden {
    display: none !important;
}

.cvp-spin {
    color: var(--primary, #FF7700);
    animation: cvpSpinner 0.85s linear infinite;
    flex-shrink: 0;
}

@keyframes cvpSpinner {
    100% { transform: rotate(360deg); }
}

/* Seek Ripples (+10s / -10s) */
.cvp-seek-ripple {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 38%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
}

.cvp-seek-ripple.left {
    left: 0;
    border-top-left-radius: inherit;
    border-bottom-left-radius: inherit;
    background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.22) 0%, transparent 70%);
}

.cvp-seek-ripple.right {
    right: 0;
    border-top-right-radius: inherit;
    border-bottom-right-radius: inherit;
    background: radial-gradient(circle at 70% 50%, rgba(255, 255, 255, 0.22) 0%, transparent 70%);
}

.cvp-seek-ripple.animate {
    animation: cvpRippleFade 0.6s ease-out forwards;
}

.cvp-ripple-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes cvpRippleFade {
    0% { opacity: 0; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.15); }
}

/* Bottom Controls Toolbar */
.cvp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.52) 65%, transparent 100%);
    padding: 22px 10px 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 6;
}

.custom-video-player.controls-hidden .cvp-controls {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

/* Progress Scrubber */
.cvp-progress-container {
    position: relative;
    height: 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    outline: none;
}

.cvp-progress-buffered,
.cvp-progress-played {
    position: absolute;
    left: 0;
    height: 4px;
    border-radius: 2px;
    pointer-events: none;
    transition: height 0.15s ease;
}

.cvp-progress-buffered {
    width: 0%;
    background: rgba(255, 255, 255, 0.32);
    z-index: 1;
}

.cvp-progress-container:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 2px;
    transition: height 0.15s ease;
}

.cvp-progress-played {
    width: 0%;
    background: var(--primary-gradient, linear-gradient(135deg, #FFA000 0%, #FF6600 50%, #FF4D00 100%));
    z-index: 2;
}

.cvp-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%) scale(0);
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 119, 0, 0.6);
    pointer-events: none;
    z-index: 3;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cvp-progress-container:hover:before,
.cvp-progress-container:hover .cvp-progress-buffered,
.cvp-progress-container:hover .cvp-progress-played {
    height: 6px;
}

.cvp-progress-container:hover .cvp-progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

/* Time Tooltip Bubble */
.cvp-time-tooltip {
    position: absolute;
    bottom: 22px;
    transform: translateX(-50%);
    background: rgba(18, 18, 22, 0.95);
    color: #FFFFFF;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    z-index: 4;
}

/* Controls Buttons Row */
.cvp-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cvp-controls-left,
.cvp-controls-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Control Buttons */
.cvp-btn {
    background: transparent;
    border: none;
    color: #FFFFFF;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    padding: 0;
    flex-shrink: 0;
}

.cvp-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FFA000;
    transform: scale(1.06);
}

.cvp-btn:active {
    transform: scale(0.92);
}

/* Time Display */
.cvp-time-display {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: rgba(255, 255, 255, 0.9);
    margin-left: 4px;
    white-space: nowrap;
}

.cvp-time-divider {
    color: rgba(255, 255, 255, 0.4);
}

.cvp-duration {
    color: rgba(255, 255, 255, 0.65);
}

/* Volume Slider Group */
.cvp-volume-group {
    display: flex;
    align-items: center;
    position: relative;
}

.cvp-volume-slider-wrap {
    width: 0;
    overflow: hidden;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin 0.2s ease;
    display: flex;
    align-items: center;
}

.cvp-volume-group:hover .cvp-volume-slider-wrap {
    width: 60px;
    margin-right: 6px;
}

.cvp-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 54px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    cursor: pointer;
}

.cvp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.cvp-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #FFA000;
}

/* Speed Selector Menu */
.cvp-speed-group {
    position: relative;
}

.cvp-speed-btn {
    font-size: 11.5px;
    font-weight: 700;
    font-family: inherit;
    width: auto;
    padding: 0 6px;
}

.cvp-speed-menu {
    position: absolute;
    bottom: 38px;
    right: 0;
    background: rgba(22, 22, 28, 0.95);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
    z-index: 10;
}

.cvp-speed-option {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.cvp-speed-option:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

.cvp-speed-option.active {
    background: var(--primary-gradient, linear-gradient(135deg, #FFA000, #FF6600));
    color: #FFFFFF;
}

/* Fullscreen Mode */
.custom-video-player.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.custom-video-player.is-fullscreen .cvp-video {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

/* Dark Theme Adjustments */
[data-theme="dark"] .custom-video-player {
    background: #090a0f;
    border-color: rgba(255, 255, 255, 0.08);
}

/* Remove Member Button */
.btn-remove-member {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted, #8E8E93);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.55;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: 6px;
}

.member-item:hover .btn-remove-member {
    opacity: 1;
}

.btn-remove-member:hover {
    color: #EF4444 !important;
    background: rgba(239, 68, 68, 0.14) !important;
    transform: scale(1.1);
}

.btn-remove-member:active {
    transform: scale(0.92);
}

/* ==========================================================================
   ENHANCEMENTS & BUG FIXES STYLING
   ========================================================================== */

/* Dark Mode Reply Text Contrast */
[data-theme="dark"] .message-reply-banner,
[data-theme="dark"] .message-self .message-reply-banner {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
    border-left: 3.5px solid #FF9433 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .message-reply-banner svg,
[data-theme="dark"] .message-self .message-reply-banner svg {
    color: #FF9433 !important;
}

[data-theme="dark"] .message-reply-banner strong,
[data-theme="dark"] .message-self .message-reply-banner strong {
    color: #FF9433 !important;
}

[data-theme="dark"] .message-reply-banner span,
[data-theme="dark"] .message-self .message-reply-banner span {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .reply-preview {
    background: #1c2128 !important;
    border-color: #30363d !important;
    border-left-color: #FF9433 !important;
}

[data-theme="dark"] #reply-preview-author {
    color: #FF9433 !important;
}

[data-theme="dark"] #reply-preview-text {
    color: #e5e7eb !important;
}

/* Notification & Menu Dot Badges */
.nav-dot-badge {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    background: #ef4444;
    position: absolute;
    top: 4px;
    right: calc(50% - 14px);
    box-shadow: 0 0 0 2px var(--bg-surface, #fff);
    animation: pulseDot 2s infinite;
}

.rail-dot-badge {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    background: #ef4444;
    position: absolute;
    top: 6px;
    right: 8px;
    box-shadow: 0 0 0 2px var(--bg-rail, #24292f);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.85; }
}

/* Friends List in DM Modal */
.dm-friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.dm-friend-item:hover, .dm-friend-item:active {
    background: var(--bg-hover, rgba(255, 119, 0, 0.08));
    border-color: rgba(255, 119, 0, 0.15);
}

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

.dm-friend-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border);
}

.dm-friend-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--bg-surface, #fff);
}

.dm-friend-info {
    flex: 1;
    min-width: 0;
}

.dm-friend-name {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--text-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-friend-username {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.dm-friend-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    flex-shrink: 0;
}

.dm-friend-badge.online {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.dm-friend-badge.offline {
    background: rgba(156, 163, 175, 0.12);
    color: #6b7280;
}

/* Avatar Cropper Modal Styles */
#avatar-cropper-overlay {
    z-index: 2000 !important;
}

.cropper-viewport-container {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 16px;
    overflow: hidden;
    background: #18181b;
    cursor: grab;
    user-select: none;
    touch-action: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.cropper-viewport-container:active {
    cursor: grabbing;
}

#cropper-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cropper-circular-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58);
    border: 2px dashed rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

/* Lightbox Media Item Pinch/Zoom Support */
.lightbox-media-item {
    max-width: 95vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    user-select: none;
    transition: transform 0.05s ease-out;
    transform-origin: center center;
    touch-action: none;
}

/* iOS Install PWA Banner & Push Notification Banner */
.ios-install-banner, .push-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 440px;
    background: var(--bg-surface, #ffffff);
    color: var(--text-normal, #1f2937);
    border: 1px solid rgba(255, 119, 0, 0.28);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    backdrop-filter: blur(16px);
    animation: slideDownBanner 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .ios-install-banner, [data-theme="dark"] .push-banner {
    background: #1c2128;
    border-color: rgba(255, 119, 0, 0.38);
    color: #f3f4f6;
}

.ios-install-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

.ios-install-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 119, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ios-install-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.45;
}

.ios-install-text strong {
    font-size: 14.5px;
    color: var(--primary, #FF7700);
    display: block;
    margin-bottom: 2px;
}

.ios-install-text ol {
    margin: 6px 0 0 16px;
    padding: 0;
    font-size: 12px;
    color: var(--text-secondary, #4b5563);
}

[data-theme="dark"] .ios-install-text ol {
    color: #9ca3af;
}

.ios-install-text ol li {
    margin-bottom: 3px;
}

.push-banner-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    padding: 0 4px;
    position: absolute;
    top: -4px;
    right: -4px;
}

.push-banner-close:hover {
    color: var(--danger, #ef4444);
}

@keyframes slideDownBanner {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Hidden file inputs: visually hidden but accessible to WebKit event dispatcher on iOS Safari & PWAs */
.app-file-input,
input[type="file"].app-file-input,
input[type="file"].hidden,
input[type="file"].file-input {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: auto !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    z-index: -1 !important;
}

/* Auto-collapse action buttons to maximize input width ONLY when user actually typed text */
#chat-form.is-typing #btn-voice-record,
#chat-form.is-typing #btn-camera,
#chat-form.is-typing #btn-camera-video,
.input-bar.is-typing #btn-voice-record,
.input-bar.is-typing #btn-camera,
.input-bar.is-typing #btn-camera-video {
    display: none !important;
}

#chat-form.is-typing #btn-send,
.input-bar.is-typing #btn-send {
    display: flex !important;
}

#chat-form.is-typing .input-wrapper,
.input-bar.is-typing .input-wrapper {
    flex: 1 !important;
    width: 100% !important;
}

/* ==========================================================================
   iOS & SAFARI SPECIALIZED OPTIMIZATIONS
   ========================================================================== */

/* 1. Prevent iOS Auto-Zoom on form input focus (< 16px font triggers Safari auto-zoom) */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select,
    .input-icon-wrapper input,
    .sidebar-search input,
    .search-input-wrapper input,
    .friends-search-form input,
    .poll-option-input,
    .input-wrapper textarea,
    #news-create-content,
    .news-comment-input {
        font-size: 16px !important;
    }
}

/* 2. iOS Virtual Keyboard States */
body.keyboard-open {
    --safe-bottom: 0px !important;
}

body.keyboard-open .mobile-bottom-nav {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.keyboard-open .input-bar-container {
    padding-bottom: 4px !important;
}

/* 3. iOS Momentum Scrolling & Elastic Bounce containment */
.messages-area,
.message-area,
.sidebar-channels,
.channels-list,
.news-body,
.news-posts-list,
.modal-body,
.admin-content,
.friends-body,
.media-content,
.chat-settings-body,
.seen-list-body,
.search-results,
.members-list,
.stickers-body,
.online-users-scroll {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
}

/* 4. Touch Action & Tap Highlights */
button,
a,
input,
select,
textarea,
.nav-item,
.channel-item,
.menu-item,
.reaction-btn,
.sticker-item,
.btn-icon,
.tab-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent !important;
}

/* 5. Prevent Safari Callout Sheet on UI elements */
img,
video,
.btn-icon,
.nav-item,
.tab-icon-3d,
.voice-note-player {
    -webkit-touch-callout: none;
}

/* 6. iOS WebKit standalone full height */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
    
    .screen {
        min-height: -webkit-fill-available;
    }
}

/* 7. Call Overlay Mobile Adjustments */
@media screen and (max-width: 768px) {
    .call-content {
        padding-top: calc(30px + var(--safe-top)) !important;
        padding-bottom: calc(30px + var(--safe-bottom)) !important;
    }
}

/* =============================================================
   8. ULTRA HIGH PERFORMANCE & ANTI-LAG HARDWARE ACCELERATION
   ============================================================= */
.news-body,
.messages-area,
.channels-list,
.modal-body {
    transform: translateZ(0);
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* Off-screen DOM rendering optimization: Giảm tải tới 80% RAM & CPU khi cuộn danh sách bài viết / tin nhắn */
.news-post-card {
    content-visibility: auto;
    contain-intrinsic-size: 0 320px;
}

.message {
    content-visibility: auto;
    contain-intrinsic-size: 0 50px;
}

.message-image,
.news-post-media img {
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
}

/* =============================================================
   9. NETWORK STATUS BANNER & ANTI-SPAM SENDING UI
   ============================================================= */
.network-status-banner {
    position: fixed;
    top: calc(14px + var(--safe-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
}

.network-status-banner.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-24px);
    pointer-events: none;
}

.network-banner-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full, 999px);
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.network-status-banner.is-offline .network-banner-inner {
    background: rgba(255, 59, 48, 0.92);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.network-status-banner.is-online .network-banner-inner {
    background: rgba(52, 199, 89, 0.92);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.network-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.network-status-dot.pulse-red {
    background: #FFFFFF;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: pulse-red-anim 1.5s infinite;
}

.network-status-dot.pulse-green {
    background: #FFFFFF;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: pulse-green-anim 1.5s infinite;
}

@keyframes pulse-red-anim {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@keyframes pulse-green-anim {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Send Button Loading Spinner */
.btn-send.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.btn-send.is-loading svg {
    opacity: 0;
}

.btn-send.is-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: btn-send-spin 0.7s linear infinite;
}

@keyframes btn-send-spin {
    to { transform: rotate(360deg); }
}

/* Failed Message & Retry Banner */
.message.message-failed .message-content {
    border: 1px solid rgba(255, 59, 48, 0.4) !important;
    background: rgba(255, 59, 48, 0.05) !important;
}

.message.message-sending {
    opacity: 0.75;
}

.message-retry-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full, 999px);
    background: rgba(255, 59, 48, 0.12);
    color: #FF3B30;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    border: 1px solid rgba(255, 59, 48, 0.25);
    transition: all 0.2s ease;
    user-select: none;
}

.message-retry-banner:hover {
    background: rgba(255, 59, 48, 0.22);
    transform: translateY(-1px);
}

.message-retry-banner:active {
    transform: scale(0.96);
}

.message-seen-badge.failed {
    color: #FF3B30 !important;
    background: rgba(255, 59, 48, 0.12) !important;
    border: 1px solid rgba(255, 59, 48, 0.25) !important;
    cursor: pointer;
}

/* ==========================================================================
   IN-APP FLOATING NOTIFICATION BANNER (THÔNG BÁO TRÔI TRÊN APP)
   ========================================================================== */
.in-app-floating-banner {
    position: fixed;
    top: calc(12px + var(--safe-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    width: calc(100% - 24px);
    max-width: 420px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid rgba(255, 119, 0, 0.32);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16), 0 4px 16px rgba(255, 119, 0, 0.22);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    animation: inAppBannerSlideDown 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
    box-sizing: border-box;
}

@keyframes inAppBannerSlideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.in-app-floating-banner.dismissing {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.95);
}

.in-app-floating-banner:hover {
    transform: translate(-50%, -1px);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(255, 119, 0, 0.3);
}

.in-app-banner-avatar-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.in-app-banner-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 119, 0, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.in-app-banner-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary, #FF7700);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #FFFFFF;
    font-size: 9px;
}

.in-app-banner-badge.mention {
    background: linear-gradient(135deg, #FF3B30 0%, #FF2D55 100%) !important;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.4);
    font-weight: 800;
    font-size: 10px;
}

.in-app-floating-banner.is-mention {
    border-color: rgba(255, 45, 85, 0.45);
    box-shadow: 0 16px 40px rgba(255, 45, 85, 0.18), 0 4px 16px rgba(255, 59, 48, 0.22);
}

.in-app-banner-badge.reply {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%) !important;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.4);
    font-weight: 800;
    font-size: 9px;
}

.in-app-floating-banner.is-reply {
    border-color: rgba(0, 122, 255, 0.45);
    box-shadow: 0 16px 40px rgba(0, 122, 255, 0.18), 0 4px 16px rgba(0, 122, 255, 0.22);
}

.in-app-banner-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.in-app-banner-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.in-app-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #1C1C1E);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.in-app-banner-time {
    font-size: 11px;
    color: var(--text-muted, #8E8E93);
    flex-shrink: 0;
}

.in-app-banner-body {
    font-size: 13px;
    color: var(--text-secondary, #636366);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

.in-app-banner-close {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #8E8E93);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.in-app-banner-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-primary, #1C1C1E);
}

[data-theme="dark"] .in-app-floating-banner {
    background: rgba(28, 28, 30, 0.94);
    border-color: rgba(255, 119, 0, 0.45);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(255, 119, 0, 0.3);
}

[data-theme="dark"] .in-app-banner-title {
    color: #FFFFFF;
}

[data-theme="dark"] .in-app-banner-body {
    color: #AEAEB2;
}

[data-theme="dark"] .in-app-banner-close {
    background: rgba(255, 255, 255, 0.1);
    color: #AEAEB2;
}

[data-theme="dark"] .in-app-banner-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
}

/* ==========================================================================
   CONSECUTIVE MESSAGE GROUPING & TIMESTAMPS
   ========================================================================== */
.message-group-start {
    margin-top: 12px;
}

.message-group-item {
    margin-top: 2px !important;
}

.message-group-item .message-header {
    display: none !important;
}

.message-group-item .message-avatar {
    visibility: hidden;
    height: 0;
    min-height: 0;
    margin: 0;
}

/* Timestamps below bubble */
.message-time-inline {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted, #8E8E93);
    margin-top: 3px;
    padding: 0 4px;
    letter-spacing: 0.1px;
    user-select: none;
}

.message:not(.message-self) .message-time-inline {
    align-self: flex-start;
}

.message.message-self .message-time-inline {
    align-self: flex-end;
}

.time-cluster-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 10px;
    width: 100%;
    user-select: none;
}

.time-cluster-separator span {
    background: rgba(0, 0, 0, 0.07);
    color: var(--text-secondary, #636366);
    padding: 4px 14px;
    border-radius: var(--radius-full, 999px);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .time-cluster-separator span {
    background: rgba(255, 255, 255, 0.1);
    color: #AEAEB2;
}

/* Group author name styling (purple / vibrant accent like screenshot) */
.message-author-group {
    color: #9333EA !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: -0.1px;
}

[data-theme="dark"] .message-author-group {
    color: #C084FC !important;
}

/* ==========================================================================
   GROUP CHAT SEEN AVATARS (AVATAR NGƯỜI XEM Ở GÓC DƯỚI BONG BÓNG CHAT)
   ========================================================================== */
.seen-avatars-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-direction: row-reverse;
    margin-top: 3px;
    margin-bottom: 2px;
    padding: 0 4px;
    animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    user-select: none;
    align-self: flex-end;
}

.message:not(.message-self) .seen-avatars-group {
    align-self: flex-end;
}

.seen-mini-avatar {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1.5px solid #FFFFFF;
    margin-left: -5px;
    object-fit: cover;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), z-index 0.15s ease;
    background-color: var(--bg-surface, #FFFFFF);
    flex-shrink: 0;
}

[data-theme="dark"] .seen-mini-avatar {
    border-color: #1C1C1E;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.seen-mini-avatar:hover {
    transform: scale(1.4) translateY(-2px);
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.seen-more-count {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--primary, #FF7700);
    color: #FFFFFF;
    font-size: 8.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #FFFFFF;
    margin-left: -5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

[data-theme="dark"] .seen-more-count {
    border-color: #1C1C1E;
}

/* ==========================================================================
   MENU BORDER GLOW & RUNNING BEAM EFFECT (Hiệu ứng lóe sáng viền bo góc menu)
   ========================================================================== */

.mobile-bottom-nav,
.desktop-nav-rail,
.sidebar-filter-tabs {
    position: relative;
}

.menu-border-glow-trail {
    position: absolute;
    inset: -1.5px;
    border-radius: inherit;
    padding: 2.5px;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.2s ease;
    will-change: opacity, transform;
}

.menu-border-glow-trail::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 650px;
    height: 650px;
    margin-top: -325px;
    margin-left: -325px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 200deg,
        rgba(255, 119, 0, 0.12) 235deg,
        rgba(255, 140, 0, 0.6) 275deg,
        rgba(255, 200, 50, 0.95) 315deg,
        #FFFFFF 345deg,
        #FFF6E0 355deg,
        transparent 360deg
    );
    filter: drop-shadow(0 0 10px rgba(255, 119, 0, 1)) drop-shadow(0 0 4px #FFFFFF);
    transform: translateZ(0) rotate(0deg);
    will-change: transform;
}

.menu-border-glow-trail::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 650px;
    height: 650px;
    margin-top: -325px;
    margin-left: -325px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 330deg,
        rgba(255, 255, 255, 0.9) 345deg,
        #FFFFFF 352deg,
        rgba(255, 210, 100, 0.85) 358deg,
        transparent 360deg
    );
    filter: drop-shadow(0 0 8px #FF8800) drop-shadow(0 0 2px #fff);
    transform: translateZ(0) rotate(0deg);
    will-change: transform;
}

/* Lớp kích hoạt chạy vệt sáng */
.mobile-bottom-nav.glow-active .menu-border-glow-trail,
.desktop-nav-rail.glow-active .menu-border-glow-trail,
.sidebar-filter-tabs.glow-active .menu-border-glow-trail,
.menu-border-glow-trail.run-beam {
    opacity: 1;
    animation: menuBeamTrailFade 1.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.mobile-bottom-nav.glow-active .menu-border-glow-trail::before,
.desktop-nav-rail.glow-active .menu-border-glow-trail::before,
.sidebar-filter-tabs.glow-active .menu-border-glow-trail::before,
.menu-border-glow-trail.run-beam::before {
    animation: menuBeamRotateSweep 1.2s cubic-bezier(0.3, 0.05, 0.15, 1) forwards;
}

.mobile-bottom-nav.glow-active .menu-border-glow-trail::after,
.desktop-nav-rail.glow-active .menu-border-glow-trail::after,
.sidebar-filter-tabs.glow-active .menu-border-glow-trail::after,
.menu-border-glow-trail.run-beam::after {
    animation: menuBeamRotateSweep 1.2s cubic-bezier(0.3, 0.05, 0.15, 1) forwards;
}

/* Hiệu ứng lóe sáng viền ngoài (Halo Flash Pulse) */
.mobile-bottom-nav.glow-active {
    animation: menuDockFlare 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

.desktop-nav-rail.glow-active {
    animation: menuRailFlare 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

.sidebar-filter-tabs.glow-active {
    animation: menuTabsFlare 1.15s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

/* Keyframes cho vệt sáng quay vòng quanh viền bo góc */
@keyframes menuBeamRotateSweep {
    0% {
        transform: translateZ(0) rotate(0deg);
    }
    100% {
        transform: translateZ(0) rotate(360deg);
    }
}

@keyframes menuBeamTrailFade {
    0% {
        opacity: 0;
    }
    12% {
        opacity: 1;
    }
    78% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes menuDockFlare {
    0% {
        border-color: rgba(255, 235, 180, 0.95) !important;
        box-shadow: 0 16px 45px rgba(255, 119, 0, 0.45),
                    0 0 35px rgba(255, 140, 50, 0.8),
                    0 0 12px rgba(255, 255, 255, 0.9),
                    inset 0 0 15px rgba(255, 200, 120, 0.7) !important;
    }
    35% {
        border-color: rgba(255, 180, 80, 0.85) !important;
        box-shadow: 0 18px 48px rgba(255, 119, 0, 0.4),
                    0 0 25px rgba(255, 119, 0, 0.6),
                    inset 0 0 8px rgba(255, 200, 120, 0.5) !important;
    }
    100% {
        border-color: rgba(255, 150, 60, 0.55) !important;
        box-shadow: 0 16px 40px rgba(255, 119, 0, 0.3),
                    0 4px 14px rgba(0, 0, 0, 0.12),
                    inset 0 1px 2px rgba(255, 220, 180, 0.75) !important;
    }
}

@keyframes menuRailFlare {
    0% {
        border-color: rgba(255, 180, 80, 0.9) !important;
        box-shadow: 0 0 25px rgba(255, 119, 0, 0.5), inset 0 0 12px rgba(255, 140, 50, 0.4) !important;
    }
    100% {
        border-color: var(--border, rgba(0,0,0,0.08)) !important;
        box-shadow: none !important;
    }
}

@keyframes menuTabsFlare {
    0% {
        border-color: rgba(255, 160, 50, 0.8) !important;
        box-shadow: 0 0 20px rgba(255, 119, 0, 0.4) !important;
    }
    100% {
        border-color: var(--border-light, rgba(0, 0, 0, 0.06)) !important;
        box-shadow: none !important;
    }
}

/* Đảm bảo nội dung các nút tab nổi phía trên viền sáng */
.mobile-bottom-nav .nav-item {
    position: relative;
    z-index: 12;
}

.mobile-bottom-nav .nav-item:active .tab-icon-3d {
    transform: scale(0.88) !important;
    filter: brightness(1.2) drop-shadow(0 0 12px rgba(255, 119, 0, 0.8)) !important;
}

/* Dark theme overrides cho hiệu ứng thêm rực rỡ */
[data-theme="dark"] .menu-border-glow-trail::before {
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 200deg,
        rgba(255, 119, 0, 0.2) 235deg,
        rgba(255, 140, 0, 0.7) 275deg,
        rgba(255, 200, 50, 1) 315deg,
        #FFFFFF 345deg,
        #FFF6E0 355deg,
        transparent 360deg
    );
    filter: drop-shadow(0 0 14px rgba(255, 119, 0, 1)) drop-shadow(0 0 5px #FFFFFF);
}

[data-theme="dark"] @keyframes menuDockFlare {
    0% {
        border-color: rgba(255, 235, 180, 0.95) !important;
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6),
                    0 0 45px rgba(255, 119, 0, 0.75),
                    0 0 15px rgba(255, 255, 255, 0.8),
                    inset 0 0 18px rgba(255, 180, 80, 0.6) !important;
    }
    35% {
        border-color: rgba(255, 180, 80, 0.85) !important;
        box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5),
                    0 0 30px rgba(255, 119, 0, 0.5),
                    inset 0 0 10px rgba(255, 180, 80, 0.4) !important;
    }
    100% {
        border-color: rgba(255, 140, 50, 0.35) !important;
        box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5),
                    0 0 25px rgba(255, 119, 0, 0.16),
                    inset 0 1px 1.5px rgba(255, 200, 150, 0.3) !important;
    }
}

/* ==========================================================================
   MULTI-MEDIA POSTS & ALBUM GALLERY (Bảng tin đa phương tiện nhiều ảnh/video)
   ========================================================================== */

.news-create-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 6px;
}

.news-preview-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.news-preview-item img,
.news-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-preview-remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    backdrop-filter: blur(4px);
    z-index: 5;
}

.news-preview-remove-btn:hover {
    background: #EF4444;
    transform: scale(1.1);
}

.news-preview-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.68);
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 3px;
    pointer-events: none;
}

/* Post Album Grids (Facebook / Instagram Style) */
.news-post-album {
    margin-top: 10px;
    border-radius: 14px;
    overflow: hidden;
    width: 100%;
    display: grid;
    gap: 3px;
    background: #000000;
}

/* 1 Item */
.news-post-album.album-count-1 {
    grid-template-columns: 1fr;
    max-height: 460px;
}
.news-post-album.album-count-1 .news-album-item {
    max-height: 460px;
    aspect-ratio: auto;
}
.news-post-album.album-count-1 img,
.news-post-album.album-count-1 video {
    max-height: 460px;
    width: 100%;
    object-fit: contain;
    background: #0c0e14;
}

/* 2 Items (1x2 Grid) */
.news-post-album.album-count-2 {
    grid-template-columns: 1fr 1fr;
    height: 280px;
}
.news-post-album.album-count-2 .news-album-item {
    height: 280px;
}

/* 3 Items */
.news-post-album.album-count-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 200px 140px;
    height: 343px;
}
.news-post-album.album-count-3 .news-album-item:nth-child(1) {
    grid-column: span 2;
    height: 200px;
}
.news-post-album.album-count-3 .news-album-item:nth-child(2),
.news-post-album.album-count-3 .news-album-item:nth-child(3) {
    height: 140px;
}

/* 4 Items (2x2 Grid) */
.news-post-album.album-count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 160px 160px;
    height: 323px;
}
.news-post-album.album-count-4 .news-album-item {
    height: 160px;
}

/* 5+ Items (2x2 with +N Overlay) */
.news-post-album.album-count-more {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 160px 160px;
    height: 323px;
}
.news-post-album.album-count-more .news-album-item {
    height: 160px;
}

.news-album-item {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    background: #151821;
}

.news-album-item img,
.news-album-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.28s ease;
}

.news-album-item:hover img {
    transform: scale(1.035);
}

.news-album-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 26px;
    font-weight: 800;
    backdrop-filter: blur(3px);
    transition: background 0.2s ease;
}
.news-album-overlay:hover {
    background: rgba(0, 0, 0, 0.72);
}

.news-album-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    border: 2px solid rgba(255, 255, 255, 0.85);
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.news-album-item:hover .news-album-play-icon {
    transform: translate(-50%, -50%) scale(1.1);
}