/* ============================================
   MircChat - Main Stylesheet
   Retro-Modern Chat Application
   ============================================ */

/* === CSS Variables === */
:root {
    /* Primary Colors - Dark retro theme */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2235;
    --bg-card: #151d2e;
    --bg-hover: #1e293b;
    --bg-active: #253249;

    /* Accent Colors - mIRC inspired */
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-orange: #f97316;
    --accent-pink: #ec4899;

    /* Text Colors */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #00d4ff;

    /* Border */
    --border-color: #1e293b;
    --border-light: #2a3a52;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);

    /* Layout */
    --navbar-height: 60px;
    --sidebar-width: 280px;
    --bottom-nav-height: 65px;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* === Reset & Base === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: #33dfff;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
    background: none;
    color: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   AUTH SCREENS
   ============================================ */
.auth-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

/* Animated Background */
.auth-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.matrix-rain {
    position: absolute;
    inset: 0;
    opacity: 0.08;
}

.matrix-rain .char {
    position: absolute;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    animation: matrixFall linear infinite;
    opacity: 0;
}

@keyframes matrixFall {
    0% {
        opacity: 1;
        transform: translateY(-100%);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh);
    }
}

.auth-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 212, 255, 0.05) 0%, transparent 50%);
}

/* Auth Card */
.auth-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: rgba(21, 29, 46, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: authCardIn 0.6s var(--transition-slow) both;
}

@keyframes authCardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.2); }
    50% { box-shadow: 0 0 40px rgba(0, 212, 255, 0.4); }
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

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

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 1;
}

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

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

.tab-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    transition: transform var(--transition-normal);
    z-index: 0;
}

.auth-tab[data-tab="register"].active ~ .tab-indicator {
    transform: translateX(100%);
}

/* Auth Forms */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: formFadeIn 0.3s ease;
}

.auth-form.active {
    display: flex;
}

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

.form-group {
    width: 100%;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    transition: color var(--transition-fast);
    z-index: 1;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.input-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.input-wrapper select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.input-wrapper input:focus + .input-line,
.input-wrapper select:focus + .input-line {
    transform: scaleX(1);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper select:focus ~ .input-icon {
    color: var(--accent-primary);
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -8px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.checkbox-wrapper input:checked + .checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-wrapper input:checked + .checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
}

.forgot-link {
    font-size: 13px;
    color: var(--accent-primary);
}

/* Auth Button */
.auth-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}

.auth-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.auth-btn:hover::before {
    opacity: 1;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
}

.auth-btn:active {
    transform: translateY(0);
}

.btn-loader {
    display: none;
}

.auth-btn.loading .btn-text { display: none; }
.auth-btn.loading .btn-arrow { display: none; }
.auth-btn.loading .btn-loader { display: inline-block; }

.btn-arrow {
    font-size: 13px;
    transition: transform var(--transition-fast);
}

.auth-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-primary);
}

/* ============================================
   CHAT APPLICATION
   ============================================ */
.chat-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
}

/* === Top Navbar === */
.top-navbar {
    height: var(--navbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    flex-shrink: 0;
}

.navbar-left {
    display: flex;
    align-items: center;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
}

.navbar-logo i {
    color: var(--accent-primary);
    font-size: 22px;
}

.navbar-center {
    display: flex;
    align-items: center;
}

.nav-items {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
}

.nav-badge {
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}

/* Navbar Right - User */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.user-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.user-status-indicator.online { background: var(--accent-green); }
.user-status-indicator.away { background: var(--accent-yellow); }
.user-status-indicator.busy { background: var(--accent-red); }
.user-status-indicator.invisible { background: var(--text-muted); }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.navbar-user:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.user-nick {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.navbar-user .fa-chevron-down {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.navbar-user.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-normal);
}

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

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.dropdown-info {
    display: flex;
    flex-direction: column;
}

.dropdown-nick {
    font-weight: 600;
    font-size: 15px;
}

.dropdown-status {
    font-size: 12px;
    color: var(--accent-green);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 12px;
}

.dropdown-section {
    padding: 8px 12px;
}

.dropdown-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-left: 4px;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.status-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online { background: var(--accent-green); }
.status-dot.away { background: var(--accent-yellow); }
.status-dot.busy { background: var(--accent-red); }
.status-dot.invisible { background: var(--text-muted); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

/* === Main Content Layout === */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--navbar-height));
    height: calc(100dvh - var(--navbar-height));
}

