/* =====================================================
   ChatWithStrangers - Premium Native App Experience
   WhatsApp-Inspired Professional Design
   ===================================================== */

/* Enhanced CSS Variables - WhatsApp Style */
:root {
    /* Enhanced Dark Theme Colors - Better Contrast */
    --bg-base: #0d1418;
    --bg-primary: #131b21;
    --bg-secondary: #1e2a31;
    --bg-tertiary: #263238;
    --bg-elevated: #2d3940;
    --bg-card: rgba(19, 27, 33, 0.98);

    /* Glass Effect */
    --glass-bg: rgba(19, 27, 33, 0.92);
    --glass-border: rgba(134, 150, 160, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Text Colors - Enhanced Contrast */
    --text-primary: #f0f2f5;
    --text-secondary: #99a5ad;
    --text-tertiary: rgba(153, 165, 173, 0.65);
    --text-muted: rgba(153, 165, 173, 0.4);

    /* Vibrant Accent Colors */
    --accent-primary: #00d4aa;
    --accent-secondary: #2ae881;
    --accent-gradient: linear-gradient(135deg, #00d4aa 0%, #2ae881 50%, #00a884 100%);
    --accent-glow: 0 0 24px rgba(0, 212, 170, 0.3);

    /* Message Bubbles - Enhanced */
    --bubble-sent: #006c5b;
    --bubble-sent-solid: #006c5b;
    --bubble-received: #1e2a31;

    /* Enhanced Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);

    /* Border Radius - Native Feel */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Refined Spacing Scale */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Component Sizes */
    --header-height: 60px;
    --avatar-size: 49px;
    --avatar-size-sm: 40px;
    --avatar-size-lg: 80px;
    --icon-btn-size: 40px;

    /* Typography - WhatsApp uses SF Pro / Helvetica */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Enhanced Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.25s;
    --duration-slow: 0.4s;

    /* Safe Area */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Reset with Smoother Defaults */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    font-size: 15px;
    line-height: 1.5;
}

/* App Container */
#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
}

/* =====================================================
   Connection Bar - Refined
   ===================================================== */
.connection-bar {
    padding: var(--space-2) var(--space-4);
    text-align: center;
    font-size: 13px;
    font-weight: var(--font-weight-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    z-index: 200;
    backdrop-filter: blur(12px);
}

.connection-bar.connecting {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    color: #1a1a1a;
}

.connection-bar.connected {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    color: #0a0f14;
    animation: slideOut 0.4s var(--ease-out) 1.5s forwards;
}

.connection-bar.disconnected {
    background: linear-gradient(90deg, #ef4444, #f87171);
    color: white;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 212, 170, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.skeleton-line {
    height: 12px;
    border-radius: var(--radius-sm);
}

/* =====================================================
   Main Layout - Enhanced Structure
   ===================================================== */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background: var(--bg-base);
}

/* =====================================================
   Sidebar - Premium Glass Effect
   ===================================================== */
.sidebar {
    width: 380px;
    min-width: 340px;
    max-width: 420px;
    background: var(--bg-primary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Subtle gradient overlay */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(0, 212, 170, 0.03) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        position: absolute;
        inset: 0;
        z-index: 50;
        transform: translateX(0);
        transition: transform var(--duration-normal) var(--ease-out);
    }

    .sidebar.mobile-hidden {
        transform: translateX(-100%);
        pointer-events: none;
    }
}

/* =====================================================
   Header - Native App Style
   ===================================================== */
.header {
    background: var(--bg-secondary);
    padding: var(--space-3) var(--space-5);
    padding-top: calc(var(--safe-area-top) + var(--space-3));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 56px;
    position: relative;
    z-index: 10;
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
}

.header-title {
    font-size: 18px;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.4px;
    white-space: nowrap;
}

.header-divider {
    color: var(--text-tertiary);
    font-size: 12px;
    margin: 0 2px;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}

.header-subtitle::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0, 212, 170, 0.6);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(0, 212, 170, 0.6);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 16px rgba(0, 212, 170, 0.8);
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Secure Badge - Refined */
.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 6px 8px;
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.2);
    border-radius: var(--radius-full);
    color: var(--accent-primary);
    font-size: 0;
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: all var(--duration-fast) var(--ease-out);
}

.secure-badge:hover {
    background: rgba(0, 212, 170, 0.15);
    border-color: rgba(0, 212, 170, 0.3);
}

.secure-badge svg {
    width: 12px;
    height: 12px;
}

/* Icon Buttons - Enhanced */
.icon-btn {
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
}

.icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    background: var(--text-secondary);
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--duration-fast) var(--ease-out);
}

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

.icon-btn:hover::before {
    opacity: 0.1;
    transform: scale(1);
}

.icon-btn:active {
    transform: scale(0.92);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
}

/* =====================================================
   Search Bar - Native Feel
   ===================================================== */
.search-container {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    position: relative;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
    transition: all var(--duration-fast) var(--ease-out);
}

.search-bar:focus-within {
    background: var(--bg-elevated);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: color var(--duration-fast);
}

.search-bar:focus-within svg {
    color: var(--accent-primary);
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: var(--font-weight-normal);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

/* =====================================================
   Tabs - Premium Native Style
   ===================================================== */
.tabs-container {
    padding: 0 var(--space-4);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    z-index: 5;
}

.tabs {
    display: flex;
    gap: 0;
}

.tab {
    flex: 1;
    height: 48px;
    padding: 0 var(--space-4);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 3px 3px 0 0;
    transition: transform var(--duration-normal) var(--ease-spring);
}

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

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

.tab.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* Unread Badge */
.unread-badge {
    background: var(--accent-gradient);
    color: #0a0f14;
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    min-width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(0, 212, 170, 0.3);
}

/* =====================================================
   Filter Chips - Refined
   ===================================================== */
.filters-panel {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
}

.filter-chips {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    padding: var(--space-1) 0;
    -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    height: 36px;
    padding: 0 var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-chip:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.filter-chip.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #0a0f14;
    font-weight: var(--font-weight-semibold);
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
}

/* =====================================================
   User/Chat List - Native App Feel
   ===================================================== */
.list-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

/* Custom Scrollbar */
.list-container::-webkit-scrollbar {
    width: 6px;
}

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

.list-container::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}

