/* ═══════════════════════════════════════════════════════════
   🔊 ECHO MESSENGER — Ultimate CSS (Facebook+Twitter killer)
   ═══════════════════════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a1a;
    --bg2: #10102a;
    --bg3: #181838;
    --surface: rgba(255, 255, 255, 0.04);
    --surface2: rgba(255, 255, 255, 0.07);
    --surface3: rgba(255, 255, 255, 0.10);
    --border: rgba(255, 255, 255, 0.08);
    --border2: rgba(255, 255, 255, 0.14);
    --text: #f0f0f5;
    --text2: rgba(240, 240, 245, 0.65);
    --text3: rgba(240, 240, 245, 0.4);
    --accent: #667eea;
    --accent2: #764ba2;
    --accent3: #f093fb;
    --green: #10b981;
    --red: #ef4444;
    --orange: #f59e0b;
    --blue: #3b82f6;
    --pink: #ec4899;
    --sidebar-w: 380px;
    --header-h: 64px;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══════ ANIMATED BG ═══════ */
.echo-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 15% 50%, rgba(102, 126, 234, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 20%, rgba(118, 75, 162, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 85%, rgba(240, 147, 251, 0.03) 0%, transparent 50%),
        var(--bg);
}

/* ═══════ APP LAYOUT ═══════ */
.app {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ═══════ 3D / PREMIUM EFFECTS ═══════ */
.logo-icon {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3), 0 0 30px rgba(102, 126, 234, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: perspective(500px) rotateY(-5deg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-icon:hover {
    transform: perspective(500px) rotateY(5deg) scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5), 0 0 50px rgba(102, 126, 234, 0.2);
}

.msg.sent {
    box-shadow: 0 2px 15px rgba(102, 126, 234, 0.25), 0 0 40px rgba(102, 126, 234, 0.08);
}

.msg.sent:hover {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35), 0 0 60px rgba(102, 126, 234, 0.12);
    transform: translateY(-1px);
}

.msg.recv:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.msg {
    transition: all 0.2s ease;
}

/* (convo transition, hover, and active effects — now in PREMIUM FLOATING TILES section below) */

.send-btn {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4), 0 0 30px rgba(102, 126, 234, 0.15);
}

.send-btn:hover {
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5), 0 0 50px rgba(102, 126, 234, 0.2);
}

.post {
    transition: all 0.3s ease;
}

.post:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 40px rgba(102, 126, 234, 0.05);
}

.story .ring {
    transition: all 0.3s ease;
}

.story:hover .ring {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.story:hover .ring:not(.seen):not(.add) {
    box-shadow: 0 0 25px rgba(240, 147, 251, 0.4);
}

/* Neon glow on active elements */
.chat-btn:hover {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.chat-btn.video:hover {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* Animated gradient border on active convo */
.convo.active::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(240, 147, 251, 0.2), rgba(102, 126, 234, 0.4));
    background-size: 200% 200%;
    animation: borderGlow 3s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
}

@keyframes borderGlow {

    0%,
    100% {
        background-position: 0% 50%
    }

    50% {
        background-position: 100% 50%
    }
}

/* Glass shine effect on sidebar */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.03) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* Premium scrollbar glow */
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.15));
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.35), rgba(118, 75, 162, 0.25));
}

/* ═══════ APP LAYOUT ═══════ */
.app {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ═══════ SIDEBAR ═══════ */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 30, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-right: 1px solid var(--border);
}

.sidebar-top {
    padding: 16px 16px 0;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: var(--transition);
    position: relative;
}

.icon-btn:hover {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border2);
    transform: translateY(-1px);
}

.icon-btn .notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--bg);
}

/* Search */
.search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.search-wrap .s-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text3);
    font-size: 13px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
}

.search-input::placeholder {
    color: var(--text3);
}

.search-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.4);
    background: var(--surface2);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
}

/* ═══════ STORIES BAR ═══════ */
.stories-bar {
    padding: 0 16px 12px;
    flex-shrink: 0;
    overflow-x: auto;
    display: flex;
    gap: 12px;
    scrollbar-width: none;
}

.stories-bar::-webkit-scrollbar {
    display: none;
}

.story {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.story .ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--accent), var(--accent3), var(--pink));
}

.story .ring.seen {
    background: var(--border);
}