/* === Left Sidebar === */
.sidebar-left {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

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

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h3 i {
    color: var(--accent-primary);
    font-size: 13px;
}

.sidebar-toggle-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
    font-size: 12px;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

/* Sidebar Search */
.sidebar-search {
    padding: 12px 16px;
    position: relative;
}

.sidebar-search i {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

.sidebar-search input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

/* Channel List */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.channel-category {
    margin-bottom: 4px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.category-header:hover {
    background: var(--bg-hover);
}

.category-header i {
    font-size: 8px;
    transition: transform var(--transition-fast);
}

.category-header .category-count {
    margin-left: auto;
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-size: 10px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px 9px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    color: var(--text-secondary);
}

.channel-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.channel-item.active {
    background: var(--bg-active);
    color: var(--accent-primary);
}

.channel-icon {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.channel-item.active .channel-icon {
    color: var(--accent-primary);
}

.channel-name {
    flex: 1;
    font-weight: 500;
}

.channel-users {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.channel-users i {
    font-size: 9px;
}

.channel-unread {
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

/* === Chat Area === */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.chat-header-info h2 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.channel-hash {
    color: var(--text-muted);
    font-weight: 400;
}

.chat-topic {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.header-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-action-btn.active {
    background: var(--bg-active);
    color: var(--accent-primary);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* System Message */
.message-system {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.system-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.message-system i {
    color: var(--accent-primary);
}

/* Event Messages (join/part/quit) */
.message-event,
.message-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.event-icon {
    font-size: 10px;
    color: var(--accent-green);
}

.event-icon.part {
    color: var(--accent-red);
}

.event-time {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.6;
}

.message-action {
    color: var(--accent-pink);
    font-style: italic;
}

/* Regular Messages */
.message {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.message:hover {
    background: var(--bg-hover);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
    cursor: pointer;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.message-nick {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* Nick colors by role */
.message-nick.op {
    color: var(--accent-red);
}

.message-nick.halfop {
    color: var(--accent-orange);
}

.message-nick.voice {
    color: var(--accent-green);
}

.nick-badge {
    font-size: 9px;
}

.message-time {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.6;
}

.message-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* === Chat Input === */
.chat-input-area {
    padding: 12px 20px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    position: relative;
}

.input-toolbar {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 4px 4px 16px;
    transition: border-color var(--transition-fast);
}

.input-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.input-container textarea {
    flex: 1;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-primary);
    resize: none;
    line-height: 1.5;
    max-height: 120px;
    min-height: 22px;
}

.input-container textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

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

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.typing-indicator.active {
    display: flex;
}

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

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

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

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

/* === Right Sidebar === */
.sidebar-right {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-right .sidebar-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.online-count {
    font-size: 12px;
    color: var(--accent-green);
    font-weight: 500;
}

/* User List */
.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.user-category {
    margin-bottom: 8px;
}

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

.user-item:hover {
    background: var(--bg-hover);
}

.user-item-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: white;
    position: relative;
    flex-shrink: 0;
}

.user-item-avatar .status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
}

.user-item-info {
    flex: 1;
    min-width: 0;
}

.user-item-nick {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-item-status {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Mobile Bottom Navigation === */
.bottom-navbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    text-decoration: none;
}

.bottom-nav-item i {
    font-size: 20px;
    transition: all var(--transition-fast);
}

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

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.bottom-badge {
    position: absolute;
    top: 6px;
    right: 50%;
    transform: translateX(14px);
    background: var(--accent-red);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}

/* === Sidebar Overlay (Mobile) === */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* === Toast Notifications === */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 9999;
    animation: toastIn 0.4s ease, toastOut 0.4s ease 3s forwards;
    max-width: 380px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-primary); }

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

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

/* ============================================
   BAN NOTICE
   ============================================ */
.ban-notice {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}
.ban-notice i { font-size: 32px; color: var(--accent-red); margin-bottom: 10px; display: block; }
.ban-notice h3 { color: var(--accent-red); margin-bottom: 8px; }
.ban-notice p { color: var(--text-secondary); font-size: 13px; }

/* ============================================
   MUTE BANNER
   ============================================ */
.mute-banner {
    background: linear-gradient(90deg, rgba(239,68,68,0.15), rgba(249,115,22,0.15));
    border-bottom: 1px solid rgba(239,68,68,0.3);
    padding: 10px 20px;
    flex-shrink: 0;
}
.mute-banner-content {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--accent-red);
}
.mute-countdown { font-family: var(--font-mono); font-weight: 600; }
.chat-input-area.disabled { opacity: 0.5; pointer-events: none; }

/* ============================================
   ANNOUNCEMENT BANNER
   ============================================ */
.announcement-banner {
    background: linear-gradient(90deg, rgba(0,212,255,0.1), rgba(124,58,237,0.1));
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    flex-shrink: 0;
}
.announcement-content {
    display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.announcement-content i { color: var(--accent-primary); }
.announcement-close {
    margin-left: auto; background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 14px; padding: 4px;
}
.announcement-close:hover { color: var(--text-primary); }

/* ============================================
   ADMIN JOIN ANIMATION
   ============================================ */
.admin-join { animation: adminJoinFlash 1s ease; }
@keyframes adminJoinFlash {
    0%, 100% { background: transparent; }
    50% { background: rgba(239,68,68,0.1); }
}
.admin-join-icon { color: var(--accent-red) !important; animation: crownBounce 0.6s ease; }
@keyframes crownBounce {
    0% { transform: scale(0); } 50% { transform: scale(1.3); } 100% { transform: scale(1); }
}
.mod-join { animation: modJoinFlash 1s ease; }
@keyframes modJoinFlash {
    0%, 100% { background: transparent; }
    50% { background: rgba(34,197,94,0.1); }
}
.mod-join-icon { color: var(--accent-green) !important; }

/* ============================================
   TOGGLE USERS BTN - Hide on desktop
   ============================================ */
@media (min-width: 1280px) {
    #toggleUsersBtn { display: none; }
}

/* ============================================
   MUTE/FLOOD NOTICE IN CHAT
   ============================================ */
.chat-mute-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 4px 0;
    background: linear-gradient(90deg, rgba(239,68,68,0.08), rgba(249,115,22,0.08));
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--accent-red);
    animation: muteNoticeIn 0.4s ease;
}
.chat-mute-notice i { font-size: 16px; flex-shrink: 0; }
.chat-mute-notice .mute-info { flex: 1; }
.chat-mute-notice .mute-reason { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.chat-mute-notice .mute-timer { font-family: var(--font-mono); font-weight: 700; font-size: 14px; color: var(--accent-orange); }
@keyframes muteNoticeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Flood warning in chat */
.chat-flood-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 4px 0;
    background: linear-gradient(90deg, rgba(249,115,22,0.08), rgba(245,158,11,0.08));
    border: 1px solid rgba(249,115,22,0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--accent-orange);
    animation: muteNoticeIn 0.4s ease;
}
.chat-flood-notice i { font-size: 16px; flex-shrink: 0; }
.chat-flood-notice .flood-timer { font-family: var(--font-mono); font-weight: 700; }

/* ============================================
   EMOJI PICKER
   ============================================ */
.emoji-picker {
    position: absolute; bottom: 100%; left: 0; right: 0;
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: var(--shadow-lg); max-height: 300px;
    display: flex; flex-direction: column; z-index: 200;
}
.emoji-picker-header { padding: 10px; border-bottom: 1px solid var(--border-color); }
.emoji-picker-header input {
    width: 100%; padding: 8px 12px; background: var(--bg-primary);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 13px;
}
.emoji-picker-tabs {
    display: flex; overflow-x: auto; padding: 4px 8px;
    border-bottom: 1px solid var(--border-color); gap: 4px;
}
.emoji-tab {
    padding: 6px 12px; border-radius: var(--radius-sm); font-size: 11px;
    white-space: nowrap; color: var(--text-muted); border: none; background: none; cursor: pointer;
}
.emoji-tab.active { background: var(--bg-active); color: var(--accent-primary); }
.emoji-picker-grid {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
    padding: 8px; overflow-y: auto; flex: 1;
}
.emoji-item {
    font-size: 22px; padding: 6px; border: none; background: none; cursor: pointer;
    border-radius: var(--radius-sm); transition: background var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.emoji-item:hover { background: var(--bg-hover); }

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative; background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); width: 100%; max-width: 600px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-close {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); color: var(--text-muted); background: none; border: none; cursor: pointer;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

.small-modal { max-width: 440px; }

/* Buttons */
.btn {
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: none;
    transition: all var(--transition-fast);
}
.btn-primary { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(0,212,255,0.3); }
.btn-danger { background: var(--accent-red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-cancel { background: var(--bg-tertiary); color: var(--text-secondary); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-icon {
    width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 13px;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.1); color: var(--accent-red); }

/* ============================================
   PROFILE MODAL
   ============================================ */
.profile-card { display: flex; gap: 20px; align-items: flex-start; }
.profile-info { flex: 1; }
.profile-info h2 { font-size: 20px; margin-bottom: 4px; }
.profile-rank { font-size: 13px; margin-bottom: 12px; }
.profile-details { display: flex; flex-direction: column; gap: 6px; }
.profile-detail { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.profile-detail i { width: 16px; text-align: center; color: var(--text-muted); }
.profile-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-color); flex-wrap: wrap; }
.profile-action-btn {
    padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px;
    display: flex; align-items: center; gap: 6px; cursor: pointer;
    background: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-primary);
}
.profile-action-btn:hover { background: var(--bg-hover); }
.profile-action-btn.danger { border-color: rgba(239,68,68,0.3); color: var(--accent-red); }
.profile-action-btn.danger:hover { background: rgba(239,68,68,0.1); }

/* ============================================
   PM LAYOUT
   ============================================ */
.pm-sidebar { width: 280px; border-right: 1px solid var(--border-color); overflow-y: auto; flex-shrink: 0; }
.pm-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pm-chat-header {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.pm-chat-header span { flex: 1; font-weight: 600; }
.pm-back-btn { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 16px; }
.pm-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.pm-input-area { padding: 12px 16px; border-top: 1px solid var(--border-color); flex-shrink: 0; position: relative; }
.pm-empty { text-align: center; color: var(--text-muted); padding: 40px; }
.pm-empty i { font-size: 40px; margin-bottom: 10px; display: block; }
.pm-empty-list { text-align: center; color: var(--text-muted); padding: 30px; font-size: 13px; }

.pm-conversation-item {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    cursor: pointer; transition: background var(--transition-fast); border-bottom: 1px solid var(--border-color);
}
.pm-conversation-item:hover { background: var(--bg-hover); }
.pm-conversation-item.active { background: var(--bg-active); }
.pm-conv-avatar {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 15px; flex-shrink: 0; position: relative;
}
.pm-conv-avatar .status-dot { position: absolute; bottom: -2px; right: -2px; width: 10px; height: 10px; border: 2px solid var(--bg-card); }
.pm-conv-info { flex: 1; min-width: 0; }
.pm-conv-header { display: flex; justify-content: space-between; align-items: center; }
.pm-conv-nick { font-weight: 600; font-size: 13px; }
.pm-conv-time { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.pm-conv-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-unread-badge {
    background: var(--accent-red); color: white; font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: var(--radius-full); min-width: 18px; text-align: center;
}

.pm-message { max-width: 75%; }
.pm-sent { align-self: flex-end; }
.pm-received { align-self: flex-start; }
.pm-message-content {
    padding: 10px 14px; border-radius: var(--radius-md); font-size: 14px; line-height: 1.5;
    word-wrap: break-word; overflow-wrap: break-word;
}
.pm-sent .pm-message-content { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; border-bottom-right-radius: 4px; }
.pm-received .pm-message-content { background: var(--bg-tertiary); border-bottom-left-radius: 4px; }
.pm-message-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
.pm-sent .pm-message-time { text-align: right; }

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-sidebar {
    width: 200px; border-right: 1px solid var(--border-color); padding: 8px;
    display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; overflow-y: auto;
}
.admin-menu-item {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    color: var(--text-secondary); border: none; background: none; cursor: pointer; text-align: left; width: 100%;
}
.admin-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.admin-menu-item.active { background: var(--bg-active); color: var(--accent-primary); }
.admin-menu-item i { width: 16px; text-align: center; }
.admin-content { flex: 1; overflow-y: auto; padding: 20px; min-width: 0; }
.admin-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.admin-panel-header h4 { font-size: 18px; }
.admin-search-input {
    padding: 8px 14px; background: var(--bg-primary); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; width: 200px;
}
.admin-panel-placeholder, .admin-error {
    text-align: center; color: var(--text-muted); padding: 60px 20px; font-size: 14px;
}
.admin-panel-placeholder i, .admin-error i { font-size: 30px; display: block; margin-bottom: 10px; }
.admin-empty { color: var(--text-muted); text-align: center; padding: 30px; }

/* Admin Table */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border-color); white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); }
.admin-table tr:hover { background: var(--bg-hover); }
.color-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.role-badge { padding: 2px 8px; border-radius: var(--radius-full); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.role-badge.role-admin { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.role-badge.role-supermod { background: rgba(249,115,22,0.15); color: var(--accent-orange); }
.role-badge.role-mod { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.role-badge.role-user { background: rgba(148,163,184,0.15); color: var(--text-muted); }

.admin-section { margin-bottom: 20px; }
.admin-section h5 { font-size: 14px; margin-bottom: 10px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.active-users-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.active-user-card {
    padding: 6px 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm);
    font-size: 12px; display: flex; align-items: center; gap: 6px;
}

/* Profanity tags */
.profanity-words { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.profanity-tag {
    padding: 4px 10px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-full); font-size: 12px; color: var(--accent-red);
    display: flex; align-items: center; gap: 6px;
}
.profanity-tag button { background: none; border: none; color: var(--accent-red); cursor: pointer; font-size: 10px; padding: 0; }
.profanity-add { display: flex; gap: 6px; margin-top: 8px; }
.profanity-add input { padding: 6px 12px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 12px; flex: 1; }

/* Settings form */
.admin-settings-form { max-width: 100%; }
.admin-settings-form .form-group { margin-bottom: 14px; }
.admin-settings-form label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.admin-settings-form input[type="text"],
.admin-settings-form input[type="number"],
.admin-settings-form select {
    width: 100%; padding: 10px 14px; background: var(--bg-primary); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
}
.admin-settings-form input[type="color"] { width: 50px; height: 36px; padding: 2px; border-radius: var(--radius-sm); cursor: pointer; }
.admin-settings-form .form-row { display: flex; gap: 12px; }
.admin-settings-form .form-row .form-group { flex: 1; }
.admin-settings-form textarea { width: 100%; padding: 10px 14px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; resize: vertical; }
.settings-section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.settings-section h5 { font-size: 14px; margin-bottom: 14px; color: var(--accent-primary); }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; justify-content: center; }
.page-btn {
    padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    color: var(--text-secondary); cursor: pointer;
}
.page-btn.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.page-btn:hover:not(.active) { background: var(--bg-hover); }

/* Media embeds */
.media-embed { margin: 8px 0; max-width: 480px; }
.media-embed iframe { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-sm); }
.media-embed img { max-width: 100%; max-height: 300px; border-radius: var(--radius-sm); cursor: pointer; }
.map-link, .social-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm); font-size: 12px; margin-top: 4px; }

/* ============================================
   MOBILE MODAL ADJUSTMENTS
   ============================================ */
@media (max-width: 767px) {
    .profile-card { flex-direction: column; align-items: center; text-align: center; }
    .profile-details { align-items: center; }
    .profile-actions { justify-content: center; }
    .modal-content { max-height: 100vh; max-height: 100dvh; border-radius: var(--radius-md); }
    .modal { padding: 10px; }
    .emoji-picker-grid { grid-template-columns: repeat(7, 1fr); }
}

/* SweetAlert Dark Theme */
.swal-dark-popup {
    background: #1a1f2e !important;
    color: #e2e8f0 !important;
    border: 1px solid #2d3548 !important;
    border-radius: 12px !important;
}
.swal-dark-popup .swal2-title { color: #e2e8f0 !important; font-size: 18px !important; }
.swal-dark-popup .swal2-html-container { color: #94a3b8 !important; }
.swal-dark-popup .swal2-input, .swal-dark-popup .swal2-select, .swal-dark-popup .swal2-textarea {
    background: #0f1219 !important; color: #e2e8f0 !important;
    border: 1px solid #2d3548 !important; border-radius: 6px !important;
}
.swal-dark-popup .swal2-validation-message {
    background: rgba(239,68,68,0.1) !important; color: #ef4444 !important;
}
.swal-dark-popup .swal2-close { color: #94a3b8 !important; }
.swal-dark-popup .swal2-close:hover { color: #e2e8f0 !important; }

/* ============================================
   STATIC PAGE SYSTEM
   ============================================ */
.page-section {
    display: none;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
    overflow: hidden;
}
.page-section.active {
    display: flex;
}

/* Hide left sidebar on desktop when on static pages */
@media (min-width: 768px) {
    .sidebar-left.static-page-hidden {
        display: none;
    }
}

/* Static pages should not have bottom padding from chat input on mobile */
@media (max-width: 767px) {
    .page-section:not(#chatArea) {
        overflow-y: auto;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    .page-section:not(#chatArea) .profile-page-content,
    .page-section:not(#chatArea) .users-page-content,
    .page-section:not(#chatArea) .pm-layout,
    .page-section:not(#chatArea) .admin-page-body {
        padding-bottom: 10px;
    }
}

.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.page-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.page-back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 16px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.page-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   PM PAGE LAYOUT (replaces modal)
   ============================================ */
.pm-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================
   ADMIN PAGE LAYOUT (replaces modal)
   ============================================ */
.admin-page-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================
   USERS PAGE
   ============================================ */
.users-page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.users-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-shrink: 0;
}
.users-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}
.users-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.users-tab.active {
    background: var(--bg-active);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.users-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.users-search-bar i {
    color: var(--text-muted);
}
.users-search-bar input {
    flex: 1;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
}
.users-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    align-content: start;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.user-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
}
.user-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    position: relative;
}
.user-card-avatar .status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--bg-card);
}
.user-card-info {
    flex: 1;
    min-width: 0;
}
.user-card-nick {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.user-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}
.user-card-meta i {
    font-size: 10px;
}
.users-pagination {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}
.users-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    grid-column: 1 / -1;
}
.users-empty i {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ============================================
   PROFILE EDIT PAGE
   ============================================ */
.profile-page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    max-width: 100%;
    width: 100%;
}
.profile-edit-card {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}
.profile-edit-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.profile-avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    color: white;
    overflow: hidden;
}
.profile-edit-info {
    flex: 1;
    min-width: 0;
}
.profile-edit-rank {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-edit-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.profile-stat {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-stat i {
    color: var(--text-muted);
    width: 14px;
    text-align: center;
}
.profile-stat strong {
    color: var(--text-primary);
    margin-left: auto;
}
.profile-edit-form {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}
.profile-edit-form h4 {
    font-size: 15px;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.profile-edit-form .form-group {
    margin-bottom: 14px;
}
.profile-edit-form label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}
.profile-edit-form input[type="text"],
.profile-edit-form input[type="email"],
.profile-edit-form input[type="password"],
.profile-edit-form input[type="number"],
.profile-edit-form select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}
.profile-edit-form input:focus,
.profile-edit-form select:focus {
    border-color: var(--accent-primary);
}
.profile-edit-form .form-row {
    display: flex;
    gap: 12px;
}
.profile-edit-form .form-row .form-group {
    flex: 1;
}
.profile-edit-form .btn {
    margin-top: 8px;
}

/* Mobile adjustments for pages */
@media (max-width: 767px) {
    .page-header {
        padding: 10px 12px;
    }
    .page-header h3 {
        font-size: 14px;
    }
    .page-back-btn {
        width: 32px;
        height: 32px;
    }
    .pm-layout {
        flex-direction: column;
    }
    .pm-sidebar {
        width: 100%;
    }
    .pm-sidebar.pm-sidebar-hidden {
        display: none;
    }
    .pm-chat {
        display: none;
    }
    .pm-chat.pm-chat-active {
        display: flex;
    }
    .pm-back-btn {
        display: block;
    }
    .admin-page-body {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding: 6px 8px;
        flex-shrink: 0;
        gap: 4px;
        min-height: 46px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .admin-sidebar::-webkit-scrollbar { display: none; }
    .admin-menu-item span { display: none; }
    .admin-menu-item { padding: 8px 14px; font-size: 16px; flex-shrink: 0; }
    .admin-content { padding: 12px; overflow-y: auto; flex: 1; min-height: 0; }
    .users-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    .users-tabs {
        padding: 8px 12px;
    }
    .users-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    .profile-page-content {
        padding: 16px;
    }
    .profile-edit-card {
        flex-direction: column;
        text-align: center;
    }
    .profile-edit-stats {
        grid-template-columns: 1fr;
    }
    .profile-stat strong {
        margin-left: 0;
    }
    .profile-edit-form .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ============================================
   FILE SHARING STYLES
   ============================================ */

/* File upload preview bar */
.file-upload-preview {
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.05);
    border-top: 1px solid rgba(0, 212, 255, 0.1);
}
.file-upload-preview.hidden { display: none; }

.file-upload-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}
.file-upload-progress i { color: var(--accent-cyan); }
.file-upload-progress span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-ready {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}
.file-preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
}
.file-preview-icon {
    font-size: 32px;
    width: 48px;
    text-align: center;
}
.file-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.file-preview-info span {
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-preview-info small {
    font-size: 11px;
    color: var(--text-secondary);
}

.file-upload-cancel,
.file-upload-send {
    border: none;
    background: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}
.file-upload-cancel {
    color: var(--text-secondary);
}
.file-upload-cancel:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}
.file-upload-send {
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.1);
}
.file-upload-send:hover {
    background: rgba(0, 212, 255, 0.2);
}

.file-upload-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-red);
    font-size: 13px;
}

/* File message attachments in chat */
.file-msg {
    margin: 4px 0;
    border-radius: 8px;
    overflow: hidden;
}

/* Image file */
.file-msg-image {
    max-width: 360px;
}
.file-msg-image a {
    display: block;
    line-height: 0;
}
.file-msg-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
    object-fit: contain;
}
.file-msg-img:hover { opacity: 0.85; }

.file-msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 2px;
    font-size: 11px;
    color: var(--text-secondary);
}
.file-msg-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}
.file-msg-size {
    color: var(--text-muted);
    white-space: nowrap;
}