.list-section-header {
    padding: var(--space-4) var(--space-5) var(--space-2);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* User/Chat Item */
.user-item,
.chat-item {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    gap: var(--space-4);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    background: transparent;
}

.user-item::after,
.chat-item::after {
    content: '';
    position: absolute;
    left: calc(var(--avatar-size) + var(--space-5) + var(--space-4));
    right: var(--space-5);
    bottom: 0;
    height: 1px;
    background: var(--glass-border);
}

.user-item:last-child::after,
.chat-item:last-child::after {
    display: none;
}

.user-item:hover,
.chat-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.user-item:active,
.chat-item:active {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(0.995);
}

.chat-item.active {
    background: rgba(0, 212, 170, 0.08);
}

.chat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

/* =====================================================
   Avatar - Premium Styling
   ===================================================== */
.avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: var(--font-weight-semibold);
    color: white;
    flex-shrink: 0;
    position: relative;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.avatar-sm {
    width: var(--avatar-size-sm);
    height: var(--avatar-size-sm);
    font-size: 15px;
}

.avatar-lg {
    width: var(--avatar-size-lg);
    height: var(--avatar-size-lg);
    font-size: 32px;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    border: 2.5px solid var(--bg-primary);
    transition: all var(--duration-fast) var(--ease-out);
}

.status-indicator.online {
    background: var(--accent-primary);
    box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4);
    animation: statusPulse 2s infinite;
}

.status-indicator.offline {
    background: var(--text-tertiary);
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.5);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(0, 212, 170, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0);
    }
}

/* User/Chat Info */
.user-info,
.chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name,
.chat-name {
    font-size: 16px;
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-details,
.chat-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: var(--font-weight-normal);
}

/* Friend Badge */
.friend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--accent-gradient);
    color: #0a0f14;
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.friend-badge svg {
    width: 10px;
    height: 10px;
}

/* =====================================================
   Chat Area - Premium Design
   ===================================================== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    min-width: 0;
    position: relative;
}

/* Subtle pattern background */
.chat-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 25% 25%, rgba(0, 212, 170, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(0, 212, 170, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 768px) {
    .chat-area {
        position: absolute;
        inset: 0;
        z-index: 60;
        transform: translateX(100%);
        transition: transform var(--duration-normal) var(--ease-out);
    }

    .chat-area.active {
        transform: translateX(0);
    }
}

/* Chat Header */
.chat-header {
    background: var(--bg-secondary);
    padding: var(--space-3) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: var(--header-height);
    position: relative;
    z-index: 10;
    border-bottom: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
    .chat-header {
        padding: calc(var(--safe-area-top) + var(--space-3)) var(--space-4) var(--space-3);
    }
}

.back-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: -8px;
    transition: all var(--duration-fast) var(--ease-out);
}

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

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

@media (max-width: 768px) {
    .back-btn {
        display: flex;
    }
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-name {
    font-size: 17px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.chat-header-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-header-status.typing {
    color: var(--accent-primary);
}

.chat-header-actions {
    display: flex;
    gap: var(--space-1);
    position: relative;
    z-index: 20;
}

/* =====================================================
   Messages Container
   ===================================================== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: 3px;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    .messages-container {
        padding: var(--space-4) var(--space-4);
    }
}

/* Date Separator */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4) 0;
    margin: var(--space-2) 0;
}

.date-separator span {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
    box-shadow: var(--shadow-sm);
}

/* Messages */
.message {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 2px 0;
    animation: messageIn 0.25s var(--ease-out);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 768px) {
    .message {
        max-width: 100%;
    }
}

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

.message.received {
    align-self: flex-start;
    align-items: flex-start;
}

.message-bubble {
    padding: 10px 14px 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    max-width: 100%;
}

/* Sent Messages - WhatsApp Dark Teal */
.message.sent .message-bubble {
    background: #005c4b;
    color: #e9edef;
    border-bottom-right-radius: var(--radius-xs);
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

/* Received Messages */
.message.received .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-xs);
    box-shadow: var(--shadow-xs);
}

.message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    float: right;
    margin-top: 5px;
    opacity: 0.7;
}

.message-time {
    font-size: 11px;
    color: inherit;
    white-space: nowrap;
}

.message-status {
    display: inline-flex;
    align-items: center;
}

.message-status.read {
    color: #73d3ff;
}

.message-status svg {
    width: 16px;
    height: 16px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-xs);
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* =====================================================
   Input Container - Native Feel
   ===================================================== */
.input-container {
    padding: var(--space-3) var(--space-4) calc(var(--safe-area-bottom) + var(--space-3));
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    border-top: 1px solid var(--glass-border);
}

.offline-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-lg);
    color: #ef4444;
    font-size: 13px;
    font-weight: var(--font-weight-medium);
}

.offline-banner svg {
    width: 16px;
    height: 16px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 6px 6px 6px 16px;
    min-height: 52px;
    transition: all var(--duration-fast) var(--ease-out);
}

.input-wrapper:focus-within {
    background: var(--bg-elevated);
}

.input-wrapper.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.input-actions {
    display: flex;
    align-items: center;
}

