/* ============================================
   ZipChats.online — Discord-Style Dark Theme
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Backgrounds - Deep Discord-like tones */
    --bg-primary: #0b0f14;
    --bg-secondary: #111820;
    --bg-tertiary: #182028;
    --bg-card: #1c2530;
    --bg-glass: rgba(17, 24, 32, 0.95);
    --bg-input: rgba(0, 0, 0, 0.3);
    --bg-hover: rgba(255, 255, 255, 0.04);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-active: rgba(99, 102, 241, 0.3);

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #8892a4;
    --text-muted: #5a6577;

    /* Accents */
    --accent: #059669;
    --accent-glow: rgba(5, 150, 105, 0.12);
    --accent-hover: #047857;

    /* Gender Colors */
    --male-color: #60a5fa;
    --male-bg: rgba(59, 130, 246, 0.1);
    --female-color: #f472b6;
    --female-bg: rgba(236, 72, 153, 0.1);

    /* Status Colors */
    --online-color: #22c55e;
    --offline-color: #6b7280;
    --unread-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;

    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.15);

    /* Layout */
    --sidebar-width: 360px;

    /* Fonts */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-brand: 'Inter', system-ui, sans-serif;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
    --bg-primary: #faf6f0;
    --bg-secondary: #fef9f2;
    --bg-tertiary: #f3ece2;
    --bg-card: #fffcf7;
    --bg-glass: rgba(250, 246, 240, 0.95);
    --bg-input: rgba(0, 0, 0, 0.04);
    --bg-hover: rgba(0, 0, 0, 0.03);
    --border-subtle: rgba(160, 130, 90, 0.12);
    --border-active: rgba(5, 150, 105, 0.3);
    --text-primary: #1a1408;
    --text-secondary: #6b5b4a;
    --text-muted: #a09080;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .theme-toggle-btn,
[data-theme="light"] .header-icon-btn {
    background: #f3ece2;
    border-color: rgba(160, 130, 90, 0.15);
}

[data-theme="light"] .header-icon-btn:hover {
    background: #eae0d0;
}

[data-theme="light"] .nav-bar {
    background: #fef9f2;
    border-color: #e8dcc8;
}

[data-theme="light"] .nav-btn {
    background: #fffcf7;
    color: #6b5b4a;
}

[data-theme="light"] .nav-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

[data-theme="light"] .auth-box {
    background: #fffcf7;
    border-color: #e8dcc8;
}

[data-theme="light"] .user-card {
    background: #fffcf7;
    border-color: #e8dcc8;
}

[data-theme="light"] .user-card:hover {
    background: #f5efe5;
}

[data-theme="light"] .filter-btn {
    background: #f3ece2;
    border-color: #e8dcc8;
    color: #6b5b4a;
}

[data-theme="light"] .filter-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

[data-theme="light"] .sub-header {
    color: #6b5b4a;
    border-color: #e8dcc8;
}

[data-theme="light"] .msg-bubble.sent {
    background: var(--accent);
}

[data-theme="light"] .msg-bubble.received {
    background: #fffcf7;
    color: #1a1408;
    border: 1px solid #e8dcc8;
}

[data-theme="light"] .chat-input-bar {
    background: #fef9f2;
    border-color: #e8dcc8;
}

[data-theme="light"] .chat-input {
    background: #f3ece2;
    color: #1a1408;
}

[data-theme="light"] .chat-messages {
    background: #faf6f0 url('pattern-light.svg') repeat;
    background-size: 300px 300px;
}

/* ---------- Global Reset ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (min-width: 769px) {
    ::-webkit-scrollbar {
        width: 8px;
    }
}

/* ---------- View Management ---------- */
.view {
    display: none;
}

.view.active {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
}

/* ============================================
   LANDING PAGE
   ============================================ */
/* Background Decor Elements */
.landing-bg-shape {
    position: absolute;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
}

.bg-shape-1 {
    width: 400px;
    height: 400px;
    background: rgba(5, 150, 105, 0.15);
    top: -100px;
    left: -100px;
}

.bg-shape-2 {
    width: 300px;
    height: 300px;
    background: rgba(99, 102, 241, 0.1);
    bottom: -50px;
    right: -50px;
}

.bg-shape-3 {
    width: 250px;
    height: 250px;
    background: rgba(236, 72, 153, 0.1);
    top: 30%;
    right: 10%;
}