/* Audio file */
.file-msg-audio {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    padding: 10px;
    max-width: 360px;
}
.file-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}
.file-msg-header i { font-size: 18px; }
.file-msg-header .file-msg-name {
    flex: 1;
    color: var(--text-primary);
}
.file-audio-player {
    width: 100%;
    height: 36px;
    border-radius: 4px;
    outline: none;
}

/* Video file */
.file-msg-video {
    max-width: 440px;
}
.file-video-player {
    width: 100%;
    max-height: 320px;
    border-radius: 8px;
    background: #000;
}

/* PDF file */
.file-msg-pdf {
    max-width: 440px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    padding: 10px;
}
.file-pdf-viewer {
    width: 100%;
    height: 360px;
    border: none;
    border-radius: 6px;
    margin: 8px 0;
    background: #fff;
}

/* Generic file (documents, archives, etc.) */
.file-msg-generic {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(100, 116, 139, 0.08);
    border: 1px solid rgba(100, 116, 139, 0.15);
    padding: 12px 14px;
    max-width: 360px;
}
.file-generic-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.file-msg-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.file-msg-info .file-msg-name {
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-msg-info .file-msg-size {
    font-size: 11px;
    margin-top: 2px;
}

/* Download button */
.file-msg-download {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(0, 212, 255, 0.08);
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.file-msg-download:hover {
    background: rgba(0, 212, 255, 0.15);
    color: #fff;
}

/* File message in PM */
.pm-message .file-msg {
    max-width: 100%;
}
.pm-message .file-msg-image { max-width: 280px; }
.pm-message .file-msg-audio { max-width: 280px; }
.pm-message .file-msg-video { max-width: 320px; }
.pm-message .file-msg-pdf { max-width: 320px; }
.pm-message .file-msg-generic { max-width: 280px; }

/* PM toolbar */
.pm-toolbar {
    padding: 4px 12px 0;
    border-bottom: none;
}

/* Error state */
.file-msg-error {
    padding: 10px;
    color: var(--accent-red);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Fancybox dark theme override */
.fancybox__container {
    --fancybox-bg: rgba(10, 14, 23, 0.95);
}

/* Responsive */
@media (max-width: 767px) {
    .file-msg-image { max-width: 100%; }
    .file-msg-audio { max-width: 100%; }
    .file-msg-video { max-width: 100%; }
    .file-msg-pdf { max-width: 100%; }
    .file-msg-generic { max-width: 100%; }
    .file-pdf-viewer { height: 240px; }
    .pm-message .file-msg-image,
    .pm-message .file-msg-audio,
    .pm-message .file-msg-video,
    .pm-message .file-msg-pdf,
    .pm-message .file-msg-generic { max-width: 100%; }
}

/* ============================================
   NEW FEATURES - v2
   Message Actions, Edit, Delete, Reactions,
   Mentions, Search, History, Stats, etc.
   ============================================ */

/* === MESSAGE ACTIONS (hover menu) === */
.message-wrapper {
    position: relative;
}

.message-actions {
    position: absolute;
    top: 2px;
    right: 8px;
    display: none;
    gap: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 2px;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.message-wrapper:hover .message-actions {
    display: flex;
}

.message-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.15s;
}

.message-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.message-actions button.action-delete:hover {
    color: var(--accent-red);
}

.message-actions button.action-edit:hover {
    color: var(--accent-yellow);
}

.message-actions button.action-react:hover {
    color: var(--accent-pink);
}

/* === MESSAGE EDIT MODE === */
.message-edit-container {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.message-edit-container input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.message-edit-container button {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.message-edit-container button.cancel-edit {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.message-edited-tag {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 6px;
}

/* === MESSAGE DELETED (soft) === */
.message-deleted {
    opacity: 0.4;
    font-style: italic;
}

.message-deleted .msg-content {
    text-decoration: line-through;
}

/* === REACTIONS === */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    padding-left: 48px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.reaction-badge:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.reaction-badge.reacted {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-primary);
}

.reaction-badge .reaction-emoji {
    font-size: 14px;
}

.reaction-badge .reaction-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Reaction Picker Popup */
.reaction-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 200px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.15s ease;
}

.reaction-picker span {
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.15s;
}

.reaction-picker span:hover {
    background: var(--bg-hover);
}

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

/* === MENTION SYSTEM === */
.mention-tag {
    color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}

.mention-tag:hover {
    background: rgba(0, 212, 255, 0.2);
    text-decoration: underline;
}

/* Mention Autocomplete */
.mention-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 200;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    display: none;
}

.mention-autocomplete.visible {
    display: block;
    animation: fadeInUp 0.15s ease;
}

.mention-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.mention-autocomplete-item:hover,
.mention-autocomplete-item.selected {
    background: var(--bg-hover);
}

.mention-autocomplete-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.mention-autocomplete-item span {
    color: var(--text-primary);
    font-size: 13px;
}

/* Mention notification badge */
.mention-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    padding: 12px 16px;
    z-index: 1000;
    box-shadow: var(--shadow-glow);
    animation: slideInRight 0.3s ease, fadeOut 0.5s ease 4s forwards;
    max-width: 300px;
}

.mention-notification .mention-notif-header {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.mention-notification .mention-notif-body {
    font-size: 13px;
    color: var(--text-secondary);
}

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

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

/* === CHAT SEARCH BAR === */
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.chat-search-bar.hidden {
    display: none;
}

.chat-search-bar input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.chat-search-bar input:focus {
    border-color: var(--accent-primary);
}

.chat-search-bar button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.chat-search-bar button:hover {
    color: var(--text-primary);
}

/* Search highlight */
.search-highlight {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 2px;
    padding: 0 1px;
}

/* === HISTORY CLEARED ANIMATION === */
.history-cleared-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    animation: historyClearedAnim 0.5s ease;
}

.history-cleared-notice i {
    font-size: 48px;
    color: var(--accent-red);
    margin-bottom: 12px;
    animation: bounceIn 0.5s ease;
}

.history-cleared-notice .notice-text {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
}

.history-cleared-notice .notice-admin {
    color: var(--accent-red);
    font-weight: 600;
    font-size: 13px;
    margin-top: 4px;
}

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

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* === FAVORITE STAR === */
.favorite-star {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.2s;
    margin-left: 4px;
}

.favorite-star:hover {
    color: var(--accent-yellow);
}

.favorite-star.favorited {
    color: var(--accent-yellow);
}

.favorite-star.favorited i {
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Favorites section in channel list */
.channel-favorites-section {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.channel-favorites-section .fav-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-yellow);
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* === PM EMOJI PICKER === */
#pmEmojiPicker {
    position: absolute;
    bottom: 50px;
    right: 10px;
    width: 320px;
    max-height: 350px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
}

#pmEmojiPicker.hidden {
    display: none;
}

#pmEmojiPicker .emoji-picker-header {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

#pmEmojiPicker .emoji-picker-header input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}

#pmEmojiPicker .emoji-picker-tabs {
    display: flex;
    overflow-x: auto;
    padding: 4px 8px;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
}

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

