/* ===== AURA MESSENGER CSS ===== */
* {margin:0;padding:0;box-sizing:border-box;}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0c0c1a;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================ */
/* Auth pages */
/* ============================================================ */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: #12121f;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Auth logo - separate from sidebar logo */
.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}
.auth-logo img {
    width: 160px;
    display: block;
    margin: 0 auto;
}

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: #0c0c1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #ccc;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: rgba(102,126,234,0.4); }
.form-group textarea { resize: vertical; min-height: 70px; }

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #282828;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
    letter-spacing: 0.5px;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); background: linear-gradient(135deg, #001574, #5700b1); }

.error {
    background: rgba(244,67,54,0.1);
    color: #ff8a80;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(244,67,54,0.15);
    display: none;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: #555;
}
.auth-footer a { color: #667eea; text-decoration: none; font-weight: 600; }
.auth-footer a:hover { color: #8a9ef5; }

/* ============================================================ */
/* App layout */
/* ============================================================ */
.app-container { display: flex; height: 100vh; width: 100vw; }

/* ============================================================ */
/* Burger button */
/* ============================================================ */
.burger-btn {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 1100;
    background: #1e1e2e;
    border: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ============================================================ */
/* Sidebar */
/* ============================================================ */
.sidebar {
    width: 300px;
    background: #101010;
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    flex-shrink: 0;
}

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

/* Sidebar logo - completely separate from auth logo */
.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-header .logo img {
    height: 32px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(102,126,234,0.3));
    margin-left: -1pc;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #f06292);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    line-height: 1;
}

.logo-sub {
    font-size: 9px;
    color: #555;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1;
}

.menu-trigger {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    /* background: #1a1a2e; */
    border: 1px solid rgb(0 0 0 / 8%);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    background: #101010;
    margin-left: -18pc;
}
.menu-trigger:hover { background: #242424; color: #dbdbdb; }

.search-box { position: relative; }
.search-box input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    background: #101010;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #ccc;
    font-size: 13px;
    outline: none;
    transition: all 0.3s;
}
.search-box input:focus { border-color: rgba(102,126,234,0.4); background: #1e1e35; }
.search-box i {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: #555; font-size: 13px;
}
.search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #1a1a2e;
    border: 1px solid rgba(102,126,234,0.3);
    border-radius: 10px;
    margin-top: 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.search-results.active { display: block; }
.search-section {padding: 8px 12px;font-size: 11px;text-transform: uppercase;color: #ffffff;font-weight: 700;letter-spacing: 1px;}
.search-item {
    padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px;
    transition: background 0.2s; font-size: 13px;
}
.search-item:hover { background: rgba(102,126,234,0.1); }

.sidebar-scrollable { flex: 1; overflow-y: auto; min-height: 0; }

.showcase-block {
    margin: 0 16px 10px;
    padding: 14px;
    background: #101010;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    flex-shrink: 0;
}
.showcase-profile { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.showcase-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #0c0c1a; border: 2px solid rgba(102,126,234,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.showcase-avatar img { width: 100%; height: 100%; object-fit: cover; }
.showcase-name { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.showcase-status { font-size: 10px; color: #555; text-transform: lowercase; letter-spacing: 0.5px; }
.showcase-text { font-size: 12px; color: #777; line-height: 1.4; margin-bottom: 10px; }
.showcase-edit-btn {
    width: 100%; padding: 8px; background: #2a2a3e; border: none; border-radius: 8px;
    color: #aaa; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; letter-spacing: 0.5px;
}
.showcase-edit-btn:hover { background: #33334d; color: #fff; }

.tabs-row { display: flex; gap: 6px; padding: 0 16px 10px; flex-shrink: 0; }
.tab-chip {
    padding: 5px 10px; border-radius: 16px; font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; border: none; letter-spacing: 0.3px;
}
.tab-chip.active {        background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgb(35 35 35 / 15%));
        border-color: rgba(102, 126, 234, 0.2);
        color: #ffffff; }
.tab-chip:not(.active) { background: transparent; color: #666; }
.tab-chip:not(.active):hover { color: #999; background: rgba(255,255,255,0.03); }

.chats-list { padding: 0 16px; min-height: 0; }
.chat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    transition: all 0.2s; margin-bottom: 3px; background: transparent;
}
.chat-item:hover, .chat-item.active { background: rgba(102,126,234,0.1); }
.chat-avatar {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.08); box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-info { flex: 1; min-width: 0; }
.chat-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ccc; }
.chat-preview { font-size: 11px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.categories-section { padding: 4px 16px; margin-top: 8px; }
.section-title {
    font-size: 11px; font-weight: 700; color: #555; letter-spacing: 1.5px;
    padding: 8px 4px 6px; text-transform: uppercase;
}
.users-list-sidebar { display: flex; flex-direction: column; gap: 2px; }
.user-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 8px; cursor: pointer;
    transition: all 0.2s; font-size: 12px; color: #888;
}
.user-row:hover { background: rgba(102,126,234,0.08); color: #ccc; }
.user-row-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; flex-shrink: 0; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1); box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.user-row-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

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

.sidebar-footer {
    padding: 10px 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.04);
    flex-shrink: 0;
}
.footer-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; background: #1a1a2e; border-radius: 10px; margin-bottom: 8px;
}
.footer-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: #0c0c1a;
    border: 2px solid rgba(102,126,234,0.25); display: flex; align-items: center; justify-content: center;
    font-size: 14px; overflow: hidden; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.footer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.footer-email { font-size: 12px; color: #888; font-weight: 500; flex: 1; }
.footer-settings {
    width: 28px; height: 28px; border-radius: 8px; background: transparent; border: none;
    color: #cbcbcb; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.footer-settings:hover { background: rgba(102,126,234,0.15); }
.footer-logout {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; color: #c0392b; text-decoration: none;
    font-size: 12px; font-weight: 600; border-radius: 8px; transition: background 0.2s;
}
.footer-logout:hover { background: rgba(192,57,43,0.1); }

/* ============================================================ */
/* Sidebar backdrop */
/* ============================================================ */
.sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
    display: none; opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.active { display: block; opacity: 1; }

/* ============================================================ */
/* Main Menu */
/* ============================================================ */
.menu-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(12px) saturate(120%);
    z-index: 2500; display: none; opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4,0,0.2,1);
}
.menu-backdrop.active { display: block; opacity: 1; }
.main-menu {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 320px;
    background: rgba(22,22,42,0.78);
    backdrop-filter: blur(28px) saturate(150%);
    border-right: 1px solid rgba(255,255,255,0.06);
    z-index: 3000;
    transform: translateX(-100%);
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
    display: flex; flex-direction: column;
    padding: 28px 22px 22px; overflow-y: auto;
}
.main-menu.active { transform: translateX(0); }
.main-menu-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 32px; padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.main-menu-close {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgb(255 255 255 / 4%);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}
.main-menu-close:hover { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 20%); color: #f8f8f8; transform: rotate(90deg); }
.main-menu-title { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: 3px; text-transform: uppercase; background: linear-gradient(135deg,#fff 0%,rgba(255,255,255,0.6) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.main-menu-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.main-menu-item {
    padding: 14px 18px; border-radius: 18px;
    color: rgba(255,255,255,0.55); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.35s cubic-bezier(0.22,1,0.36,1);
    display: flex; align-items: center; gap: 16px; user-select: none; position: relative; overflow: hidden;
}
.main-menu-item::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.1));
    opacity: 0; transition: opacity 0.35s ease; border-radius: inherit;
}
.main-menu-item:hover { color: #fff; transform: translateX(6px); text-shadow: 0 0 20px rgba(102,126,234,0.3); }
.main-menu-item:hover::before { opacity: 1; }
.main-menu-item i {
    width: 40px; height: 40px; min-width: 40px; border-radius: 14px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(102,126,234,0.12);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px; transition: all 0.35s; position: relative; z-index: 1;
}
.main-menu-item:hover i {
    background: linear-gradient(135deg, #3d2eff, #00fff5); border-color: transparent;
    color: #fff; box-shadow: 0 8px 24px rgba(102,126,234,0.35); transform: scale(1.08) rotate(-4deg);
}
.main-menu-footer { margin-top: auto; padding: 24px 0 8px; border-top: 1px solid rgba(255,255,255,0.04); font-size: 10px; color: rgba(255,255,255,0.15); text-align: center; letter-spacing: 2px; font-weight: 700; }

/* ============================================================ */
/* Chat Main */
/* ============================================================ */
.chat-main {flex: 1;display: flex;flex-direction: column;background: #0b0b0b;position: relative;min-width: 0;}
.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-header-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: #1a1a2e;
    border: 2px solid rgba(102,126,234,0.3); display: flex; align-items: center; justify-content: center;
    font-size: 14px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-header-title { font-size: 15px; font-weight: 700; color: #fff; }
.chat-header-status { font-size: 11px; color: #4caf50; font-weight: 500; }
.header-actions { display: flex; gap: 8px; }
.header-btn {
    width: 36px; height: 36px; border-radius: 10px; background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.06); color: #555; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.header-btn:hover { background: #22223a; color: #667eea; }

.messages-area {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 10px; min-height: 0;
}
.message {
    max-width: 70%; padding: 10px 14px; border-radius: 14px;
    position: relative; animation: fadeIn 0.3s ease;
    font-size: 14px; line-height: 1.5;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message.incoming {
    align-self: flex-start;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.05);
    border-bottom-left-radius: 4px;
    color: #ccc;
    width: 12pc;
}
.message.outgoing {
    align-self: flex-end;
    background: linear-gradient(42deg, #2b1a38, #262626);
    color: white;
    border-bottom-right-radius: 4px;
    width: 13pc;
    /* height: 5pc; */
}
.message-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.message-avatar {
    width: 24px; height: 24px; border-radius: 50%; background: #0c0c1a;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; overflow: hidden; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,0.1);
}
.message-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.message-username { font-size: 11px; font-weight: 700; opacity: 0.9; }
.message-time { font-size: 10px; opacity: 0.5; margin-left: auto; }
.message-text { word-wrap: break-word; }




.message-file {
    display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px;
    background: rgba(0,0,0,0.2); border-radius: 10px; text-decoration: none; color: inherit; transition: background 0.2s;
}
.message.incoming .message-file { background: rgba(255,255,255,0.05); }
.message-file:hover { background: rgba(0,0,0,0.35); }
.message-file i { font-size: 24px; color: #667eea; }
.message-file-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.message-file-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-file-size { font-size: 10px; opacity: 0.6; }

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #555; }
.empty-card {
    background: radial-gradient(#121212, transparent);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 24px;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* gap: 16px; */
    text-align: center;
}
.empty-card i { font-size: 48px; color: #555; }
.empty-card p { font-size: 15px; font-weight: 700; color: #777; letter-spacing: 1px; line-height: 1.5; text-transform: uppercase; }

.attachment-preview {
    padding: 8px 16px 0; display: none; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.attachment-preview.active { display: flex; }
.attachment-thumb {
    width: 44px; height: 44px; border-radius: 8px; background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachment-thumb i { font-size: 18px; color: #667eea; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 12px; font-weight: 600; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-type { font-size: 10px; color: #555; margin-top: 2px; }
.attachment-remove {
    width: 24px; height: 24px; border-radius: 6px; background: rgba(244,67,54,0.1);
    border: none; color: #f44336; cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: background 0.2s;
}
.attachment-remove:hover { background: rgba(244,67,54,0.2); }

.message-input-area {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255,255,255,0.04);
    display: flex; gap: 10px; align-items: center; flex-shrink: 0;
    position: relative;
    z-index: 10;
}
.input-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #161616;
    border: 1px solid rgba(255,255,255,0.08);
    color: #555;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.input-btn:hover { background: #22223a; color: #667eea; }
.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #161616;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 4px 4px 4px 16px;
    min-width: 0;
}
.input-wrapper input {
    flex: 1;
    background: #161616;
    border: none;
    color: #ccc;
    font-size: 14px;
    outline: none;
    padding: 8px 0;
    min-width: 0;
}
.input-wrapper input::placeholder { color: #555; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; font-size: 12px; }
.input-attach {
    width: 32px; height: 32px; border-radius: 50%; background: transparent; border: none;
    color: #555; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.input-attach:hover { color: #667eea; }
.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #161616;
    border: 1px solid rgba(255,255,255,0.08);
    color: #555;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-send:hover { background: linear-gradient(45deg, #0024e1, transparent); color: white; border-color: transparent; }

/* ===== EMOJI / STICKER PICKER (Unified Desktop + Mobile) ===== */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 16px;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 0;
    display: none;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
    gap: 0;
}
.emoji-picker.active { display: flex; }

.picker-tabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    flex-shrink: 0;
}
.picker-tab {
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    flex: 1;
    justify-content: center;
}
.picker-tab:hover { color: #888; background: rgba(255,255,255,0.03); }
.picker-tab.active { background: rgba(102,126,234,0.12); color: #667eea; }
.picker-tab i { font-size: 14px; }
.picker-close {
    width: 35px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.picker-close:hover { background: rgba(100, 100, 100, 0.63); color: #ffffff; }

.picker-search-box {
    padding: 8px 14px;
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.picker-search-box i {
    position: absolute;
    left: 24px;
    color: #555;
    font-size: 12px;
}
.picker-search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    color: #ccc;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}
.picker-search-box input:focus {
    border-color: rgba(102,126,234,0.3);
    background: rgba(255,255,255,0.05);
}
.picker-search-box input::placeholder { color: #555; }

.picker-cat-row {
    display: flex;
    gap: 2px;
    padding: 0 14px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}
.picker-cat-row::-webkit-scrollbar { display: none; }
.pcat {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.pcat:hover { background: rgba(255,255,255,0.05); }
.pcat.active { background: rgba(102,126,234,0.15); }

.picker-scroller {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    max-height: 260px;
}
.picker-page {
    display: none;
    padding: 0 14px 14px;
}
.picker-page.active { display: block; }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.emoji-grid .emoji-item {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    user-select: none;
}
.emoji-grid .emoji-item:hover {
    background: rgba(102,126,234,0.15);
    transform: scale(1.1);
}

.sticker-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
    gap: 10px;
}
.sticker-soon-icon { font-size: 48px; opacity: 0.5; }
.sticker-soon-title { font-size: 16px; font-weight: 700; color: #777; }
.sticker-soon-text { font-size: 13px; color: #555; line-height: 1.5; }

/* ============================================================ */
/* Modals */
/* ============================================================ */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(10px);
    display: none; align-items: center; justify-content: center;
    z-index: 2000; opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal {
    background: #1a1a2e; border: 1px solid rgba(255,255,255,0.08); border-radius: 20px;
    width: 90%; max-width: 460px; max-height: 90vh; overflow-y: auto;
    padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(0.95); transition: transform 0.3s;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: 0.5px; }
.modal-close {
    width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.05);
    border: none; color: #555; cursor: pointer; font-size: 16px; transition: all 0.2s;
}
.modal-close:hover { background: rgba(244,67,54,0.15); color: #f44336; }
.avatar-preview {
    width: 80px; height: 80px; border-radius: 50%; background: #0c0c1a;
    border: 3px solid rgba(102,126,234,0.3); display: flex; align-items: center; justify-content: center;
    font-size: 36px; margin: 0 auto 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(102,126,234,0.2);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================ */
/* Context menu */
/* ============================================================ */
.message-context-menu {
    position: fixed; background: #1a1a2e; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 6px; display: none; flex-direction: column; gap: 2px;
    z-index: 9999; box-shadow: 0 10px 40px rgba(0,0,0,0.5); min-width: 180px;
}
.message-context-menu.active { display: flex; }
.context-item {
    padding: 8px 12px; border-radius: 8px; font-size: 13px; color: #ccc;
    cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 8px;
}
.context-item:hover { background: rgba(102,126,234,0.15); color: #fff; }
.context-item.danger { color: #ff8a80; }
.context-item.danger:hover { background: rgba(244,67,54,0.15); }
.context-item.warning { color: #ffc400; }
.context-item.warning:hover { background: rgba(255,145,0,0.15); }
.context-item.accent { color: #8a9ef5; }
.context-item.accent:hover { background: rgba(102,126,234,0.15); }
.context-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }

/* ============================================================ */
/* Toasts */
/* ============================================================ */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 5000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    min-width: 280px; max-width: 380px; padding: 14px 18px; border-radius: 16px;
    background: rgba(22,22,42,0.85); backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(102,126,234,0.08);
    display: flex; align-items: flex-start; gap: 12px; pointer-events: all;
    transform: translateX(120%); opacity: 0;
    animation: toastSlideIn 0.45s cubic-bezier(0.22,1,0.36,1) forwards;
    position: relative; overflow: hidden;
}
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 16px 0 0 16px; }
.toast.toast--info::before { background: linear-gradient(180deg, #667eea, #764ba2); }
.toast.toast--success::before { background: linear-gradient(180deg, #00c853, #00e676); }
.toast.toast--error::before { background: linear-gradient(180deg, #ff1744, #f44336); }
.toast.toast--warning::before { background: linear-gradient(180deg, #ff9100, #ffc400); }
.toast.toast--exit { animation: toastSlideOut 0.35s cubic-bezier(0.4,0,1,1) forwards; }
.toast__icon { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast--info .toast__icon { background: rgba(102,126,234,0.12); color: #8a9ef5; }
.toast--success .toast__icon { background: rgba(0,200,83,0.12); color: #69f0ae; }
.toast--error .toast__icon { background: rgba(244,67,54,0.12); color: #ff8a80; }
.toast--warning .toast__icon { background: rgba(255,145,0,0.12); color: #ffd180; }
.toast__content { flex: 1; min-width: 0; }
.toast__title { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; letter-spacing: 0.3px; }
.toast__message { font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.4; word-wrap: break-word; }
.toast__close { width: 24px; height: 24px; border-radius: 8px; background: transparent; border: none; color: rgba(255,255,255,0.25); font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; margin-top: 2px; }
.toast__close:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
.toast__progress { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(255,255,255,0.03); border-radius: 0 0 16px 16px; overflow: hidden; }
.toast__progress-bar { height: 100%; width: 100%; transform-origin: left; animation: toastProgress 3s linear forwards; }
.toast--info .toast__progress-bar { background: linear-gradient(90deg, #667eea, #764ba2); }
.toast--success .toast__progress-bar { background: linear-gradient(90deg, #00c853, #00e676); }
.toast--error .toast__progress-bar { background: linear-gradient(90deg, #ff1744, #f44336); }
.toast--warning .toast__progress-bar { background: linear-gradient(90deg, #ff9100, #ffc400); }

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

/* ============================================================ */
/* Scrollbar */
/* ============================================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track {background: transparent;}
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ============================================================ */
/* Ð Ð•ÐšÐ›ÐÐœÐ Ð’ Ð§ÐÐ¢Ð• (Ð¯Ð½Ð´ÐµÐºÑ.ÐŸÑƒÑ‚ÐµÑˆÐµÑÑ‚Ð²Ð¸Ñ) */
/* ============================================================ */
.chat-ad-banner {
    position: sticky;
    bottom: 12px;
    left: 0;
    right: 0;
    margin: 8px auto;
    max-width: 420px;
    z-index: 50;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    align-self: center;
}
.chat-ad-banner.chat-ad-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.chat-ad-banner.chat-ad-hiding {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.chat-ad-content {
    background: linear-gradient(135deg, rgba(30, 30, 45, 0.95), rgba(20, 20, 35, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(102, 126, 234, 0.05);
    position: relative;
    overflow: hidden;
}
.chat-ad-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.4), transparent);
    border-radius: 0 0 2px 2px;
}
.chat-ad-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 6px;
    font-weight: 600;
}
.chat-ad-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}
.chat-ad-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    transform: rotate(90deg);
}
.chat-ad-widget { min-height: 60px; }
.chat-ad-widget iframe,
.chat-ad-widget > div {
    border-radius: 10px !important;
    overflow: hidden !important;
}


/* ============================================================ */
/* Reply Preview (above input) */
/* ============================================================ */
.reply-preview {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.06);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    border-left: 3px solid #667eea;
    margin: 0 16px;
    border-radius: 0 10px 0 0;
    animation: replySlideIn 0.25s ease;
}
.reply-preview.active {
    display: flex;
}
@keyframes replySlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.reply-preview-line {
    width: 3px;
    align-self: stretch;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 3px;
    flex-shrink: 0;
}
.reply-preview-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.reply-preview-name {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
}
.reply-preview-text {
    font-size: 11px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-preview-close {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.reply-preview-close:hover {
    background: rgba(244, 67, 54, 0.15);
    color: #ff8a80;
}

/* ============================================================ */
/* Reply quote inside message */
/* ============================================================ */
.message-reply {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 2px solid #667eea;
}
.message-reply:hover {
    background: rgba(102, 126, 234, 0.15);
}
.message-reply-line {
    width: 2px;
    align-self: stretch;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 2px;
    flex-shrink: 0;
}
.message-reply-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.message-reply-name {
    font-size: 11px;
    font-weight: 700;
    color: #8a9ef5;
}
.message-reply-text {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.message.outgoing .message-reply {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: rgba(255, 255, 255, 0.3);
}
.message.outgoing .message-reply:hover {
    background: rgba(255, 255, 255, 0.1);
}
.message.outgoing .message-reply-name {
    color: rgba(255, 255, 255, 0.7);
}
.message.outgoing .message-reply-text {
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================================ */
/* Forward Modal */
/* ============================================================ */
.modal--forward {
    max-width: 400px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.modal--forward .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.forward-search-box {
    padding: 12px 16px;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}
.forward-search-box i {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    font-size: 12px;
}
.forward-search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #ccc;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}
.forward-search-box input:focus {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.05);
}
.forward-search-box input::placeholder {
    color: #555;
}
.forward-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    min-height: 0;
}
.forward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.forward-item:hover {
    background: rgba(102, 126, 234, 0.1);
}
.forward-item:active {
    transform: scale(0.98);
}
.forward-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(102, 126, 234, 0.2);
}
.forward-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.forward-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.forward-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.forward-item-type {
    font-size: 11px;
    color: #555;
}
.forward-item-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.forward-item-btn:hover {
    background: rgba(102, 126, 234, 0.25);
    transform: scale(1.1);
}
.forward-loading,
.forward-empty {
    padding: 40px 20px;
    text-align: center;
    color: #555;
    font-size: 13px;
}
.forward-loading i {
    margin-right: 8px;
    color: #667eea;
}

/* ============================================================ */
/* Mobile */
/* ============================================================ */
@media (max-width: 768px) {
    .reply-preview {
        margin: 0 12px;
        padding: 6px 12px;
    }
    .reply-preview-name {
        font-size: 11px;
    }
    .reply-preview-text {
        font-size: 10px;
    }
    .message-reply {
        padding: 5px 8px;
    }
    .message-reply-name {
        font-size: 10px;
    }
    .message-reply-text {
        font-size: 10px;
    }
    .modal--forward {
        max-height: 80vh;
    }
    .forward-item {
        padding: 12px 14px;
    }
    .forward-item-avatar {
        width: 44px;
        height: 44px;
    }
    .forward-item-name {
        font-size: 15px;
    }
    .forward-item-type {
        font-size: 12px;
    }
    .forward-search-box input {
        padding: 12px 12px 12px 38px;
        font-size: 15px;
    }
    .burger-btn { display: flex; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); width: 100vw; }
    .sidebar.open { transform: translateX(0); }
    .chat-main { width: 100%; }
    .message { max-width: 85%; }
    .chat-header { padding-left: 60px; }
    .empty-card { padding: 36px 28px; }
    .empty-card p { font-size: 13px; }
    /* Mobile emoji picker overrides */
    .emoji-picker {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: 50vh;
        max-height: 400px;
        border-radius: 24px 24px 0 0;
        z-index: 60;
        transform: translateY(105%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        background: linear-gradient(257deg, #232323 0%, #0f0f0f 100%);
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    }
    .emoji-picker.active {
        transform: translateY(0);
    }
    .picker-tabs-bar {
        padding: 14px 16px 10px;
        gap: 6px;
    }
    .picker-tab {
        padding: 10px 16px;
        border-radius: 12px;
        font-size: 14px;
    }
    .picker-tab.active {
        background: linear-gradient(135deg, rgb(145 145 145 / 15%), rgb(46 46 46 / 10%));
        color: #e6e6e6;
    }
    .picker-close {
        width: 32px;
        height: 32px;
    }
    .picker-close:active {
        background: rgba(244,67,54,0.12);
        color: #f44336;
    }
    .picker-search-box {
        padding: 8px 16px;
    }
    .picker-search-box i {
        left: 26px;
    }
    .picker-search-box input {
        padding: 10px 12px 10px 38px;
        font-size: 15px;
    }
    .picker-cat-row {
        padding: 0 16px 10px;
        gap: 4px;
    }
    .pcat {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 18px;
    }
    .picker-scroller {
        -webkit-overflow-scrolling: touch;
    }
    .picker-page {
        padding: 0 16px 16px;
    }
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }
    .emoji-grid .emoji-item {
        width: auto;
        height: 44px;
        font-size: 26px;
        border-radius: 10px;
        -webkit-touch-callout: none;
        pointer-events: auto;
        touch-action: manipulation;
    }
    .emoji-grid .emoji-item:active {
        background: rgba(102,126,234,0.2);
        transform: scale(0.92);
    }
    .sticker-soon {
        padding: 60px 20px;
        gap: 12px;
    }
    .sticker-soon-icon { font-size: 56px; }
    .sticker-soon-title { font-size: 18px; }
    .sticker-soon-text { font-size: 14px; }
    
    .main-menu { width: 100vw; }
    .chat-ad-banner { max-width: calc(100% - 24px); margin: 6px 12px; }
    .chat-ad-content { padding: 10px 12px; border-radius: 14px; }
}
img.start-logo-chat {
    width: 16pc;
    padding: 2pc;
    margin-top: -2pc;
}
/* ===== КАНАЛЫ ===== */
.channels-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 10px;
    min-height: 160px;
}
.channels-placeholder-icon {
    font-size: 36px;
    color: #555;
    opacity: 0.5;
    margin-bottom: 4px;
}
.channels-placeholder-title {
    font-size: 14px;
    font-weight: 700;
    color: #777;
    letter-spacing: 0.5px;
}
.channels-placeholder-text {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}


/* ============================================================ */
/* Tabs Header with Create Button */
/* ============================================================ */
.tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 10px;
    gap: 8px;
}

.tabs-header .tabs-row {
    flex: 1;
    padding: 0;
    margin: 0;
    gap: 6px;
}

/* ============================================================ */
/* Create Channel Button */
/* ============================================================ */
.create-channel-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgb(98 98 98 / 12%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.create-channel-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.2));
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: inherit;
}

.create-channel-btn:hover {
    transform: scale(1.08) rotate(-2deg);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.create-channel-btn:hover::before {
    opacity: 1;
}

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

.create-channel-btn i {
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

.create-channel-btn:hover i {
    transform: rotate(90deg);
}

/* ============================================================ */
/* Channel List */
/* ============================================================ */
.channels-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 16px;
}

.channel-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.channel-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06), rgba(118, 75, 162, 0.04));
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

.channel-item:hover {
    background: rgba(102, 126, 234, 0.06);
    border-color: rgba(102, 126, 234, 0.1);
    transform: translateX(3px);
}

.channel-item:hover::before {
    opacity: 1;
}

.channel-item.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.15);
}

.channel-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.channel-name {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.channel-desc {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-bottom: 6px;
}

.channel-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-members {
    font-size: 10px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.channel-members i {
    font-size: 9px;
    color: #667eea;
}

.channel-badge {
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
}

.channel-badge.public {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.channel-badge.private {
    background: rgba(255, 145, 0, 0.08);
    color: #ff9100;
    border: 1px solid rgba(255, 145, 0, 0.12);
}

.channel-badge i {
    font-size: 8px;
}

/* ============================================================ */
/* Channel Empty State */
/* ============================================================ */
.channels-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 8px;
    min-height: 160px;
}

.channels-empty-icon {
    font-size: 32px;
    color: #555;
    opacity: 0.4;
    margin-bottom: 4px;
}

.channels-empty-title {
    font-size: 13px;
    font-weight: 700;
    color: #777;
    letter-spacing: 0.5px;
}

.channels-empty-text {
    font-size: 11px;
    color: #555;
    line-height: 1.5;
    max-width: 200px;
}

/* ============================================================ */
/* Create Channel Modal */
/* ============================================================ */
.modal--channel {
    max-width: 420px;
}

.modal--channel .modal-body {
    padding: 0 4px;
}

.modal--channel .form-group {
    margin-bottom: 16px;
}

.modal--channel .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal--channel .form-group input,
.modal--channel .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: #0c0c1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ccc;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.modal--channel .form-group input:focus,
.modal--channel .form-group textarea:focus {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.03);
}

.modal--channel .form-group input::placeholder,
.modal--channel .form-group textarea::placeholder {
    color: #444;
}

.modal--channel .input-hint {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: #444;
    font-weight: 500;
}

/* Checkbox styling */
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #0c0c1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: #667eea;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.checkbox-label input:checked + .checkmark {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.1);
}

.checkbox-label input:checked + .checkmark::after {
    opacity: 1;
    transform: scale(1);
}

.checkbox-text {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.btn-create-channel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-create-channel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #764ba2, #667eea);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-create-channel:hover::before {
    opacity: 1;
}

.btn-create-channel:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.btn-create-channel i,
.btn-create-channel span {
    position: relative;
    z-index: 1;
}

/* ============================================================ */
/* Mobile: Tabs Header */
/* ============================================================ */
@media (max-width: 768px) {
    .tabs-header {
        padding: 0 16px 10px;
    }

    .create-channel-btn {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 14px;
    }

    .channel-item {
        padding: 14px 16px;
    }

    .channel-avatar {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }

    .channel-name {
        font-size: 15px;
    }

    .channel-desc {
        font-size: 12px;
    }

    .channel-meta {
        gap: 10px;
    }

    .channel-members {
        font-size: 11px;
    }

    .channel-badge {
        font-size: 10px;
        padding: 3px 10px;
    }

    .channels-empty {
        padding: 50px 20px;
        min-height: 180px;
    }

    .channels-empty-icon {
        font-size: 40px;
    }

    .channels-empty-title {
        font-size: 15px;
    }

    .channels-empty-text {
        font-size: 13px;
    }

    .modal--channel {
        border-radius: 24px 24px 0 0;
    }
}


/* ============================================================ */
/* Create Dropdown Menu (Modern Floating Menu) */
/* ============================================================ */
.create-menu-wrapper {
    position: relative;
    flex-shrink: 0;
}

.create-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    /* SOLID fallback background — visible on ALL devices, including iOS where backdrop-filter fails */
    background: rgba(26, 26, 42, 0.98);
    /* Liquid glass / glassmorphism effect with vendor prefixes for iOS Safari */
    -webkit-backdrop-filter: blur(28px) saturate(150%);
    backdrop-filter: blur(28px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(102, 126, 234, 0.06);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    /* GPU acceleration for smooth rendering on mobile */
    will-change: transform, opacity;
    -webkit-transform: translateY(-8px) scale(0.96);
}

.create-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    -webkit-transform: translateY(0) scale(1);
}

.create-dropdown-arrow {
    position: absolute;
    top: -6px;
    right: 12px;
    width: 12px;
    height: 12px;
    /* Match the solid fallback background */
    background: rgba(26, 26, 42, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transform: rotate(45deg);
    z-index: -1;
}

.create-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.create-dropdown-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.06));
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: inherit;
}

.create-dropdown-item:hover {
    transform: translateX(4px);
}

.create-dropdown-item:hover::before {
    opacity: 1;
}

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

.create-dropdown-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.25s ease;
}

.create-dropdown-item:hover .create-dropdown-icon {
    transform: scale(1.1) rotate(-4deg);
}

.create-dropdown-icon.channel-icon {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.1));
    color: #8a9ef5;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.create-dropdown-icon.chat-icon {
    background: linear-gradient(135deg, rgba(0, 200, 83, 0.12), rgba(0, 230, 118, 0.08));
    color: #69f0ae;
    border: 1px solid rgba(0, 200, 83, 0.15);
}

.create-dropdown-icon.join-icon {
    background: linear-gradient(135deg, rgba(255, 145, 0, 0.12), rgba(255, 196, 0, 0.08));
    color: #ffd180;
    border: 1px solid rgba(255, 145, 0, 0.15);
}

.create-dropdown-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.create-dropdown-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.create-dropdown-desc {
    font-size: 11px;
    color: #555;
    line-height: 1.4;
}

.create-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 4px 8px;
}

/* ============================================================ */
/* Join Channel Modal */
/* ============================================================ */
.modal--join {
    max-width: 380px;
}

.modal--join .modal-body {
    padding: 0 4px;
}

.btn-join-channel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    background: linear-gradient(135deg, #ff9100, #ffc400);
    border: none;
    position: relative;
    overflow: hidden;
    color: #1a1a2e;
}

.btn-join-channel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #ffc400, #ff9100);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-join-channel:hover::before {
    opacity: 1;
}

.btn-join-channel:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(255, 145, 0, 0.3);
}

.btn-join-channel i,
.btn-join-channel span {
    position: relative;
    z-index: 1;
}

/* ============================================================ */
/* Create Button Active State (when menu is open) */
/* ============================================================ */
.create-channel-btn.active {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.4);
    transform: rotate(45deg);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

/* ============================================================ */
/* Mobile: Dropdown Menu */
/* ============================================================ */
@media (max-width: 852px) {
    .create-dropdown {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%) scale(1);
        -webkit-transform: translateY(100%) scale(1);
        transform-origin: bottom center;
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
        /* Solid fallback + liquid glass for mobile */
        background: rgba(22, 22, 42, 0.98);
        -webkit-backdrop-filter: blur(28px) saturate(150%);
        backdrop-filter: blur(28px) saturate(150%);
        will-change: transform;
    }

    .create-dropdown.active {
        transform: translateY(0);
        -webkit-transform: translateY(0);
    }

    .create-dropdown-arrow {
        display: none;
    }

    .create-dropdown-item {
        padding: 16px 14px;
    }

    .create-dropdown-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 18px;
    }

    .create-dropdown-title {
        font-size: 15px;
    }

    .create-dropdown-desc {
        font-size: 12px;
    }

    .create-menu-wrapper {
        position: static;
    }

    .create-channel-btn.active {
        transform: rotate(45deg) scale(0.9);
    }
}
/* ============================================================ */
/* MODERN IMAGE & MEDIA DISPLAY (2026 Design) */
/* ============================================================ */
/* ============================================================ */
/* Mobile: Dropdown Menu */
/* ============================================================ */
@media (max-width: 852px) {
    .create-dropdown {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%) scale(1);
        -webkit-transform: translateY(100%) scale(1);
        transform-origin: bottom center;
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
        /* Solid fallback + liquid glass for mobile */
        background: rgba(22, 22, 42, 0.98);
        -webkit-backdrop-filter: blur(28px) saturate(150%);
        backdrop-filter: blur(28px) saturate(150%);
        will-change: transform;
    }

    .create-dropdown.active {
        transform: translateY(0);
        -webkit-transform: translateY(0);
    }

    .create-dropdown-arrow {
        display: none;
    }

    .create-dropdown-item {
        padding: 16px 14px;
    }

    .create-dropdown-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 18px;
    }

    .create-dropdown-title {
        font-size: 15px;
    }

    .create-dropdown-desc {
        font-size: 12px;
    }

    .create-menu-wrapper {
        position: static;
    }

    .create-channel-btn.active {
        transform: rotate(45deg) scale(0.9);
    }
}

}


/* ============================================================ */
/* MODERN IMAGE & MEDIA DISPLAY (2026 Design) */
/* ============================================================ */

/* ---- Base message media container ---- */
.message-media {
    margin-top: 8px;
    border-radius: 16px;
    overflow: hidden;
    max-width: 320px;
    position: relative;
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.6), rgba(30, 30, 50, 0.4));
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.message-media:hover {
    box-shadow: 
        0 8px 32px rgba(102, 126, 234, 0.15),
        0 0 0 1px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-2px) scale(1.01);
}

/* ---- Image wrapper with shimmer loading ---- */
.message-media .media-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(90deg, 
        rgba(30, 30, 50, 0.8) 0%, 
        rgba(50, 50, 80, 0.6) 50%, 
        rgba(30, 30, 50, 0.8) 100%);
    background-size: 200% 100%;
    animation: mediaShimmer 1.5s ease-in-out infinite;
}

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

.message-media .media-image-wrapper.loaded {
    animation: none;
    background: transparent;
}

/* ---- Actual image ---- */
.message-media img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 1;
    transform: scale(1);
}



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

.message-media.error {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 67, 54, 0.08);
    border: 1px solid rgba(244, 67, 54, 0.15);
}
.message-media.error::after {
    content: '⚠️ Не удалось загрузить изображение';
    position: static;
    opacity: 1;
    transform: none;
    background: none;
    height: auto;
    color: #ff8a80;
    font-size: 12px;
    text-align: center;
    padding: 20px;
    pointer-events: auto;
}

/* ---- Image overlay gradient (subtle) ---- */
.message-media::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.3) 0%, 
        transparent 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0 0 16px 16px;
}

.message-media:hover::after {
    opacity: 1;
}

/* ---- Media info bar (file name, size) ---- */
.message-media .media-info {
    position: absolute;
    bottom: 8px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: 2;
}

.message-media:hover .media-info {
    opacity: 1;
    transform: translateY(0);
}

.message-media .media-info .media-filename {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

.message-media .media-info .media-size {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

/* ---- Image action buttons (download, view) ---- */
.message-media .media-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 3;
}

.message-media:hover .media-actions {
    opacity: 1;
    transform: translateY(0);
}

.message-media .media-actions .media-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.message-media .media-actions .media-btn:hover {
    background: rgba(102, 126, 234, 0.6);
    border-color: rgba(102, 126, 234, 0.3);
    transform: scale(1.1);
}

.message-media .media-actions .media-btn:active {
    transform: scale(0.95);
}

/* ---- Video styling ---- */
.message-media video {
    width: 100%;
    max-height: 400px;
    border-radius: 16px;
    display: block;
    background: #0a0a0a;
}

/* ---- Image loading spinner ---- */
.message-media .media-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-top-color: rgba(102, 126, 234, 0.8);
    border-radius: 50%;
    animation: mediaSpin 0.8s linear infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes mediaSpin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.message-media .media-loader.loaded {
    display: none;
}

/* ---- Image error state ---- */
.message-media .media-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(20, 20, 40, 0.9);
    border-radius: 16px;
    color: #555;
    font-size: 12px;
    z-index: 2;
}

.message-media .media-error i {
    font-size: 24px;
    color: rgba(244, 67, 54, 0.6);
}

/* ---- Lightbox / Fullscreen viewer ---- */
.media-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: zoom-out;
}

.media-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.media-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    object-fit: contain;
}

.media-lightbox.active img {
    transform: scale(1);
}

.media-lightbox .lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.media-lightbox .lightbox-close:hover {
    background: rgba(244, 67, 54, 0.6);
    transform: rotate(90deg);
}

/* ---- Mobile adjustments ---- */
@media (max-width: 768px) {
    .message-media {
        max-width: 260px;
        border-radius: 14px;
    }

    .message-media .media-image-wrapper,
    .message-media img,
    .message-media::after,
    .message-media .media-error {
        border-radius: 14px;
    }

    .message-media .media-actions {
        opacity: 1;
        transform: translateY(0);
        top: 8px;
        right: 8px;
    }

    .message-media .media-actions .media-btn {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        font-size: 11px;
    }

    .message-media .media-info {
        opacity: 1;
        transform: translateY(0);
        bottom: 6px;
        left: 8px;
        right: 8px;
    }

    .message-media video {
        max-height: 280px;
    }
}

@media (max-width: 380px) {
    .message-media {
        max-width: 220px;
    }
}


/* ============================================================ */
/* MODERN MEDIA DISPLAY SYSTEM — v2.0 */
/* ============================================================ */

/* ---- Base Media Card ---- */
.msg-media-card {
    margin-top: 8px;
    border-radius: 18px;
    overflow: hidden;
    max-width: 340px;
    position: relative;
    background: linear-gradient(145deg, rgba(25,25,45,0.9), rgba(15,15,35,0.95));
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.4),
        0 0 0 1px rgba(102,126,234,0.04),
        inset 0 1px 0 rgba(255,255,255,0.03);
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    will-change: transform;
}

.msg-media-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 
        0 16px 48px rgba(0,0,0,0.5),
        0 0 0 1px rgba(102,126,234,0.08),
        0 0 30px rgba(102,126,234,0.06),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ---- Image Container ---- */
.msg-media-img-wrap {
    position: relative;
    width: 100%;
    min-height: 120px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    overflow: hidden;
}

.msg-media-img-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        rgba(30,30,60,0.8) 0%, 
        rgba(50,50,90,0.6) 50%, 
        rgba(30,30,60,0.8) 100%);
    background-size: 300% 100%;
    animation: shimmerLoad 1.8s ease-in-out infinite;
    z-index: 1;
}

.msg-media-img-wrap.loaded::before {
    display: none;
}

@keyframes shimmerLoad {
    0% { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

.msg-media-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.08);
    transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    z-index: 2;
}

.msg-media-img-wrap img.loaded {
    opacity: 1;
    transform: scale(1);
}

.msg-media-img-wrap img:hover {
    transform: scale(1.03);
}

/* ---- Image Overlay Gradient ---- */
.msg-media-img-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, 
        rgba(10,10,20,0.7) 0%, 
        rgba(10,10,20,0.2) 60%,
        transparent 100%);
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.msg-media-card:hover .msg-media-img-wrap::after {
    opacity: 1;
}

/* ---- Media Info Bar ---- */
.msg-media-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 14px 10px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    z-index: 4;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.msg-media-card:hover .msg-media-info {
    opacity: 1;
    transform: translateY(0);
}

.msg-media-info .media-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    max-width: 70%;
}

.msg-media-info .media-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.msg-media-info .media-size {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.msg-media-info .media-type-badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(102,126,234,0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #8a9ef5;
}

/* ---- Action Buttons (top-right) ---- */
.msg-media-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    z-index: 5;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.msg-media-card:hover .msg-media-actions {
    opacity: 1;
    transform: translateY(0);
}

.msg-media-actions .m-action {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.msg-media-actions .m-action:hover {
    background: rgba(102,126,234,0.5);
    border-color: rgba(102,126,234,0.3);
    transform: scale(1.12);
}

.msg-media-actions .m-action:active {
    transform: scale(0.92);
}

/* ---- Loading Spinner ---- */
.msg-media-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    z-index: 2;
}

.msg-media-spinner::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border: 2.5px solid rgba(102,126,234,0.15);
    border-top-color: rgba(102,126,234,0.8);
    border-right-color: rgba(102,126,234,0.4);
    border-radius: 50%;
    animation: spinLoad 0.9s linear infinite;
}

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

.msg-media-img-wrap.loaded .msg-media-spinner {
    display: none;
}

/* ---- Error State ---- */
.msg-media-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(15,15,30,0.95);
    z-index: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.msg-media-error.show {
    opacity: 1;
    pointer-events: auto;
}

.msg-media-error i {
    font-size: 32px;
    color: rgba(244,67,54,0.5);
}

.msg-media-error span {
    font-size: 12px;
    color: #555;
}

/* ============================================================ */
/* VIDEO CARD */
/* ============================================================ */
.msg-video-card {
    margin-top: 8px;
    border-radius: 18px;
    overflow: hidden;
    max-width: 340px;
    position: relative;
    background: linear-gradient(145deg, rgba(20,20,35,0.95), rgba(10,10,25,0.98));
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
}

.msg-video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(102,126,234,0.06);
}

.msg-video-card .video-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    overflow: hidden;
}

.msg-video-card .video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.msg-video-card:hover .video-thumb img {
    opacity: 0.8;
}

.msg-video-card .video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(102,126,234,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 20px rgba(102,126,234,0.4);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 3;
}

.msg-video-card:hover .video-play-btn {
    transform: translate(-50%, -50%) scale(1.15);
    background: rgba(102,126,234,0.95);
    box-shadow: 0 6px 28px rgba(102,126,234,0.5);
}

.msg-video-card .video-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    z-index: 3;
}

.msg-video-card .video-info {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.msg-video-card .video-info .v-name {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-video-card .video-info .v-size {
    font-size: 11px;
    color: #555;
    flex-shrink: 0;
}

/* ============================================================ */
/* FILE / DOCUMENT CARD (PDF, etc) */
/* ============================================================ */
.msg-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
    padding: 14px 16px;
    background: linear-gradient(145deg, rgba(25,25,45,0.9), rgba(18,18,38,0.95));
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.04);
    text-decoration: none;
    color: inherit;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    max-width: 340px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.msg-file-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 16px 0 0 16px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.msg-file-card:hover::before {
    opacity: 1;
}

.msg-file-card:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(102,126,234,0.06);
    border-color: rgba(102,126,234,0.08);
}

.msg-file-card .file-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.1));
    border: 1px solid rgba(102,126,234,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #8a9ef5;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.msg-file-card:hover .file-icon {
    transform: scale(1.08) rotate(-3deg);
    background: linear-gradient(135deg, rgba(102,126,234,0.25), rgba(118,75,162,0.2));
}

.msg-file-card .file-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-file-card .file-name {
    font-size: 13px;
    font-weight: 600;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-file-card .file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #555;
}

.msg-file-card .file-meta .file-ext {
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(102,126,234,0.1);
    color: #667eea;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg-file-card .file-download {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.msg-file-card:hover .file-download {
    background: rgba(102,126,234,0.15);
    border-color: rgba(102,126,234,0.2);
    transform: scale(1.1);
}

/* ============================================================ */
/* MODAL VIEWERS */
/* ============================================================ */

/* ---- Image Lightbox ---- */
.media-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,5,15,0.95);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: zoom-out;
}

.media-viewer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.media-viewer-overlay .viewer-img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
    transform: scale(0.85) translateY(20px);
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    object-fit: contain;
}

.media-viewer-overlay.active .viewer-img {
    transform: scale(1) translateY(0);
}

.media-viewer-overlay .viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 2;
}

.media-viewer-overlay .viewer-close:hover {
    background: rgba(244,67,54,0.7);
    border-color: rgba(244,67,54,0.3);
    transform: rotate(90deg) scale(1.1);
}

.media-viewer-overlay .viewer-toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(20,20,40,0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
    z-index: 2;
}

.media-viewer-overlay.active .viewer-toolbar {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.media-viewer-overlay .viewer-toolbar .v-btn {
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.media-viewer-overlay .viewer-toolbar .v-btn:hover {
    background: rgba(102,126,234,0.2);
    border-color: rgba(102,126,234,0.2);
    color: #fff;
}

/* ---- Video Player Modal ---- */
.video-player-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,5,15,0.98);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.video-player-overlay.active {
    opacity: 1;
    visibility: visible;
}

.video-player-overlay .vp-video {
    width: 100%;
    max-width: 960px;
    max-height: 80vh;
    border-radius: 0;
    outline: none;
}

.video-player-overlay .vp-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.video-player-overlay .vp-close:hover {
    background: rgba(244,67,54,0.7);
    transform: rotate(90deg);
}

.video-player-overlay .vp-title {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    text-align: center;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    pointer-events: none;
}

/* ---- PDF / Document Viewer Modal ---- */
.doc-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,5,15,0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.doc-viewer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.doc-viewer-overlay .doc-frame {
    width: 100%;
    max-width: 900px;
    height: 80vh;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: #1a1a2e;
    overflow: hidden;
}

.doc-viewer-overlay .doc-frame iframe,
.doc-viewer-overlay .doc-frame embed {
    width: 100%;
    height: 100%;
    border: none;
}

.doc-viewer-overlay .doc-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.doc-viewer-overlay .doc-close:hover {
    background: rgba(244,67,54,0.7);
    transform: rotate(90deg);
}

.doc-viewer-overlay .doc-header {
    position: absolute;
    top: 20px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.doc-viewer-overlay .doc-header .doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(118,75,162,0.15));
    border: 1px solid rgba(102,126,234,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #8a9ef5;
}

.doc-viewer-overlay .doc-header .doc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.doc-viewer-overlay .doc-header .doc-info .doc-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.doc-viewer-overlay .doc-header .doc-info .doc-size {
    font-size: 12px;
    color: #555;
}

.doc-viewer-overlay .doc-actions {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 2;
}

.doc-viewer-overlay .doc-actions .doc-btn {
    padding: 10px 20px;
    border-radius: 12px;
    background: rgba(102,126,234,0.15);
    border: 1px solid rgba(102,126,234,0.2);
    color: #8a9ef5;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.doc-viewer-overlay .doc-actions .doc-btn:hover {
    background: rgba(102,126,234,0.25);
    transform: translateY(-2px);
}

/* ============================================================ */
/* MOBILE RESPONSIVE */
/* ============================================================ */
@media (max-width: 768px) {
    .msg-media-card,
    .msg-video-card,
    .msg-file-card {
        max-width: 260px;
        border-radius: 14px;
    }

    .msg-media-img-wrap,
    .msg-media-img-wrap img,
    .msg-media-img-wrap::after {
        border-radius: 14px;
    }

    .msg-media-info {
        opacity: 1;
        transform: translateY(0);
        padding: 10px 12px 8px;
    }

    .msg-media-actions {
        opacity: 1;
        transform: translateY(0);
        top: 8px;
        right: 8px;
    }

    .msg-media-actions .m-action {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        font-size: 11px;
    }

    .msg-video-card .video-play-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .msg-file-card {
        padding: 12px 14px;
        gap: 12px;
    }

    .msg-file-card .file-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 18px;
    }

    .media-viewer-overlay .viewer-img {
        max-width: 96vw;
        max-height: 80vh;
        border-radius: 12px;
    }

    .media-viewer-overlay .viewer-close,
    .video-player-overlay .vp-close,
    .doc-viewer-overlay .doc-close {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
    }

    .video-player-overlay .vp-video {
        max-height: 70vh;
    }

    .doc-viewer-overlay .doc-frame {
        height: 75vh;
        border-radius: 12px;
    }
}

@media (max-width: 380px) {
    .msg-media-card,
    .msg-video-card,
    .msg-file-card {
        max-width: 220px;
    }
}


/* ============================================================ */
/* PROFILE MODAL — Modern Dark Style (PC + Mobile)              */
/* ============================================================ */

.modal--profile {
    background: linear-gradient(180deg, #1a1a24 0%, #14141c 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(102, 126, 234, 0.05);
}

/* ---- Close button (top-right X) ---- */
.modal--profile .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #888;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 10;
}

.modal--profile .modal-close:hover {
    background: rgb(27 27 27 / 15%);
    color: #ffffff;
    transform: rotate(90deg);
}

/* ---- Avatar Section ---- */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 20px;
    position: relative;
}

.profile-avatar-wrap {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    border: 3px solid rgba(102, 126, 234, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(102, 126, 234, 0.1),
        inset 0 0 20px rgba(102, 126, 234, 0.05);
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.profile-avatar-wrap:hover {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 
        0 12px 40px rgba(102, 126, 234, 0.15),
        0 0 0 1px rgba(102, 126, 234, 0.2),
        inset 0 0 30px rgba(102, 126, 234, 0.08);
    transform: scale(1.03);
}

.profile-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Avatar Change Button (invisible overlay on avatar) ---- */
.profile-avatar-change {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-change i {
    font-size: 24px;
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.profile-avatar-section:hover .profile-avatar-change {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.profile-avatar-section:hover .profile-avatar-change i {
    opacity: 1;
    transform: scale(1);
}

.profile-avatar-change:hover {
    background: rgba(102, 126, 234, 0.3) !important;
}

.profile-avatar-change:hover i {
    color: #8a9ef5;
}

/* ---- Profile Form ---- */
.profile-form {
    padding: 0 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: none;
    letter-spacing: 0.3px;
    padding-left: 4px;
}

.profile-input-wrap {
    position: relative;
}

.profile-input,
.profile-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
}

.profile-input::placeholder,
.profile-textarea::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.profile-input:focus,
.profile-textarea:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
}

.profile-textarea {
    resize: none;
    min-height: 80px;
    line-height: 1.5;
}

/* Disabled inputs */
.profile-input--disabled {
    background: rgba(255, 255, 255, 0.015) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.04) !important;
}

.profile-input--disabled:focus {
    box-shadow: none !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
}

/* ---- Save Button ---- */
.profile-save-btn {
    width: 100%;
    padding: 14px 20px;
    margin-top: 8px;
    background: linear-gradient(135deg, rgb(13 13 13 / 15%), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 14px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.profile-save-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgb(12 12 12 / 25%), rgba(118, 75, 162, 0.2));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-save-btn:hover {
    transform: translateY(-2px);
    border-color: rgb(32 32 32 / 40%);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.profile-save-btn:hover::before {
    opacity: 1;
}

.profile-save-btn:active {
    transform: translateY(0) scale(0.98);
}

.profile-save-btn span {
    position: relative;
    z-index: 1;
}

/* ============================================================ */
/* MOBILE: Profile Modal                                        */
/* ============================================================ */
@media (max-width: 768px) {
    .modal--profile {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 24px 24px 0 0;
        margin-top: auto;
        animation: profileModalUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    @keyframes profileModalUp {
        from { transform: translateY(100%); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .modal-overlay.active .modal--profile {
        transform: translateY(0);
    }

    .profile-avatar-section {
        padding: 28px 20px 16px;
    }

    .profile-avatar-wrap {
        width: 90px;
        height: 90px;
    }

    .profile-avatar-change {
        width: 90px;
        height: 90px;
        top: 28px;
    }

    .profile-form {
        padding: 0 20px 24px;
        gap: 14px;
    }

    .profile-input,
    .profile-textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevent iOS zoom */
        border-radius: 12px;
    }

    .profile-label {
        font-size: 12px;
    }

    .profile-save-btn {
        padding: 16px 20px;
        font-size: 15px;
        margin-top: 4px;
    }

    .modal--profile .modal-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.06);
    }
}

@media (max-width: 380px) {
    .profile-avatar-wrap {
        width: 80px;
        height: 80px;
    }

    .profile-avatar-change {
        width: 80px;
        height: 80px;
    }

    .profile-form {
        padding: 0 16px 20px;
    }

    .profile-input,
    .profile-textarea {
        padding: 10px 12px;
    }
}