.story .ring.add {
    background: var(--surface2);
    border: 2px dashed var(--border2);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 22px;
}

.story .ring .img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 3px solid var(--bg);
}

.story .name {
    font-size: 10px;
    color: var(--text2);
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.story:hover .ring {
    transform: scale(1.05);
}

.story .ring,
.story .ring .img {
    transition: var(--transition);
}

/* ═══════ TABS ═══════ */
.tabs {
    display: flex;
    padding: 0 8px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    gap: 2px;
}

.tab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

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

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

.tab .badge {
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    background: var(--red);
    color: white;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    padding: 0 4px;
}

/* ═══════ CONVERSATIONS — PREMIUM FLOATING TILES ═══════ */
.convos {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
    position: relative;
}

/* ── Ambient floating particles in sidebar ── */
.convos::before,
.convos::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(40px);
    opacity: 0.4;
}

.convos::before {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15), transparent 70%);
    top: 10%;
    left: -20px;
    animation: ambientFloat1 8s ease-in-out infinite;
}

.convos::after {
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.12), transparent 70%);
    bottom: 20%;
    right: -30px;
    animation: ambientFloat2 10s ease-in-out infinite;
}

@keyframes ambientFloat1 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(15px, -10px) scale(1.1);
    }

    50% {
        transform: translate(-5px, 20px) scale(0.95);
    }

    75% {
        transform: translate(10px, 5px) scale(1.05);
    }
}

@keyframes ambientFloat2 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-15px, 10px) scale(1.08);
    }

    66% {
        transform: translate(10px, -15px) scale(0.97);
    }
}

/* ── Conversation tile ── */
.convo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    margin-bottom: 4px;
    z-index: 1;

    /* Glassmorphism */
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);

    /* Entrance animation — opacity:1 is the base so tiles never vanish */
    opacity: 1;
    animation: convoSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;

    /* Smooth transitions for hover/active (not 'all' to avoid conflicting with animation) */
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

/* Staggered entrance animation */
.convo:nth-child(1) {
    animation-delay: 0.02s;
}

.convo:nth-child(2) {
    animation-delay: 0.06s;
}

.convo:nth-child(3) {
    animation-delay: 0.10s;
}

.convo:nth-child(4) {
    animation-delay: 0.14s;
}

.convo:nth-child(5) {
    animation-delay: 0.18s;
}

.convo:nth-child(6) {
    animation-delay: 0.22s;
}

.convo:nth-child(7) {
    animation-delay: 0.26s;
}

.convo:nth-child(8) {
    animation-delay: 0.30s;
}

.convo:nth-child(9) {
    animation-delay: 0.34s;
}

.convo:nth-child(10) {
    animation-delay: 0.38s;
}

.convo:nth-child(n+11) {
    animation-delay: 0.40s;
}

@keyframes convoSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }

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

/* Float removed — JS _applyFloatEffect() handles 3D floating + mouse parallax */

/* ── Hover: premium glow (JS handles 3D transform) ── */
.convo:hover {
    background: rgba(102, 126, 234, 0.10);
    border-color: rgba(102, 126, 234, 0.25);
    box-shadow:
        0 8px 32px rgba(102, 126, 234, 0.18),
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(102, 126, 234, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── Active state: selected conversation glow ── */
.convo.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(118, 75, 162, 0.10));
    border-color: rgba(102, 126, 234, 0.30);
    box-shadow:
        0 6px 30px rgba(102, 126, 234, 0.22),
        0 0 40px rgba(102, 126, 234, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

/* ── Unread: pulsing glow ── */
.convo.unread {
    border-color: rgba(102, 126, 234, 0.2);
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.1);
}

.convo.unread .c-name {
    font-weight: 700;
}

.convo.unread .c-preview {
    color: var(--text);
    font-weight: 500;
}

/* Glowing unread badge */
.convo.unread .c-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(102, 126, 234, 0.4);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 14px rgba(102, 126, 234, 0.7), 0 0 30px rgba(102, 126, 234, 0.2);
        transform: scale(1.08);
    }
}

/* ── Avatar ── */
.convo .c-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.convo:hover .c-avatar {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

.convo .c-avatar .dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2.5px solid var(--bg);
    transition: all 0.3s ease;
}