.landing-scroll-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.landing-container {
    text-align: center;
    max-width: 420px;
    width: 100%;
    animation: fadeIn 0.5s ease;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.landing-header {
    margin-bottom: 24px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    font-family: var(--font-brand);
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-shadow: 0 0 30px rgba(5, 150, 105, 0.2);
}

.logo .dot {
    color: var(--accent);
    font-size: 3.2rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* Auth Box */
.auth-box {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Auth Forms */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.auth-form.active {
    display: flex;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="number"],
.auth-form select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.auth-form input:focus,
.auth-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-form input::placeholder {
    color: var(--text-muted);
}

/* Gender Selector */
.gender-selector {
    display: flex;
    gap: 10px;
}

.gender-option {
    flex: 1;
    cursor: pointer;
}

.gender-option input {
    display: none;
}

.gender-btn {
    display: block;
    text-align: center;
    padding: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    color: var(--text-secondary);
}

.gender-option input:checked+.gender-btn.male {
    background: var(--male-bg);
    color: var(--male-color);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.gender-option input:checked+.gender-btn.female {
    background: var(--female-bg);
    color: var(--female-color);
    border-color: rgba(236, 72, 153, 0.3);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.15);
}

.gender-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Inline Fields */
.inline-fields {
    display: flex;
    gap: 10px;
}

.field-half {
    flex: 1;
}

/* Avatar Grid */
.avatar-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.avatar-option {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.avatar-option:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

.avatar-option.selected {
    border-color: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
    transform: scale(1.1);
}

/* CTA Button */
.cta-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent), #059669);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    border: none;
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.3);
}

.cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.4);
}

.cta-btn:active {
    transform: translateY(0);
}

/* New More Options toggle */
.more-opts-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
    text-align: left;
    transition: color 0.15s ease;
    margin-bottom: 12px;
}

.more-opts-btn:hover {
    color: var(--accent);
}

.more-opts-panel {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MAIN CONTAINER (Split Layout)
   ============================================ */
#main-container {
    display: none;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* App Header */
.app-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.logo-small {
    font-family: var(--font-brand);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    padding: 6px 10px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    letter-spacing: 2px;
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--online-color);
    border-radius: var(--radius-full);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.header-icon-btn svg {
    display: block;
}

.header-icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.user-profile-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--accent-glow);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.user-profile-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    gap: 2px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.7rem;
    position: relative;
}

.nav-btn .nav-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.nav-icon-svg {
    display: block;
    flex-shrink: 0;
}

.nav-btn .nav-label {
    font-weight: 500;
}

.nav-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-btn:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* Inbox Badge */
.inbox-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--unread-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-tertiary);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s infinite;
}

.inbox-badge.visible {
    display: flex;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Sub Header */
.sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sub-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-group {
    display: flex;
    gap: 4px;
}

.filter-btn {
    padding: 5px 12px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: rgba(5, 150, 105, 0.3);
}

.filter-btn:hover:not(.active) {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    display: none;
}

.sidebar-section.active {
    display: block;
}

/* ============================================
   USER GRID
   ============================================ */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px;
}

.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    text-align: center;
    position: relative;
}

.user-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
    box-shadow: var(--shadow-md);
}

.user-card.male:hover {
    border-color: rgba(59, 130, 246, 0.3);
}

.user-card.female:hover {
    border-color: rgba(236, 72, 153, 0.3);
}

.user-card-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}

.user-card-avatar {
    font-size: 2rem;
    display: block;
}

.user-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.user-card-meta.typing {
    color: var(--accent);
    font-style: italic;
}

.same-state-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 4px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    vertical-align: middle;
}

/* User Card Animations & Layout Toggle */
.card-enter {
    animation: cardIn 200ms ease forwards;
}

.card-leave {
    animation: cardOut 200ms ease forwards;
    pointer-events: none;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes cardOut {
    to {
        opacity: 0;
        transform: scale(0.92);
    }
}

.layout-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    margin-right: 8px;
    transition: color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-toggle-btn:hover {
    color: var(--text-main);
}

.user-grid.list-mode {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
}

.user-grid.list-mode .user-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    border-radius: var(--radius-sm);
    text-align: left;
    min-height: unset;
}

.user-grid.list-mode .user-card-avatar {
    font-size: 1.2rem;
}

.user-grid.list-mode .user-card-name {
    font-size: 0.88rem;
}

.user-grid.list-mode .user-card-meta {
    font-size: 0.72rem;
}

/* Filter Select */
.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
}

/* ============================================
   PRESENCE DOTS
   ============================================ */
.presence-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
    flex-shrink: 0;
}