#pmEmojiPicker .emoji-picker-grid span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

#pmEmojiPicker .emoji-picker-grid span:hover {
    background: var(--bg-hover);
}

/* === ADMIN STATS PANEL === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-card .stat-icon.blue { color: var(--accent-primary); }
.stat-card .stat-icon.green { color: var(--accent-green); }
.stat-card .stat-icon.purple { color: var(--accent-secondary); }
.stat-card .stat-icon.red { color: var(--accent-red); }
.stat-card .stat-icon.yellow { color: var(--accent-yellow); }
.stat-card .stat-icon.pink { color: var(--accent-pink); }

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Stats chart area */
.stats-chart-section {
    padding: 16px;
}

.stats-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    height: 300px;
}

/* === WEBHOOK/BOT ADMIN PANELS === */
.webhook-item, .bot-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.webhook-item:hover, .bot-item:hover {
    border-color: var(--border-light);
}

.webhook-item .webhook-name, .bot-item .bot-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
}

.webhook-item .webhook-url {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    word-break: break-all;
}

.webhook-item .webhook-meta, .bot-item .bot-meta {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.webhook-item .badge, .bot-item .badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.badge-event {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-primary);
}

/* Bot trigger type badges */
.badge-command {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-secondary);
}

.badge-keyword {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.badge-interval {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
}

/* === FILE PERMISSIONS PANEL === */
.file-perm-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.file-perm-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-perm-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.file-perm-user .perm-username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.file-perm-user .perm-role {
    font-size: 11px;
    color: var(--text-muted);
}

.file-perm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === ROOM MODERATORS === */
.room-mod-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.room-mod-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-mod-info img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.room-mod-info span {
    font-size: 13px;
    color: var(--text-primary);
}

/* === USER BLOCKING UI === */
.blocked-users-list {
    padding: 12px;
}

.blocked-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 6px;
}