.dot.on {
    background: var(--green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.dot.away {
    background: var(--orange);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.dot.off {
    background: rgba(255, 255, 255, 0.15);
}

/* Online dot pulse */
.dot.on {
    animation: onlinePulse 2.5s ease-in-out infinite;
}

@keyframes onlinePulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    }

    50% {
        box-shadow: 0 0 12px rgba(16, 185, 129, 0.7), 0 0 24px rgba(16, 185, 129, 0.2);
    }
}

.convo .c-info {
    flex: 1;
    min-width: 0;
}

.convo .c-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.convo .c-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.convo:hover .c-name {
    color: #fff;
}

.convo .c-time {
    font-size: 11px;
    color: var(--text3);
    flex-shrink: 0;
}

.convo .c-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3px;
}

.convo .c-preview {
    font-size: 12px;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    transition: color 0.2s ease;
}

.convo .c-badge {
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    flex-shrink: 0;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.convo .c-pin {
    color: var(--text3);
    font-size: 10px;
    margin-left: 4px;
}

/* ═══════ CHAT AREA ═══════ */
.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
}

#activeChat {
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.chat-header {
    height: var(--header-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 30, 0.7);
    backdrop-filter: blur(40px);
    flex-shrink: 0;
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-user .av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.chat-user .u-name {
    font-size: 15px;
    font-weight: 600;
}

.chat-user .u-status {
    font-size: 11px;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-user .u-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.chat-user .u-status.off {
    color: var(--text3);
}

.chat-user .u-status.away {
    color: var(--orange);
}

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

.chat-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    transition: var(--transition);
}

.chat-btn:hover {
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--accent);
    transform: translateY(-1px);
}

.chat-btn.video:hover {
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.msg-date {
    text-align: center;
    padding: 14px 0;
}

.msg-date span {
    font-size: 11px;
    color: var(--text3);
    background: var(--surface);
    padding: 4px 12px;
    border-radius: 20px;
}

.msg-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 6px;
}

.msg-group.sent {
    align-items: flex-end;
}

.msg-group.recv {
    align-items: flex-start;
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 70%;
}

.msg-row.sent {
    flex-direction: row-reverse;
}

.msg-row .av-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.msg {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.45;
    position: relative;
    animation: msgIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    to {
        opacity: 1;
        transform: none;
    }
}

.msg.sent {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border-bottom-right-radius: 4px;
}

.msg.recv {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.msg .sender {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 3px;
}

.msg .meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg.sent .meta {
    justify-content: flex-end;
}

.msg .check {
    font-size: 11px;
}

/* Reply quote */
.msg .reply-quote {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--accent3);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 6px;
    font-size: 12px;
    opacity: 0.85;
    cursor: pointer;
}

.msg.recv .reply-quote {
    background: rgba(255, 255, 255, 0.06);
}

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

.msg .reaction {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 3px;
}

.msg .reaction:hover {
    background: var(--surface3);
    transform: scale(1.1);
}

.msg .reaction .r-count {
    font-size: 10px;
    color: var(--text2);
}

.msg .reaction.mine {
    border-color: var(--accent);
    background: rgba(102, 126, 234, 0.15);
}

/* Image messages */
.msg .msg-img {
    max-width: 280px;
    border-radius: 12px;
    margin-top: 4px;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Voice message */
.msg .voice-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.msg .voice-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.msg .voice-play:hover {
    background: rgba(255, 255, 255, 0.25);
}

.msg .voice-wave {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.msg .voice-wave .bar {
    width: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.4);
    transition: height 0.1s;
}

.msg .voice-dur {
    font-size: 11px;
    opacity: 0.6;
}

/* Typing */
.typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    color: var(--text2);
}

.typing .dots {
    display: flex;
    gap: 3px;
}

.typing .dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    animation: dot 1.4s infinite;
}

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

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

@keyframes dot {

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

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* ═══════ INPUT AREA ═══════ */
.input-area {
    padding: 10px 20px 14px;
    border-top: 1px solid var(--border);
    background: rgba(10, 10, 30, 0.7);
    backdrop-filter: blur(40px);
    flex-shrink: 0;
}

/* Reply preview */
.reply-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--accent);
}

.reply-bar.active {
    display: flex;
}

.reply-bar .r-info {
    flex: 1;
}

.reply-bar .r-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}