.presence-dot.online {
    background: var(--online-color);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    animation: presencePulse 2s infinite;
}

.presence-dot.offline {
    background: var(--offline-color);
}

/* Presence dot on avatar (positioned) */
.user-card-avatar-wrap .presence-dot,
.friend-avatar-wrap .presence-dot,
.history-avatar-wrap .presence-dot,
.inbox-avatar-wrap .presence-dot {
    position: absolute;
    bottom: 0;
    right: -2px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--bg-card);
}

@keyframes presencePulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    }

    50% {
        box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
    }
}

/* ============================================
   UNREAD BADGE
   ============================================ */
.unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--unread-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.user-card-avatar-wrap .unread-badge {
    position: absolute;
    top: -5px;
    right: -8px;
}

/* ============================================
   FRIENDS / HISTORY / INBOX LISTS
   ============================================ */
.friend-card,
.history-item,
.inbox-item,
.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-subtle);
}

.friend-card:hover,
.history-item:hover,
.inbox-item:hover,
.search-result:hover {
    background: var(--bg-hover);
}

.friend-avatar-wrap,
.history-avatar-wrap,
.inbox-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.friend-avatar,
.history-avatar,
.inbox-avatar,
.search-avatar {
    font-size: 1.6rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-full);
}

.friend-info,
.history-info,
.inbox-info,
.search-info {
    flex: 1;
    min-width: 0;
}

.friend-name,
.history-name,
.inbox-name,
.search-name {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-meta,
.history-meta,
.inbox-preview,
.search-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.inbox-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.inbox-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Search Box */
.search-box {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.search-box input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-main);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-go-btn {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   CHAT PANEL
   ============================================ */
#chat-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

#chat-panel.active {
    display: flex;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-avatar {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-full);
}

.chat-header-text {
    display: flex;
    flex-direction: column;
}

.chat-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.partner-status {
    font-size: 0.75rem;
    font-weight: 500;
}

.partner-status.online {
    color: var(--online-color);
}

.partner-status.offline {
    color: var(--text-muted);
}

/* Chat Menu */
.chat-menu-wrap {
    position: relative;
}

.chat-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 100;
    min-width: 160px;
}

.chat-menu-dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    font-family: var(--font-main);
    transition: background 0.15s ease;
}

.chat-menu-dropdown button svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.chat-menu-dropdown button:hover {
    background: var(--bg-hover);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-primary) url('pattern-dark.svg') repeat;
    background-size: 300px 300px;
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Message Bubbles */
.msg-wrap {
    display: flex;
    max-width: 75%;
}

.msg-wrap.sent {
    align-self: flex-end;
}

.msg-wrap.received {
    align-self: flex-start;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    max-width: 100%;
    word-wrap: break-word;
    position: relative;
}

.msg-bubble.sent {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: var(--radius-xs);
}

.msg-bubble.received {
    background: var(--bg-card);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-xs);
}

