/* ===== COMMUNICATION PAGE STYLES ===== */

html, body { height: 100%; overflow: hidden; }

/* Background overlay override */
.page-bg-overlay { background: rgba(5, 0, 10, 0.78); }

/* ===== MAIN LAYOUT ===== */
.app-container {
    position: relative; z-index: 1;
    display: flex; height: calc(100vh - var(--nav-h));
    margin-top: var(--nav-h);
}

/* ===== LEFT SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w); min-width: var(--sidebar-w);
    height: 100%; display: flex; flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 300ms var(--ease-out-expo);
}

.sidebar-header {
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex; align-items: center; justify-content: space-between;
}

.sidebar-title {
    font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted);
}

.online-total {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.72rem; color: var(--neon-green); font-weight: 600;
}

.online-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--neon-green);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

.room-list {
    flex: 1; overflow-y: auto; padding: 0.6rem;
    display: flex; flex-direction: column; gap: 4px;
}

.room-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px; cursor: pointer;
    border: 1px solid transparent;
    transition: background 250ms ease, border-color 250ms ease;
}

.room-item:hover { background: rgba(255, 255, 255, 0.05); }

.room-item.active {
    background: linear-gradient(135deg, rgba(166,110,247,0.18), rgba(92,200,223,0.1));
    border-color: rgba(255, 255, 255, 0.1);
}

.room-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}

.room-icon-0 { background: linear-gradient(135deg, rgba(166,110,247,0.3), rgba(92,200,223,0.2)); }
.room-icon-1 { background: linear-gradient(135deg, rgba(224,96,154,0.3), rgba(166,110,247,0.2)); }
.room-icon-2 { background: linear-gradient(135deg, rgba(74,222,128,0.3), rgba(92,200,223,0.2)); }
.room-icon-3 { background: linear-gradient(135deg, rgba(240,208,96,0.3), rgba(224,96,154,0.2)); }

.room-icon svg { width: 18px; height: 18px; opacity: 0.8; }
.room-info { flex: 1; min-width: 0; }

.room-name {
    font-family: var(--font-display); font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.06em; color: var(--white);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.room-desc {
    font-size: 0.75rem; color: var(--muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.room-badge {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.65rem; color: var(--neon-green); font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
    background: rgba(74,222,128,0.1); flex-shrink: 0;
}

.room-badge-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--neon-green); }

/* ===== CHAT AREA ===== */
.chat-area { flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 0; }

.chat-header {
    padding: 0 1.5rem; height: 60px; min-height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

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

.chat-room-name {
    font-family: var(--font-display); font-size: 0.8rem; font-weight: 700;
    letter-spacing: 0.06em;
}

.chat-online {
    font-size: 0.75rem; color: var(--muted); font-weight: 500;
    display: flex; align-items: center; gap: 5px;
}

.chat-online .online-dot { width: 5px; height: 5px; }

.pin-btn {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 6px 12px; cursor: pointer;
    color: var(--muted); font-family: var(--font-body); font-size: 0.75rem;
    transition: background 200ms ease, color 200ms ease;
}

.pin-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.pin-btn svg { width: 14px; height: 14px; }
.pin-btn.active { color: var(--neon-purple); border-color: rgba(166,110,247,0.2); }

/* Pinned Message */
.pinned-bar {
    max-height: 0; overflow: hidden;
    transition: max-height 300ms var(--ease-out-expo), padding 300ms ease;
    background: linear-gradient(135deg, rgba(166,110,247,0.08), rgba(92,200,223,0.05));
    border-bottom: 1px solid rgba(255,255,255,0.04); padding: 0 1.5rem;
}

.pinned-bar.show { max-height: 80px; padding: 10px 1.5rem; }

.pinned-content {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: var(--muted);
}

.pinned-content svg { width: 14px; height: 14px; color: var(--neon-purple); flex-shrink: 0; }

/* Messages */
.messages-area {
    flex: 1; overflow-y: auto; padding: 1rem 1.5rem;
    display: flex; flex-direction: column; gap: 1rem;
}

.time-divider { text-align: center; padding: 0.5rem 0; }

.time-divider span {
    font-size: 0.68rem; color: var(--muted);
    padding: 3px 14px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    font-weight: 500; letter-spacing: 0.05em;
}

.msg { display: flex; gap: 10px; max-width: 70%; align-items: flex-start; }
.msg.self { flex-direction: row-reverse; margin-left: auto; }

.msg-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 0.65rem; font-weight: 700;
    color: var(--white);
}

.msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg.self .msg-body { align-items: flex-end; }

.msg-meta { display: flex; align-items: center; gap: 8px; }
.msg.self .msg-meta { flex-direction: row-reverse; }

.msg-nick { font-size: 0.82rem; font-weight: 600; color: var(--white); }

.msg-title {
    font-family: var(--font-display); font-size: 0.52rem; font-weight: 600;
    padding: 2px 8px; border-radius: 8px; letter-spacing: 0.06em;
}

.title-admin { background: linear-gradient(135deg, rgba(166,110,247,0.3), rgba(166,110,247,0.15)); color: var(--neon-purple); }
.title-elite { background: linear-gradient(135deg, rgba(92,200,223,0.3), rgba(92,200,223,0.15)); color: var(--neon-cyan); }
.title-member { background: rgba(255,255,255,0.06); color: var(--muted); }
.title-pro { background: linear-gradient(135deg, rgba(224,96,154,0.3), rgba(224,96,154,0.15)); color: var(--neon-pink); }

.msg-bubble {
    padding: 10px 16px; font-size: 0.92rem; line-height: 1.6;
    color: rgba(240,234,255,0.9); word-wrap: break-word;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px 16px 16px 4px;
}

.msg.self .msg-bubble {
    background: linear-gradient(135deg, rgba(166,110,247,0.2), rgba(92,200,223,0.12));
    border-color: rgba(166,110,247,0.12);
    border-radius: 16px 16px 4px 16px;
}

.msg-time { font-size: 0.65rem; color: rgba(154,143,181,0.5); font-weight: 500; }

/* Input Bar */
.input-bar {
    padding: 12px 1.5rem; display: flex; align-items: center; gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

.msg-input {
    flex: 1; padding: 12px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px; outline: none;
    color: var(--white); font-family: var(--font-body);
    font-size: 0.92rem; font-weight: 500;
    transition: border-color 250ms ease, background 250ms ease;
}

.msg-input::placeholder { color: rgba(154,143,181,0.5); }
.msg-input:focus { border-color: rgba(166,110,247,0.3); background: rgba(255, 255, 255, 0.08); }

.send-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: transform 200ms var(--ease-spring), box-shadow 200ms ease;
}

.send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 20px rgba(166,110,247,0.3); }
.send-btn:active { transform: scale(0.92); }
.send-btn svg { width: 20px; height: 20px; color: var(--white); }

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--muted); padding: 4px; transition: color 200ms ease;
}

.sidebar-toggle:hover { color: var(--white); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 49;
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none;
    transition: opacity 300ms ease;
}

/* ===== SCROLLBAR ===== */
.messages-area::-webkit-scrollbar, .room-list::-webkit-scrollbar { width: 3px; }
.messages-area::-webkit-scrollbar-track, .room-list::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb, .room-list::-webkit-scrollbar-thumb { background: rgba(166,110,247,0.3); border-radius: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: 0; top: var(--nav-h); bottom: 0;
        z-index: 50; transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { display: block; }
    .sidebar-backdrop.show { opacity: 1; pointer-events: all; }
    .sidebar-toggle { display: flex; }
    .chat-area { width: 100%; }
    .msg { max-width: 85%; }
    .input-bar { padding: 10px 1rem; }
}

@media (max-width: 480px) {
    .chat-header { padding: 0 1rem; }
    .messages-area { padding: 0.8rem 1rem; }
    .msg { max-width: 90%; }
    .chat-room-name { font-size: 0.7rem; }
}