.input-actions .icon-btn {
    width: 38px;
    height: 38px;
}

.input-field-container {
    flex: 1;
    display: flex;
    align-items: center;
}

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

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--accent-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-out);
}

.send-btn:hover:not(:disabled) {
    background: #00b894;
    transform: scale(1.05);
}

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

.send-btn:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

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

/* =====================================================
   Empty State
   ===================================================== */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    text-align: center;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

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

.empty-state-icon {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 168, 132, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.12);
    position: relative;
    animation: floatIcon 3s ease-in-out infinite;
}

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

.empty-state-icon::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.1), transparent);
    opacity: 0;
    animation: pulse 2s ease-in-out infinite;
}

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

.empty-state-icon svg {
    width: 44px;
    height: 44px;
    color: var(--accent-primary);
    filter: drop-shadow(0 2px 8px rgba(0, 212, 170, 0.3));
}

.empty-state-title {
    font-size: 24px;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.5px;
}

.empty-state-text {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 340px;
    line-height: 1.7;
    opacity: 0.9;
}

/* =====================================================
   Modal - Premium Glass Effect
   ===================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-5);
    animation: fadeIn 0.2s var(--ease-out);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s var(--ease-spring);
}

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

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--glass-border);
}

.modal-title {
    font-size: 18px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5) var(--space-6);
}

/* =====================================================
   Security Modal - Compact Design
   ===================================================== */
.security-modal {
    max-width: 340px;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.security-hero-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-3);
    background: rgba(0, 168, 132, 0.12);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.security-hero-icon svg {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.security-title {
    font-size: 18px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.security-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.security-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.security-feature {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    text-align: left;
}

.security-feature-icon {
    width: 36px;
    height: 36px;
    background: rgba(0, 168, 132, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.security-feature-icon svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.security-feature-text h3 {
    font-size: 13px;
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin: 0 0 2px 0;
}

.security-feature-text p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin: 0;
}

.security-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 168, 132, 0.08);
    border-radius: var(--radius-full);
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
}

.security-trust-badge svg {
    width: 14px;
    height: 14px;
}

/* Hide vibe theme badge */
.vibe-theme-badge {
    display: none;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: calc(var(--safe-area-bottom) + 100px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-6);
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s var(--ease-spring);
}

.toast.success {
    background: var(--accent-gradient);
    color: #0a0f14;
    border-color: transparent;
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #f87171);
    border-color: transparent;
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideOut {
    to {
        transform: translateY(-100%);
        opacity: 0;
        height: 0;
        padding: 0;
    }
}

/* Profile Card */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-8) 0 var(--space-6);
    margin-bottom: var(--space-5);
}

.profile-card .avatar-lg {
    margin-bottom: var(--space-5);
    box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 6px rgba(0, 212, 170, 0.2), var(--shadow-lg);
}

.profile-nickname-container {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.profile-nickname-input {
    background: transparent;
    border: none;
    font-size: 22px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    text-align: center;
    outline: none;
    max-width: 200px;
}

.profile-nickname-refresh {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(0, 212, 170, 0.1);
    border: none;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.profile-nickname-refresh:hover {
    background: rgba(0, 212, 170, 0.2);
    transform: rotate(180deg);
}

.profile-nickname-refresh svg {
    width: 18px;
    height: 18px;
}

.profile-id {
    font-size: 13px;
    color: var(--text-tertiary);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* =====================================================
   Settings Sections
   ===================================================== */
.settings-section {
    margin-bottom: var(--space-6);
}

.settings-section-title {
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-3);
    padding-left: var(--space-4);
}

.settings-list {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.settings-item {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    gap: var(--space-4);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.settings-item:not(:last-child) {
    border-bottom: 1px solid var(--glass-border);
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.settings-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.settings-icon.purple {
    background: linear-gradient(135deg, #a855f7, #c084fc);
}

.settings-icon.green {
    background: var(--accent-gradient);
}

.settings-icon.red {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

.settings-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.settings-icon.teal {
    background: var(--accent-gradient);
}

.settings-label {
    flex: 1;
    font-size: 16px;
    font-weight: var(--font-weight-normal);
    color: var(--text-primary);
}

.settings-value {
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-select {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 52px;
    height: 32px;
}

.toggle input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--duration-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration-normal) var(--ease-spring);
    box-shadow: var(--shadow-sm);
}

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

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

/* Theme Toggle */
.settings-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}

.settings-theme-toggle label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 15px;
    color: var(--text-primary);
}

.settings-theme-toggle .icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.theme-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--duration-normal);
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    transition: all var(--duration-normal) var(--ease-spring);
    box-shadow: var(--shadow-sm);
}

.theme-toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: opacity var(--duration-fast);
}

.theme-toggle-icon.sun {
    left: 5px;
    opacity: 1;
}

.theme-toggle-icon.moon {
    right: 5px;
    opacity: 0.4;
}

/* Blocked Users */
.blocked-users-list {
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.blocked-user-item {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
}

.blocked-user-item:not(:last-child) {
    border-bottom: 1px solid var(--glass-border);
}

.blocked-user-info {
    flex: 1;
}

.unblock-btn {
    height: 34px;
    padding: 0 var(--space-4);
    background: transparent;
    border: 1.5px solid #ef4444;
    border-radius: var(--radius-full);
    color: #ef4444;
    font-size: 13px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.unblock-btn:hover {
    background: #ef4444;
    color: white;
}

/* =====================================================
   Report Modal
   ===================================================== */
.report-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.report-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.report-option:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.1);
}

.report-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
}