.reply-bar .r-text {
    font-size: 12px;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-bar .r-close {
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.input-btns {
    display: flex;
    gap: 2px;
}

.in-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    transition: var(--transition);
}

.in-btn:hover {
    color: var(--accent);
    background: rgba(102, 126, 234, 0.1);
}

.in-btn.recording {
    color: var(--red);
    animation: pulse 1s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.input-wrap {
    flex: 1;
    position: relative;
}

.msg-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: var(--transition);
}

.msg-input::placeholder {
    color: var(--text3);
}

.msg-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.4);
    background: var(--surface2);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.4);
}

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

/* ═══════ EMOJI PICKER ═══════ */
.emoji-picker {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 320px;
    max-height: 340px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 100;
    margin-bottom: 8px;
}

.emoji-picker.active {
    display: block;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.emoji-picker .ep-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.emoji-picker .ep-cat {
    padding: 4px 8px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.emoji-picker .ep-cat:hover,
.emoji-picker .ep-cat.active {
    background: var(--surface2);
    color: var(--text);
}

.emoji-picker .ep-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.emoji-picker .ep-grid span {
    padding: 6px;
    text-align: center;
    font-size: 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.emoji-picker .ep-grid span:hover {
    background: var(--surface2);
    transform: scale(1.2);
}

/* ═══════ FEED (Twitter-style) ═══════ */
.feed {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: none;
}

.feed.active {
    display: block;
}

.post-composer {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.post-composer .pc-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.post-composer .pc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.post-composer textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 60px;
}

.post-composer textarea::placeholder {
    color: var(--text3);
}

.post-composer textarea:focus {
    outline: none;
}

.post-composer .pc-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.post-composer .pc-media {
    display: flex;
    gap: 4px;
}

.post-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.post-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.post {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: var(--transition);
}

.post:hover {
    border-color: var(--border2);
}

.post .p-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 0;
}

.post .p-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.post .p-name {
    font-size: 14px;
    font-weight: 600;
}

.post .p-handle {
    font-size: 12px;
    color: var(--text3);
}

.post .p-time {
    font-size: 11px;
    color: var(--text3);
    margin-left: auto;
}

.post .p-body {
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.post .p-media {
    padding: 0 16px 12px;
}

.post .p-media img {
    width: 100%;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.post .p-media img:hover {
    transform: scale(1.01);
}

.post .p-actions {
    display: flex;
    padding: 8px 16px 12px;
    gap: 4px;
    border-top: 1px solid var(--border);
}

.post .p-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.post .p-action:hover {
    background: var(--surface2);
}

.post .p-action.liked {
    color: var(--red);
}

.post .p-action.shared {
    color: var(--green);
}

/* ═══════ FRIENDS LIST ═══════ */
.friends-panel {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.friends-panel.active {
    display: flex;
}

.friend-req {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.friend-req .fr-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.friend-req .fr-info {
    flex: 1;
}

.friend-req .fr-name {
    font-size: 13px;
    font-weight: 600;
}

.friend-req .fr-mutual {
    font-size: 11px;
    color: var(--text3);
}

.friend-req .fr-btns {
    display: flex;
    gap: 4px;
}

.fr-btn {
    padding: 5px 12px;
    border-radius: 8px;
    border: none;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.fr-btn.accept {
    background: var(--accent);
    color: white;
}

.fr-btn.accept:hover {
    background: #5570d8;
}

.fr-btn.decline {
    background: var(--surface2);
    color: var(--text2);
}

.fr-btn.decline:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

/* ═══════ NOTIFS ═══════ */
.notifs-panel {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.notifs-panel.active {
    display: flex;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.notif-item:hover {
    background: var(--surface2);
}

.notif-item.unread {
    background: rgba(102, 126, 234, 0.06);
}

.notif-item .n-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notif-item .n-text {
    flex: 1;
    font-size: 12px;
    line-height: 1.4;
}

.notif-item .n-text b {
    font-weight: 600;
}

.notif-item .n-time {
    font-size: 10px;
    color: var(--text3);
    flex-shrink: 0;
}

/* ═══════ EMPTY STATE ═══════ */
.empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text2);
}

.empty .e-icon {
    width: 90px;
    height: 90px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
}

.empty h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.empty p {
    font-size: 13px;
    max-width: 280px;
    text-align: center;
    line-height: 1.5;
}

/* ═══════ CALL OVERLAY ═══════ */
.call-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.call-overlay.active {
    display: flex;
}

.call-main {
    width: 80%;
    max-width: 860px;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

.call-main .placeholder {
    font-size: 72px;
}

.call-self {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 160px;
    aspect-ratio: 16/9;
    border-radius: 10px;
    background: #222;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    overflow: hidden;
}

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

.call-controls {
    display: flex;
    gap: 14px;
    margin-top: 20px;
}

.call-ctrl {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: white;
    transition: var(--transition);
}

.call-ctrl.mic,
.call-ctrl.cam,
.call-ctrl.share {
    background: rgba(255, 255, 255, 0.12);
}

.call-ctrl.hangup {
    background: var(--red);
}

.call-ctrl:hover {
    transform: scale(1.1);
}

.call-ctrl.hangup:hover {
    background: #dc2626;
}

.call-ctrl.off {
    background: rgba(239, 68, 68, 0.25);
}

.call-info {
    text-align: center;
    margin-top: 14px;
}

.call-timer {
    font-size: 18px;
    font-weight: 600;
    color: white;
    font-variant-numeric: tabular-nums;
}

.call-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* ═══════ RIGHT PANEL (Profile/Info) ═══════ */
.right-panel {
    width: 0;
    overflow: hidden;
    border-left: 1px solid transparent;
    background: rgba(10, 10, 30, 0.85);
    backdrop-filter: blur(40px);
    transition: width 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.right-panel.open {
    width: 300px;
    border-color: var(--border);
}

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

.rp-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.rp-profile {
    padding: 24px 16px;
    text-align: center;
}

.rp-profile .rp-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.rp-profile .rp-name {
    font-size: 18px;
    font-weight: 700;
}

.rp-profile .rp-bio {
    font-size: 12px;
    color: var(--text2);
    margin-top: 4px;
}

.rp-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 12px 16px;
}

.rp-stat {
    text-align: center;
}

.rp-stat .val {
    font-size: 16px;
    font-weight: 700;
}

.rp-stat .lbl {
    font-size: 10px;
    color: var(--text3);
}

.rp-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px;
}

.rp-btn {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.rp-btn:hover {
    background: var(--surface2);
    border-color: var(--border2);
}

.rp-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.rp-section {
    padding: 12px 16px;
}

.rp-section h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.rp-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.rp-media-grid div {
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.rp-media-grid div:hover {
    background: var(--surface3);
    transform: scale(1.05);
}

/* ═══════ CONTEXT MENU ═══════ */
.ctx-menu {
    display: none;
    position: fixed;
    min-width: 180px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 200;
    overflow: hidden;
}

.ctx-menu.active {
    display: block;
    animation: slideUp 0.15s ease;
}

.ctx-item {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.ctx-item:hover {
    background: var(--surface2);
}

.ctx-item.danger {
    color: var(--red);
}

.ctx-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ═══════ SCROLLBAR ═══════ */
::-webkit-scrollbar {
    width: 5px;
}

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

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

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

/* ═══════ UTILITY ═══════ */
.hidden {
    display: none !important;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ═══════ AUTH SCREEN ═══════ */
.auth-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, rgba(102, 126, 234, 0.08) 0%, transparent 60%);
}

.auth-card {
    background: rgba(20, 20, 50, 0.8);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border2);
    border-radius: 24px;
    padding: 40px;
    width: 380px;
    text-align: center;
    pointer-events: auto;
    -webkit-app-region: no-drag;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 80px rgba(102, 126, 234, 0.06);
    animation: authIn 0.5s ease;
}

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

    to {
        opacity: 1;
        transform: none;
    }
}

.auth-logo {
    font-size: 48px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 15px rgba(102, 126, 234, 0.4));
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 10px;
    transition: var(--transition);
}

.auth-input::placeholder {
    color: var(--text3);
}

.auth-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 0 20px rgba(102, 126, 234, 0.05);
}

.auth-btns {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.auth-btn {
    flex: 1;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.auth-btn:hover {
    background: var(--surface3);
    transform: translateY(-1px);
}

.auth-btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.auth-btn.primary:hover {
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.auth-error {
    display: none;
    color: var(--red);
    font-size: 12px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}