.msg-text {
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.msg-image {
    max-width: 260px;
    max-height: 300px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.msg-image:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

/* Image Skeleton */
.msg-image-wrap {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-width: 120px;
    min-height: 80px;
}

.msg-image-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.04) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.msg-image-wrap.loaded::before {
    display: none;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.msg-time {
    display: block;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    text-align: right;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.msg-wrap:hover .msg-time {
    opacity: 1;
}

.msg-bubble.received .msg-time {
    color: var(--text-muted);
}

.msg-status {
    font-size: 0.7rem;
    margin-left: 2px;
}

.msg-status.sending {
    opacity: 0.5;
}

.msg-status.sent {
    opacity: 0.7;
}

.msg-status.read {
    color: #60d4f7;
    opacity: 1;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    align-self: flex-start;
    max-width: 200px;
    animation: fadeIn 0.3s ease;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.typing-indicator.fade-out {
    opacity: 0;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.typing-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    position: relative;
}

.upload-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.upload-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.emoji-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.emoji-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.chat-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chat-input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.15s ease;
    resize: none;
    overflow-y: auto;
    max-height: 100px;
    min-height: 40px;
    line-height: 1.4;
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.char-ring {
    display: none;
    width: 24px;
    height: 24px;
    position: relative;
    flex-shrink: 0;
    margin-bottom: 8px;
}

.char-ring.visible {
    display: block;
}

.char-ring svg {
    transform: rotate(-90deg);
}

.char-ring circle {
    fill: none;
    stroke-width: 3;
    stroke: var(--accent);
    stroke-dasharray: 69.1;
    transition: stroke-dashoffset 0.2s ease, stroke 0.2s;
}

.char-ring.warn circle {
    stroke: var(--warning-color);
}

.char-ring.danger circle {
    stroke: var(--unread-color);
}

.send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.send-icon {
    color: #fff;
    font-size: 1.1rem;
}

/* ============================================
   IMAGE PREVIEW MODAL
   ============================================ */
.image-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.image-preview-modal.visible {
    display: flex;
}

.preview-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.preview-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image-wrap {
    flex: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 60vh;
}

.preview-image-wrap img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

.preview-cancel {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.9rem;
}

.preview-send {
    padding: 10px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.preview-send:hover {
    background: var(--accent-hover);
}

/* Fullscreen Image Modal */
.fullscreen-image-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    cursor: pointer;
}

.fullscreen-image-modal.visible {
    display: flex;
}

.fullscreen-image-modal img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#notification-area {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    pointer-events: all;
    backdrop-filter: blur(12px);
}

.toast-info {
    border-left: 3px solid var(--accent);
}

.toast-success {
    border-left: 3px solid var(--success-color);
}

.toast-error {
    border-left: 3px solid var(--unread-color);
}

.toast-message {
    border-left: 3px solid var(--male-color);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.toast-icon svg {
    display: block;
}

.toast-msg {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Fix: toast-message class used for both the type and the span */
.toast .toast-msg {
    border: none;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 4px;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-exit {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    #main-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 100%;
    }

    #chat-panel {
        position: fixed;
        inset: 0;
        z-index: 500;
    }

    #chat-panel.active {
        display: flex;
    }

    .user-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    .user-card {
        padding: 10px 8px;
    }

    .user-card-avatar {
        font-size: 1.6rem;
    }

    .user-card-name {
        font-size: 0.8rem;
    }

    .nav-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 400;
        background: var(--bg-tertiary);
        border-top: 1px solid var(--border-subtle);
        border-bottom: none;
        padding: 6px 8px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar-content {
        padding-bottom: 70px;
        /* Space for bottom nav */
    }

    .back-btn {
        display: flex !important;
    }

    .auth-box {
        padding: 20px;
    }

    .logo {
        font-size: 2rem;
    }

    #notification-area {
        top: 8px;
        right: 8px;
        left: 8px;
        max-width: 100%;
    }

    .msg-wrap {
        max-width: 85%;
    }

    .msg-image {
        max-width: 200px;
    }
}

@media (min-width: 769px) {
    #main-container {
        flex-direction: row;
    }

    #sidebar {
        max-width: var(--sidebar-width);
        min-width: 300px;
    }

    .back-btn {
        display: none !important;
    }

    .back-home-btn {
        display: none !important;
    }

    #chat-panel {
        display: flex;
    }
}

/* ============================================
   ADMIN STYLES (imported separately for admin.html)
   ============================================ */

/* ============================================
   RECONNECTION BANNER
   ============================================ */
.reconnect-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--unread-color);
    font-size: 0.85rem;
    font-weight: 500;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}

.reconnect-banner a {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.reconnect-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-top-color: var(--unread-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   SCROLL-TO-BOTTOM BUTTON
   ============================================ */
.scroll-bottom-btn {
    position: absolute;
    bottom: 80px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 10;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    animation: fadeIn 0.2s ease;
}

.scroll-bottom-btn:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.1);
}

/* ============================================
   EMOJI PICKER
   ============================================ */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 50px;
    width: 320px;
    max-height: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: none;
    overflow-y: auto;
    z-index: 200;
    flex-wrap: wrap;
    gap: 2px;
    animation: fadeIn 0.15s ease;
}

.emoji-picker.visible {
    display: flex;
}

.emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all 0.15s ease;
}

.emoji-item:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* ============================================
   SYSTEM MESSAGES
   ============================================ */
.msg-wrap.system {
    align-self: center;
    max-width: 90%;
}

.system-msg {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

/* ============================================
   ANONYMOUS USER BADGE
   ============================================ */
.anon-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    padding: 1px 4px;
    vertical-align: middle;
    margin-left: 2px;
}

/* ============================================
   GENDER BREAKDOWN
   ============================================ */
.gender-breakdown {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 4px;
}

/* ============================================
   MESSAGE LINKS
   ============================================ */
.msg-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.4);
    text-underline-offset: 2px;
    word-break: break-all;
}

.msg-link:hover {
    text-decoration-color: inherit;
}

.msg-bubble.received .msg-link {
    text-decoration-color: var(--accent);
    color: var(--accent);
}