.report-textarea {
    width: 100%;
    min-height: 100px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: var(--space-4);
    font-size: 15px;
    resize: none;
    outline: none;
    margin-bottom: var(--space-4);
    font-family: inherit;
    transition: border-color var(--duration-fast);
}

.report-textarea:focus {
    border-color: var(--accent-primary);
}

.report-submit {
    width: 100%;
    height: 52px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-full);
    color: #0a0f14;
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--duration-fast);
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
}

.report-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 170, 0.4);
}

.report-submit:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    box-shadow: none;
    cursor: not-allowed;
}

/* =====================================================
   Onboarding Modal
   ===================================================== */
.onboarding-modal {
    max-width: 400px;
    border-radius: var(--radius-2xl);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl), 0 0 100px rgba(0, 212, 170, 0.1);
}

.onboarding-subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    font-size: 15px;
    line-height: 1.6;
}

.onboarding-avatar-container {
    margin-bottom: var(--space-8);
    display: flex;
    justify-content: center;
}

.onboarding-avatar {
    box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 8px rgba(0, 212, 170, 0.2), var(--shadow-lg);
    animation: avatarPulse 3s ease-in-out infinite;
}

@keyframes avatarPulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 8px rgba(0, 212, 170, 0.2), var(--shadow-lg);
    }

    50% {
        box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 16px rgba(0, 212, 170, 0.1), var(--shadow-lg);
    }
}

.onboarding-field {
    margin-bottom: var(--space-5);
    text-align: left;
}

.onboarding-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    font-weight: var(--font-weight-medium);
}

.onboarding-input-group {
    display: flex;
    gap: var(--space-3);
}

.onboarding-input {
    flex: 1;
    height: 52px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0 var(--space-4);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: all var(--duration-fast);
}

.onboarding-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.onboarding-input::placeholder {
    color: var(--text-tertiary);
}

.onboarding-refresh-btn {
    width: 52px;
    height: 52px;
    padding: 0;
    flex-shrink: 0;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    border: 1.5px solid var(--glass-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.onboarding-refresh-btn:hover {
    background: var(--bg-elevated);
    color: var(--accent-primary);
}

.onboarding-refresh-btn svg {
    width: 20px;
    height: 20px;
}

.onboarding-gender-group {
    display: flex;
    gap: var(--space-3);
}

.btn-select {
    flex: 1;
    height: 52px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.btn-select:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-select.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #0a0f14;
    font-weight: var(--font-weight-semibold);
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
}

.onboarding-start-btn {
    width: 100%;
    height: 56px;
    margin-top: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--accent-gradient);
    border: none;
    color: #0a0f14;
    font-size: 17px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all var(--duration-fast);
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.3);
    position: relative;
    overflow: hidden;
}

.onboarding-start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.4);
}

.onboarding-start-btn:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    box-shadow: none;
    cursor: not-allowed;
}

/* Shimmer effect */
.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.onboarding-privacy-note {
    color: var(--text-tertiary);
    margin-top: var(--space-5);
    font-size: 13px;
    line-height: 1.5;
}

/* Media Preview */
.media-preview {
    position: relative;
    display: inline-block;
    background: var(--bg-tertiary);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
}

.media-preview img {
    max-height: 150px;
    border-radius: var(--radius-md);
}

.media-preview-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: #ef4444;
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.media-preview-close svg {
    width: 14px;
    height: 14px;
}

/* Message Media - WhatsApp Style */
.message-media {
    margin-bottom: 6px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: var(--radius-md);
    max-width: 280px;
    transition: transform 0.2s ease;
}

.message-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.message-media:hover {
    transform: scale(1.02);
}

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

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.message-media:hover .image-overlay {
    opacity: 1;
}

.image-overlay svg {
    width: 32px;
    height: 32px;
    color: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Image Modal Viewer */
.image-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(10px);
}

.image-modal-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-modal-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-modal-close svg {
    width: 20px;
    height: 20px;
}

/* Light Theme - Enhanced */
[data-theme="light"] {
    --bg-base: #f5f7fa;
    --bg-primary: #ffffff;
    --bg-secondary: #f0f2f5;
    --bg-tertiary: #e8eaed;
    --bg-elevated: #dde0e4;

    --text-primary: #1a1d21;
    --text-secondary: #5f6368;
    --text-tertiary: rgba(95, 99, 104, 0.6);

    --glass-border: rgba(0, 0, 0, 0.06);
    --bubble-received: #e8eaed;
}

[data-theme="light"] .message.sent .message-bubble {
    color: white;
}

[data-theme="light"] .message.received .message-bubble {
    color: var(--text-primary);
}

[data-theme="light"] .header-title {
    -webkit-text-fill-color: #00a884;
}

/* Prevent transition flickering */
html {
    transition: background-color var(--duration-normal), color var(--duration-normal);
}

/* Safe area for iOS */
@supports (padding: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(env(safe-area-inset-top) + var(--space-4));
    }

    .input-container {
        padding-bottom: calc(env(safe-area-inset-bottom) + var(--space-3));
    }
}

/* Prevent transition flickering */
html {
    transition: background-color var(--duration-normal), color var(--duration-normal);
}

/* =====================================================
   ENHANCED SAFE AREA HANDLING (iOS/Android)
   ===================================================== */
@supports (padding: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(env(safe-area-inset-top) + var(--space-4));
    }

    .chat-header {
        padding-top: calc(env(safe-area-inset-top) + var(--space-3));
    }

    .input-container {
        padding-bottom: calc(env(safe-area-inset-bottom) + var(--space-4));
    }

    .modal-backdrop {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .toast-container {
        bottom: calc(env(safe-area-inset-bottom) + 100px);
    }
}

/* =====================================================
   FOCUS STATES - Clean, minimal
   ===================================================== */