.blocked-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.blocked-user-info img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.blocked-user-info span {
    font-size: 13px;
    color: var(--text-primary);
}

.unblock-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.15s;
}

.unblock-btn:hover {
    background: var(--accent-red);
    color: white;
}

/* === NOTIFICATION SETTINGS === */
.notification-settings {
    padding: 16px;
}

.notif-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.notif-setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 13px;
}

.notif-setting-label i {
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 22px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-tertiary);
    border-radius: 11px;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: var(--accent-primary);
}

/* === RANK UP NOTIFICATION === */
.rank-up-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.rank-up-card {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-yellow);
    border-radius: 16px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 0 60px rgba(245, 158, 11, 0.3);
    animation: rankUpBounce 0.6s ease;
    max-width: 360px;
}

.rank-up-card .rank-up-icon {
    font-size: 56px;
    margin-bottom: 16px;
    animation: sparkle 1.5s ease infinite;
}

.rank-up-card .rank-up-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-yellow);
    margin-bottom: 8px;
}

.rank-up-card .rank-up-name {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 16px;
}

.rank-up-card .rank-up-close {
    background: var(--accent-yellow);
    color: var(--bg-primary);
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s;
}

.rank-up-card .rank-up-close:hover {
    transform: scale(1.05);
}

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

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === ROOM HISTORY MANAGER (Admin Modal) === */
.history-manager {
    max-height: 70vh;
    overflow-y: auto;
}