/* ============================================
   KEYBOARD FOCUS STYLES
   ============================================ */
.user-card:focus-visible,
.nav-btn:focus-visible,
.header-icon-btn:focus-visible,
.filter-btn:focus-visible,
.cta-btn:focus-visible,
.send-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================
   PREFERS-COLOR-SCHEME (OS auto-detect fallback)
   ============================================ */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg-primary: #faf6f0;
        --bg-secondary: #fef9f2;
        --bg-tertiary: #f3ece2;
        --bg-card: #fffcf7;
        --bg-glass: rgba(250, 246, 240, 0.95);
        --bg-input: rgba(0, 0, 0, 0.04);
        --text-primary: #1a1410;
        --text-secondary: #4a3f32;
        --text-muted: #8b7e6e;
        --border-subtle: rgba(0, 0, 0, 0.08);
        --bg-hover: rgba(0, 0, 0, 0.04);
    }
}

/* ------- Utility ------- */
.hidden {
    display: none !important;
}

.char-counter {
    display: none !important;
}

/* ============================================
   NEW PERFORMANCE / UI OVERHAUL CLASSES 
   ============================================ */

/* Sent Message Timestamps */
.msg-time {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.msg-wrap:hover .msg-time {
    opacity: 1;
}

@media (max-width: 768px) {
    .msg-time {
        opacity: 1;
    }
}

/* User Card Enter/Leave */
@keyframes cardIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes cardOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.card-enter {
    animation: cardIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.card-leave {
    animation: cardOut 0.2s ease forwards;
    pointer-events: none;
}

/* Shimmer Image Loading */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.msg-image-wrap {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    min-height: 150px;
    min-width: 200px;
}

.msg-image-wrap.loaded {
    animation: none;
    background: none;
    min-height: auto;
    min-width: auto;
}

.msg-image-wrap img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.msg-image-wrap.loaded img {
    opacity: 1;
}

/* List Mode */
.user-grid.list-mode {
    display: flex;
    flex-direction: column;
}

.user-grid.list-mode .user-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
    text-align: left;
}

.user-grid.list-mode .user-card-avatar-wrap {
    margin: 0;
    width: 40px;
    height: 40px;
}

.user-grid.list-mode .user-card-avatar {
    font-size: 1.5rem;
}

.user-grid.list-mode .user-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-grid.list-mode .user-card-name {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.user-grid.list-mode .user-card-meta {
    font-size: 0.75rem;
}

/* Char Ring */
.char-ring {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    width: 24px;
    height: 24px;
    display: none;
    pointer-events: none;
}

.char-ring.visible {
    display: block;
}

.char-ring circle {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 69.1;
    stroke-dashoffset: 69.1;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}

.char-ring.warn circle {
    stroke: var(--warning-color);
}

.char-ring.danger circle {
    stroke: var(--unread-color);
}

/* Send Btn active animation */
.send-btn:active {
    transform: scale(0.9);
}

/* ============================================
   LANDING PAGE FEATURES & FOOTER
   ============================================ */
.landing-features {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
    max-width: 900px;
    z-index: 10;
}

.feature-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    flex: 1 1 250px;
    min-width: 250px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.landing-footer {
    margin-top: 60px;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 900px;
    z-index: 10;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 768px) {
    /* Adjust Landing Page Scaling */
    .landing-scroll-wrapper {
        padding: 20px 10px;
    }
    
    .logo {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }
    
    .logo .dot {
        font-size: 2.4rem;
    }
    
    .tagline {
        font-size: 0.85rem;
        margin-bottom: 24px;
    }

    .auth-box {
        padding: 20px;
        margin: 0 10px;
        width: auto;
    }

    .landing-features {
        margin-top: 30px;
        flex-direction: column;
        gap: 15px;
        padding: 0 10px;
    }

    .feature-card {
        flex: 1 1 100%;
        min-width: unset;
        padding: 20px;
    }

    /* Adjust Chat Interface Layout */
    #sidebar {
        width: 100%;
    }

    #chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh; /* Important for iOS Safari */
        z-index: 1000;
        transform: translateX(100%);
    }

    #chat-panel.active {
        transform: translateX(0);
    }

    /* Make Input Bar stick above mobile keyboard */
    .chat-input-bar {
        padding: 10px;
        padding-bottom: env(safe-area-inset-bottom, 10px);
    }

    /* Avatar Grid resize for smaller thumbs */
    .avatar-grid {
        justify-content: center;
    }
    
    .avatar-option {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
}