*:focus-visible {
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
}

button:focus-visible {
    outline: none;
}

/* =====================================================
   ENHANCED AVATAR RING EFFECTS
   ===================================================== */
.avatar {
    position: relative;
    transition: transform var(--duration-fast) var(--ease-out);
}

/* Online avatar glow ring */
.avatar.has-status-online::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            var(--accent-primary),
            var(--accent-secondary),
            #7dd3c0,
            var(--accent-primary));
    opacity: 0.5;
    animation: avatarRingRotate 3s linear infinite;
    z-index: -1;
}

.avatar.has-status-online::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: var(--bg-primary);
    z-index: -1;
}

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

/* Refined status indicator */
.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid var(--bg-primary);
    transition: all var(--duration-normal) var(--ease-spring);
    z-index: 2;
}

.status-indicator.online {
    background: var(--accent-primary);
    box-shadow:
        0 0 0 0 rgba(0, 212, 170, 0.6),
        0 0 12px rgba(0, 212, 170, 0.5);
    animation: statusPulseEnhanced 2s ease-in-out infinite;
}

@keyframes statusPulseEnhanced {

    0%,
    100% {
        box-shadow:
            0 0 0 0 rgba(0, 212, 170, 0.6),
            0 0 12px rgba(0, 212, 170, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow:
            0 0 0 6px rgba(0, 212, 170, 0),
            0 0 20px rgba(0, 212, 170, 0.3);
        transform: scale(1.1);
    }
}

/* Idle status */
.status-indicator.idle {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    animation: idlePulse 3s ease-in-out infinite;
}

@keyframes idlePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* =====================================================
   MOBILE EXPERIENCE ENHANCEMENTS
   ===================================================== */
/* Better touch feedback */
@media (hover: none) and (pointer: coarse) {

    .user-item,
    .chat-item {
        -webkit-tap-highlight-color: transparent;
    }

    .user-item:active,
    .chat-item:active {
        background: rgba(0, 212, 170, 0.12);
        transform: scale(0.98);
        transition: transform 0.1s, background 0.1s;
    }

    .icon-btn:active {
        transform: scale(0.85);
        background: rgba(255, 255, 255, 0.15);
    }

    .send-btn:active:not(:disabled) {
        transform: scale(0.9);
    }

    .filter-chip:active {
        transform: scale(0.95);
    }

    .tab:active {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Smoother slide transitions */
@media (max-width: 768px) {
    .sidebar {
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        will-change: transform;
    }

    .chat-area {
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        will-change: transform;
    }

    /* Slide in from right with slight scale */
    .chat-area.active {
        transform: translateX(0);
        animation: slideInRight 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0.8;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Pull to refresh visual (placeholder) */
.pull-indicator {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--duration-normal);
}

/* =====================================================
   MICRO-ANIMATIONS
   ===================================================== */
/* Message send animation */
.message.sent {
    animation: messageSend 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageSend {
    0% {
        opacity: 0;
        transform: translateX(20px) scale(0.9);
    }

    50% {
        transform: translateX(-5px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Message receive animation */
.message.received {
    animation: messageReceive 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageReceive {
    0% {
        opacity: 0;
        transform: translateX(-20px) scale(0.9);
    }

    50% {
        transform: translateX(5px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Enhanced typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-xs);
    animation: typingAppear 0.3s var(--ease-spring);
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.typing-indicator span {
    width: 9px;
    height: 9px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingDot {

    0%,
    80%,
    100% {
        transform: scale(0.5);
        opacity: 0.4;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* List item hover animation */
.user-item,
.chat-item {
    transition: all 0.2s var(--ease-out);
}

.user-item:hover .avatar,
.chat-item:hover .avatar {
    transform: scale(1.05);
}

/* Tab switch animation */
.tab.active {
    animation: tabActivate 0.3s var(--ease-spring);
}

@keyframes tabActivate {
    0% {
        transform: scale(0.95);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* Button press ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
    pointer-events: none;
}

.btn-ripple:active::after {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* =====================================================
   ANIMATED EMPTY STATE ILLUSTRATIONS
   ===================================================== */
.empty-state-icon {
    position: relative;
    animation: emptyStateFloat 3s ease-in-out infinite;
}

@keyframes emptyStateFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.empty-state-icon::before {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0, 212, 170, 0.2), transparent);
    border-radius: 50%;
    animation: emptyStateShadow 3s ease-in-out infinite;
}

@keyframes emptyStateShadow {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.4;
    }

    50% {
        transform: translateX(-50%) scale(0.8);
        opacity: 0.2;
    }
}

/* Animated circles around empty state icon */
.empty-state-icon::after {
    content: '';
    position: absolute;
    inset: -15px;
    border: 2px dashed rgba(0, 212, 170, 0.2);
    border-radius: 50%;
    animation: emptyStateRotate 20s linear infinite;
}

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

/* =====================================================
   CHAT THEME OPTIONS
   ===================================================== */
/* Theme: Default (Teal) */
[data-chat-theme="default"] {
    --chat-accent: #00d4aa;
    --chat-accent-rgb: 0, 212, 170;
    --chat-bubble-sent: linear-gradient(135deg, #00a884 0%, #00c49a 100%);
}

/* Theme: Ocean Blue */
[data-chat-theme="ocean"] {
    --chat-accent: #3b82f6;
    --chat-accent-rgb: 59, 130, 246;
    --chat-bubble-sent: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 50%, #93c5fd 100%);
}

[data-chat-theme="ocean"] .message.sent .message-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

[data-chat-theme="ocean"] .status-indicator.online {
    background: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

/* Theme: Purple Dream */
[data-chat-theme="purple"] {
    --chat-accent: #a855f7;
    --chat-accent-rgb: 168, 85, 247;
    --chat-bubble-sent: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
    --accent-primary: #a855f7;
    --accent-secondary: #c084fc;
    --accent-gradient: linear-gradient(135deg, #a855f7 0%, #c084fc 50%, #e879f9 100%);
}

[data-chat-theme="purple"] .message.sent .message-bubble {
    background: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
}

[data-chat-theme="purple"] .status-indicator.online {
    background: #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

[data-chat-theme="purple"] .header-title {
    background: linear-gradient(135deg, #a855f7, #c084fc, #e879f9);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Theme: Sunset Orange */
[data-chat-theme="sunset"] {
    --chat-accent: #f97316;
    --chat-accent-rgb: 249, 115, 22;
    --chat-bubble-sent: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    --accent-primary: #f97316;
    --accent-secondary: #fb923c;
    --accent-gradient: linear-gradient(135deg, #f97316 0%, #fb923c 50%, #fdba74 100%);
}

[data-chat-theme="sunset"] .message.sent .message-bubble {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
}

[data-chat-theme="sunset"] .status-indicator.online {
    background: #f97316;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
}

[data-chat-theme="sunset"] .header-title {
    background: linear-gradient(135deg, #f97316, #fb923c, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Theme: Rose Pink */
[data-chat-theme="rose"] {
    --chat-accent: #ec4899;
    --chat-accent-rgb: 236, 72, 153;
    --chat-bubble-sent: linear-gradient(135deg, #db2777 0%, #ec4899 100%);
    --accent-primary: #ec4899;
    --accent-secondary: #f472b6;
    --accent-gradient: linear-gradient(135deg, #ec4899 0%, #f472b6 50%, #f9a8d4 100%);
}

[data-chat-theme="rose"] .message.sent .message-bubble {
    background: linear-gradient(135deg, #db2777 0%, #ec4899 100%);
}

[data-chat-theme="rose"] .status-indicator.online {
    background: #ec4899;
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.5);
}

[data-chat-theme="rose"] .header-title {
    background: linear-gradient(135deg, #ec4899, #f472b6, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Theme: Emerald Green */
[data-chat-theme="emerald"] {
    --chat-accent: #10b981;
    --chat-accent-rgb: 16, 185, 129;
    --chat-bubble-sent: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --accent-primary: #10b981;
    --accent-secondary: #34d399;
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #34d399 50%, #6ee7b7 100%);
}

[data-chat-theme="emerald"] .message.sent .message-bubble {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

/* =====================================================
   THEME PICKER UI
   ===================================================== */
.theme-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.theme-option:hover {
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 170, 0.1);
}

.theme-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.theme-swatch.default {
    background: linear-gradient(135deg, #00a884, #00d4aa);
}

.theme-swatch.ocean {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.theme-swatch.purple {
    background: linear-gradient(135deg, #9333ea, #a855f7);
}

.theme-swatch.sunset {
    background: linear-gradient(135deg, #ea580c, #f97316);
}

.theme-swatch.rose {
    background: linear-gradient(135deg, #db2777, #ec4899);
}

.theme-swatch.emerald {
    background: linear-gradient(135deg, #059669, #10b981);
}

.theme-option.active .theme-swatch::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.theme-name {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

/* =====================================================
   SEND BUTTON ENHANCED ANIMATION
   ===================================================== */
.send-btn {
    position: relative;
    overflow: hidden;
}

.send-btn:not(:disabled):active svg {
    animation: sendFly 0.4s var(--ease-out);
}

@keyframes sendFly {
    0% {
        transform: translateX(0) rotate(0);
    }

    50% {
        transform: translateX(10px) rotate(15deg);
        opacity: 0;
    }

    51% {
        transform: translateX(-10px) rotate(-15deg);
        opacity: 0;
    }

    100% {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}

/* =====================================================
   SCROLL BEHAVIOR ENHANCEMENTS
   ===================================================== */
.messages-container {
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.list-container {
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
}

/* Scroll snap for message sections */
.date-separator {
    scroll-snap-align: start;
    scroll-margin-top: var(--space-4);
}

/* =====================================================
   LOADING SKELETON ANIMATIONS
   ===================================================== */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            var(--bg-elevated) 50%,
            var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

    100% {
        background-position: -200% 0;
    }
}

.skeleton-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text-sm {
    height: 12px;
    width: 60%;
}

/* =====================================================
   HAPTIC FEEDBACK VISUAL (for touch devices)
   ===================================================== */
@media (hover: none) {
    .haptic-feedback {
        position: relative;
    }

    .haptic-feedback::after {
        content: '';
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at var(--touch-x, 50%) var(--touch-y, 50%),
                rgba(255, 255, 255, 0.3), transparent 50%);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .haptic-feedback:active::after {
        opacity: 1;
    }
}

/* =====================================================
   1. POLISH & ANIMATIONS - Premium Micro-interactions
   ===================================================== */

/* Message Send Animation */
@keyframes messageSend {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    50% {
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message {
    animation: messageSend 0.3s var(--ease-out);
}

/* Pull to Refresh Indicator */
.pull-to-refresh {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s var(--ease-out);
    z-index: 100;
}

.pull-to-refresh.pulling {
    transform: translateX(-50%) translateY(10px);
}

.pull-to-refresh .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Smooth Page Transitions */
.page-transition-enter {
    animation: pageEnter 0.4s var(--ease-out);
}

.page-transition-exit {
    animation: pageExit 0.3s var(--ease-in-out);
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* Swipe Gesture Indicator */
.swipe-action {
    position: absolute;
    top: 0;
    height: 100%;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.swipe-action.left {
    left: 0;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
}

.swipe-action.right {
    right: 0;
    background: linear-gradient(270deg, var(--accent-red), transparent);
}

.message.swiping .swipe-action {
    opacity: 1;
}

/* Enhanced Skeleton Loaders */
.skeleton-user-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}

.skeleton-chat-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}

/* =====================================================
   2. MODERN UI ELEMENTS - Advanced Theming
   ===================================================== */

/* AMOLED Black Theme */
[data-theme="amoled"] {
    --bg-base: #000000;
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #121212;
    --bg-elevated: #1a1a1a;
    --bg-card: rgba(0, 0, 0, 0.98);
}

/* Message Bubble Style Variants */
[data-bubble-style="rounded"] .message-bubble {
    border-radius: var(--radius-2xl);
}

[data-bubble-style="square"] .message-bubble {
    border-radius: var(--radius-xs);
}

[data-bubble-style="ios"] .message-bubble {
    border-radius: 18px;
    padding: 10px 14px;
}

/* Glassmorphism Modal Enhancement */
.modal.glass {
    background: rgba(17, 27, 33, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(134, 150, 160, 0.1);
}

/* Parallax Scrolling Effect */
.parallax-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(0, 168, 132, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(37, 211, 102, 0.03) 0%, transparent 40%);
    pointer-events: none;
    transition: transform 0.1s ease-out;
}

/* Advanced Gradient Backgrounds */
.bg-gradient-cosmic {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.bg-gradient-sunset {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ffd76d 100%);
}

.bg-gradient-ocean {
    background: linear-gradient(135deg, #2e3192 0%, #1bffff 100%);
}

/* Theme Accent Override for Chat Themes */
[data-chat-theme="ocean"] {
    --bubble-sent: #0077be;
    --accent-primary: #00a4e4;
}

[data-chat-theme="purple"] {
    --bubble-sent: #7c3aed;
    --accent-primary: #a78bfa;
}

[data-chat-theme="sunset"] {
    --bubble-sent: #f97316;
    --accent-primary: #fb923c;
}

[data-chat-theme="rose"] {
    --bubble-sent: #e11d48;
    --accent-primary: #fb7185;
}

[data-chat-theme="emerald"] {
    --bubble-sent: #059669;
    --accent-primary: #10b981;
}

/* =====================================================
   3. BETTER MOBILE EXPERIENCE - Native App Feel
   ===================================================== */

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + var(--safe-area-bottom));
    background: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    padding-bottom: var(--safe-area-bottom);
    z-index: 100;
}

.bottom-nav-items {
    display: flex;
    height: 56px;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-2);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    position: relative;
}

.bottom-nav-item.active {
    color: var(--accent-primary);
}

.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.bottom-nav-item.active::before {
    opacity: 1;
}

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

.bottom-nav-item span {
    font-size: 11px;
    font-weight: var(--font-weight-medium);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }
    
    .bottom-nav.hidden {
        display: none;
    }
}

/* Swipeable Tabs */
.tabs-swipeable {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.tabs-swipeable::-webkit-scrollbar {
    display: none;
}

.tabs-swipeable .tab {
    scroll-snap-align: start;
}

/* Long Press Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2);
    min-width: 200px;
    z-index: 1000;
    animation: contextMenuAppear 0.2s var(--ease-out);
}

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

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
}

.context-menu-item.danger {
    color: var(--accent-red);
}

.context-menu-item svg {
    width: 20px;
    height: 20px;
}

/* Delete Chat Dropdown */
/* Chat Menu Dropdown (WhatsApp-style) */
.chat-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2);
    min-width: 220px;
    z-index: 9999;
    animation: dropdownAppear 0.2s var(--ease-out);
}

@keyframes dropdownAppear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: var(--font-weight-medium);
}

.menu-option:hover {
    background: var(--bg-tertiary);
}

.menu-option.danger {
    color: #f43f5e;
}

.menu-option.danger:hover {
    background: rgba(244, 63, 94, 0.1);
}

.menu-option svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Legacy delete dropdown (kept for compatibility) */
.delete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2);
    min-width: 220px;
    z-index: 1000;
    animation: dropdownAppear 0.2s var(--ease-out);
}

.delete-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: var(--font-weight-medium);
}

.delete-option:hover {
    background: var(--bg-tertiary);
}

.delete-option.danger {
    color: #f43f5e;
}

.delete-option.danger:hover {
    background: rgba(244, 63, 94, 0.1);
}

.delete-option svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Native Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.3s var(--ease-out);
    z-index: 200;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    display: flex;
    justify-content: center;
    padding: var(--space-3) 0;
    cursor: grab;
}

.bottom-sheet-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-5);
    padding-bottom: calc(var(--space-5) + var(--safe-area-bottom));
}

/* =====================================================
   4. IMPROVED INFORMATION DISPLAY - Rich Feedback
   ===================================================== */

/* Enhanced Read Receipts */
.message-status {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.message-status.read {
    color: var(--accent-primary);
}

.message-status.delivered {
    color: var(--text-secondary);
}

.message-status svg {
    width: 16px;
    height: 16px;
}

/* Better Typing Indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 18px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Connection Quality Indicator */
.connection-quality {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    color: var(--text-tertiary);
}

.connection-quality-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.connection-quality-bar {
    width: 3px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background 0.3s;
}

.connection-quality-bar:nth-child(1) {
    height: 6px;
}

.connection-quality-bar:nth-child(2) {
    height: 10px;
}

.connection-quality-bar:nth-child(3) {
    height: 14px;
}

.connection-quality-bar:nth-child(4) {
    height: 18px;
}

.connection-quality.good .connection-quality-bar {
    background: var(--accent-primary);
}

.connection-quality.medium .connection-quality-bar:nth-child(-n+2) {
    background: #f59e0b;
}

.connection-quality.poor .connection-quality-bar:nth-child(1) {
    background: var(--accent-red);
}

/* Last Seen Formatting */
.last-seen {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.last-seen::before {
    content: '•';
    color: var(--text-muted);
}

/* =====================================================
   5. ONBOARDING & DISCOVERY - User Education
   ===================================================== */

/* Welcome Card */
.welcome-card {
    background: var(--accent-gradient);
    color: white;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    margin: var(--space-4);
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.5s var(--ease-out);
}

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

.welcome-card h3 {
    font-size: 20px;
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-2);
}

.welcome-card p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}

/* Feature Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    max-width: 200px;
    z-index: 1000;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s var(--ease-out);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

.tooltip.top::before {
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--bg-elevated);
}

.tooltip.bottom::before {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--bg-elevated);
}

/* Keyboard Shortcuts Guide */
.shortcuts-guide {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    max-width: 500px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--glass-border);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-keys {
    display: flex;
    gap: var(--space-2);
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    font-family: monospace;
}

/* =====================================================
   6. ACCESSIBILITY - Inclusive Design
   ===================================================== */

/* Font Size Controls */
[data-font-size="small"] {
    font-size: 13px;
}

[data-font-size="medium"] {
    font-size: 15px;
}

[data-font-size="large"] {
    font-size: 17px;
}

[data-font-size="xlarge"] {
    font-size: 19px;
}

/* High Contrast Mode */
[data-contrast="high"] {
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --bg-base: #000000;
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bubble-sent: #0066cc;
    --bubble-received: #2a2a2a;
}

/* Focus Indicators for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

button:focus-visible,
.icon-btn:focus-visible {
    outline-offset: 3px;
}

/* Skip to Content Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent-primary);
    color: white;
    padding: var(--space-3) var(--space-4);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
}

.skip-link:focus {
    top: var(--space-2);
    opacity: 1;
    pointer-events: auto;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =====================================================
   7. PERFORMANCE INDICATORS - Status & Progress
   ===================================================== */

/* Message Delivery Status */
.message-delivery-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.message-delivery-status.sending {
    color: var(--text-muted);
}

.message-delivery-status.sent {
    color: var(--text-secondary);
}

.message-delivery-status.delivered {
    color: var(--text-secondary);
}

.message-delivery-status.failed {
    color: var(--accent-red);
}

.message-delivery-status .status-icon {
    width: 12px;
    height: 12px;
}

/* Upload Progress Bar */
.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
    border-radius: var(--radius-xs);
}

.upload-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Offline Mode Indicator */
.offline-mode-banner {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    color: white;
    padding: var(--space-3) var(--space-4);
    text-align: center;
    font-size: 13px;
    font-weight: var(--font-weight-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-md);
}

.offline-mode-banner svg {
    width: 16px;
    height: 16px;
}

/* Sync Status Indicator */
.sync-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
}

.sync-status.syncing {
    color: var(--accent-primary);
}

.sync-status .sync-icon {
    width: 14px;
    height: 14px;
    animation: spin 1s linear infinite;
}

.sync-status.synced .sync-icon {
    animation: none;
    color: var(--accent-primary);
}

/* Network Quality Warning */
.network-warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    color: #1a1a1a;
    padding: var(--space-3) var(--space-4);
    text-align: center;
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    animation: slideDown 0.3s var(--ease-out);
}

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

.network-warning svg {
    width: 16px;
    height: 16px;
}

/* Loading States for Better UX */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 20, 26, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Progress Ring for Uploads */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    stroke: var(--accent-primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s;
}

/* Message Queue Indicator */
.message-queue-indicator {
    position: fixed;
    bottom: calc(60px + var(--safe-area-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    z-index: 100;
    animation: bounceIn 0.3s var(--ease-out);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

/* =====================================================
   OLED / True Black Theme - For AMOLED Displays
   ===================================================== */
[data-theme="oled"] {
    --bg-base: #000000;
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #121212;
    --bg-elevated: #1a1a1a;
    --bg-card: rgba(0, 0, 0, 0.98);

    --glass-bg: rgba(0, 0, 0, 0.95);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);

    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-tertiary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);

    --accent-primary: #00e5c0;
    --accent-secondary: #00ffd1;
    --accent-gradient: linear-gradient(135deg, #00e5c0 0%, #00ffd1 50%, #00d4aa 100%);
    --accent-glow: 0 0 30px rgba(0, 229, 192, 0.4);

    --bubble-sent: #005c4b;
    --bubble-sent-solid: #005c4b;
    --bubble-received: #0a0a0a;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.9);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.9);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.9);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.9);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.9);
}

/* Accent Color Variants - Extended Palette */
[data-accent="ocean"] {
    --accent-primary: #0ea5e9;
    --accent-secondary: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 50%, #0284c7 100%);
    --accent-glow: 0 0 24px rgba(14, 165, 233, 0.3);
}

[data-accent="purple"] {
    --accent-primary: #a855f7;
    --accent-secondary: #c084fc;
    --accent-gradient: linear-gradient(135deg, #a855f7 0%, #c084fc 50%, #9333ea 100%);
    --accent-glow: 0 0 24px rgba(168, 85, 247, 0.3);
}

[data-accent="rose"] {
    --accent-primary: #f43f5e;
    --accent-secondary: #fb7185;
    --accent-gradient: linear-gradient(135deg, #f43f5e 0%, #fb7185 50%, #e11d48 100%);
    --accent-glow: 0 0 24px rgba(244, 63, 94, 0.3);
}