.history-manager .history-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.history-manager .history-toolbar input {
    flex: 1;
    min-width: 150px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.history-manager .history-toolbar button {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
}

.history-msg-item {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.history-msg-item:hover {
    background: var(--bg-hover);
}

.history-msg-item .msg-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.history-msg-item .msg-user {
    font-weight: 600;
    color: var(--accent-primary);
    white-space: nowrap;
}

.history-msg-item .msg-text {
    color: var(--text-secondary);
    flex: 1;
    word-break: break-word;
}

/* History pagination */
.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 12px;
}

.history-pagination button {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.history-pagination button:hover {
    background: var(--bg-hover);
}

.history-pagination button.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.history-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === ROOM FILES MANAGER === */
.files-manager .file-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.files-manager .file-list-item:hover {
    background: var(--bg-hover);
}

.files-manager .file-list-item input[type="checkbox"] {
    accent-color: var(--accent-primary);
}

.files-manager .file-list-item .file-icon {
    font-size: 24px;
    color: var(--text-muted);
    width: 32px;
    text-align: center;
}

.files-manager .file-list-item .file-info {
    flex: 1;
}

.files-manager .file-list-item .file-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.files-manager .file-list-item .file-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

/* Select all bar */
.files-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.files-select-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}

/* === ADMIN ACTION BUTTONS (common) === */
.admin-action-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.admin-action-btn.btn-danger {
    color: var(--accent-red);
}

.admin-action-btn.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
}

.admin-action-btn.btn-primary {
    color: var(--accent-primary);
}

.admin-action-btn.btn-primary:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-primary);
}

.admin-action-btn.btn-success {
    color: var(--accent-green);
}

.admin-action-btn.btn-success:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--accent-green);
}

.admin-action-btn.btn-warning {
    color: var(--accent-yellow);
}

.admin-action-btn.btn-warning:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-yellow);
}

/* === ROOM FILE SHARING TOGGLE === */
.room-file-sharing-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin: 8px 0;
}

.room-file-sharing-toggle span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* === RESPONSIVE ADJUSTMENTS FOR NEW FEATURES === */
@media (max-width: 767px) {
    .message-actions {
        top: -28px;
        right: 4px;
    }

    .reaction-picker {
        left: auto;
        right: 0;
    }

    .mention-autocomplete {
        left: 0;
        right: 0;
        min-width: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card .stat-value {
        font-size: 24px;
    }

    #pmEmojiPicker {
        width: 280px;
        right: 4px;
    }

    .mention-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .rank-up-card {
        margin: 20px;
        padding: 30px 20px;
    }

    .history-manager .history-toolbar {
        flex-direction: column;
    }

    .webhook-item .webhook-meta, .bot-item .bot-meta {
        flex-wrap: wrap;
    }

    .files-manager .file-list-item .file-meta {
        flex-direction: column;
        gap: 2px;
    }
}
