/* ============================================
   CHATIZM - Modern Live Chat Platform
   Inspired by Chatango
   ============================================ */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/inter-300.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter-400.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter-500.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter-600.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter-700.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/inter-800.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('../fonts/inter-900.ttf') format('truetype');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/jetbrains-400.ttf') format('truetype');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/jetbrains-500.ttf') format('truetype');
}

/* ============ CSS VARIABLES ============ */
:root {
    /* Premium Ivory & Orange Theme */
    --bg-primary: #FAF9F6;
    --bg-secondary: #F2F0E9;
    --bg-tertiary: #EBE8DF;
    --bg-card: #FFFFFF;
    --bg-hover: #F5F3EF;
    --bg-input: #FFFFFF;
    --bg-chat: #FAF9F6;
    --bg-msg: transparent;
    --bg-msg-own: transparent;

    --accent-primary: #FF8C42;
    --accent-secondary: #E07030;
    --accent-glow: rgba(255, 140, 66, 0.15);
    --accent-gradient: linear-gradient(135deg, #FF8C42, #FF6B1A);
    --accent-gradient-hover: linear-gradient(135deg, #E07030, #D05A10);

    --success: #43A047;
    --warning: #FB8C00;
    --danger: #E53935;
    --info: #1E88E5;

    --text-primary: #2C2621;
    --text-secondary: #5C544E;
    --text-muted: #8E847B;
    --text-accent: #ffffff;

    --border-color: rgba(255, 140, 66, 0.15);
    --border-light: rgba(0, 0, 0, 0.05);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(255, 140, 66, 0.1);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 50%;

    --transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    --transition-fast: all 0.15s ease;
}

/* ============ EMBED (DARK) THEME ============ */
body.embed-mode.theme-dark {
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-tertiary: #2C2C2C;
    --bg-card: #1E1E1E;
    --bg-hover: #2C2C2C;
    --bg-input: #2C2C2C;
    --bg-chat: #121212;

    --text-primary: #E0E0E0;
    --text-secondary: #B0B0B0;
    --text-muted: #7A7A7A;

    --border-color: rgba(255, 140, 66, 0.25);
    --border-light: rgba(255, 255, 255, 0.08);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(255, 140, 66, 0.15);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ============ RESET & BASE ============ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 15% 15%, rgba(255, 140, 66, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 85%, rgba(255, 107, 26, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ============ NAVBAR ============ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(250, 249, 246, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 140, 66, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-wrap: nowrap !important;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 12px;
    }

    .navbar-brand {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1.2rem;
    }

    .navbar-logo {
        height: 38px;
    }
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.navbar-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.navbar-logo:hover {
    transform: scale(1.05);
}

.navbar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    -webkit-text-fill-color: white;
    box-shadow: var(--shadow-glow);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    color: var(--text-primary);
    flex-shrink: 0;
}

.navbar-toggle:hover {
    background: var(--bg-hover);
}

.navbar-toggle span {
    display: block;
    width: 22px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 4px;
    transition: var(--transition);
}

.navbar-nav .nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-nav .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.navbar-nav .nav-link.active {
    color: white;
    background: var(--accent-primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.nav-user:hover {
    background: var(--bg-hover);
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.nav-username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    overflow: hidden;
    z-index: 1001;
}

.nav-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown a,
.nav-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
    font-family: inherit;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-dropdown .divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* ============ MAIN LAYOUT ============ */
.main-content {
    padding-top: 64px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    padding: 0 20px;
}

/* ============ HERO SECTION ============ */
.hero {
    text-align: center;
    padding: 80px 20px 60px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 140, 66, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    margin-bottom: 16px;
    line-height: 1.1;
}

.hero h1 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 6px 25px rgba(255, 140, 66, 0.5);
    transform: translateY(-2px);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #e17055, #d63031);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(225, 112, 85, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* ============ FORM ELEMENTS ============ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.card-body {
    padding: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ============ CHANNEL GRID ============ */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.channel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.channel-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
}

.channel-card:hover::before {
    opacity: 1;
}

.channel-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.channel-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    background: var(--accent-gradient);
}

.channel-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.channel-owner {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.channel-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.channel-stats {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.channel-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.channel-stat .online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
    }

    50% {
        box-shadow: 0 0 16px rgba(0, 184, 148, 0.8);
    }
}

/* ============ SEARCH BAR ============ */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto 30px;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============ CHAT LAYOUT ============ */
.chat-container {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
    background: var(--bg-primary);
    border-radius: 0;
}



.chat-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.member-item:hover {
    background: var(--bg-hover);
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.member-avatar .status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--text-muted);
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ============ CHAT MAIN ============ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-chat);
}

.chat-header {
    padding: 14px 24px;
    background: rgba(250, 249, 246, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 140, 66, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-header-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

/* ============ MESSAGES AREA ============ */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.message {
    display: flex;
    gap: 16px;
    padding: 4px 24px;
    margin-top: 12px;
    border-radius: 0;
    transition: background 0.15s ease;
    animation: messageSlideIn 0.3s ease;
    position: relative;
}

/* Consecutive messages from same user (compact mode logic logic needed in JS, but for now standard spacing) */

.message:hover {
    background: rgba(255, 255, 255, 0.02);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-top: 2px;
    cursor: pointer;
    transition: opacity 0.1s;
}

.message-avatar:hover {
    opacity: 0.8;
}

.message-content {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
}

.message-header {
    display: flex;
    align-items: baseline;
    /* Align timestamp with name */
    gap: 8px;
    margin-bottom: 2px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.message-author {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
}

.message-author:hover {
    text-decoration: underline;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
    opacity: 0.7;
}

.message-text {
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-actions {
    position: absolute;
    right: 16px;
    top: -16px;
    /* Floating above container on hover */
    background: var(--bg-primary);
    /* Match bg */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0;
    display: flex;
    opacity: 0;
    transition: opacity 0.1s;
    pointer-events: none;
    /* Interactable only when shown */
    box-shadow: 0 0 0 1px rgba(4, 4, 5, 0.15);
    z-index: 10;
}

.message:hover .message-actions {
    opacity: 1;
    pointer-events: auto;
}

.message-action-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-muted);
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.message-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.message-action-btn:last-child:hover {
    color: var(--danger);
}

.message.system-message {
    justify-content: center;
    padding: 4px 0;
}

.message.system-message .message-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* ============ CHAT INPUT (Discord Style) ============ */
.chat-input-container {
    padding: 0 16px 24px;
    background: var(--bg-primary);
    /* Matches main chat bg */
    border-top: none;
    flex-shrink: 0;
    z-index: 10;
}

.chat-input-wrapper {
    background: var(--bg-input);
    /* #40444b */
    border-radius: 8px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.chat-input {
    flex: 1;
    padding: 11px 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    max-height: 50vh;
}

.chat-input:focus {
    outline: none;
    box-shadow: none;
    border-color: transparent;
}

.chat-send-btn {
    background: var(--accent-primary);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    background: transparent;
    color: var(--accent-primary);
    transform: scale(1.08);
}

.btn-input-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-input-action:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* ============ RIGHT SIDEBAR (Discord Style) ============ */
.chat-sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--bg-tertiary);
    /* Shadow border */
    overflow-y: auto;
    padding: 24px 8px;
    /* Top padding */
}

.chat-sidebar header {
    padding: 0 16px 16px;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ============ AUTH PAGES ============ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: var(--radius-xl);
    background: var(--accent-gradient);
    z-index: -1;
    opacity: 0.1;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header .logo {
    font-size: 2rem;
    font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.auth-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    margin-bottom: 16px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-secondary);
    font-weight: 600;
}


.badge-ch-admin {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    padding: 1px 4px;
    font-size: 0.65rem;
}

.badge-ch-mod {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    padding: 1px 4px;
    font-size: 0.65rem;
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============ ADMIN PANEL ============ */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.admin-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.admin-nav-item:hover,
.admin-nav-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-right: 3px solid var(--accent-primary);
}

.admin-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ TABLE ============ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success {
    background: linear-gradient(135deg, #00b894, #00a383);
}

.toast-error {
    background: linear-gradient(135deg, #e17055, #d63031);
}

.toast-info {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
}

.toast-warning {
    background: linear-gradient(135deg, #fdcb6e, #f39c12);
    color: #333;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ============ CONTEXT MENU ============ */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 2500;
    overflow: hidden;
    display: none;
}

.context-menu.show {
    display: block;
    animation: contextIn 0.15s ease;
}

@keyframes contextIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.context-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: rgba(225, 112, 85, 0.1);
}

/* ============ LOADING ============ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ TYPING INDICATOR ============ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    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%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .rooms-sidebar {
        position: fixed;
        left: -240px;
        top: 64px;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .rooms-sidebar.show {
        left: 0;
    }

    .hero h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .hero::before {
        width: 300px;
        height: 300px;
    }

    .hero p {
        font-size: 0.95rem;
        margin-bottom: 30px;
    }

    .channels-grid {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        position: fixed;
        right: -260px;
        left: auto;
        top: 64px;
        bottom: 0;
        z-index: 1001;
        transition: right 0.3s ease;
        border-left: 1px solid var(--border-color);
        border-right: none;
    }

    .chat-sidebar.show {
        right: 0;
        left: auto;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding: 5px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 64px;
        z-index: 100;
        background: var(--bg-primary);
        gap: 5px;
        scrollbar-width: none;
        /* Hide scrollbar for cleaner look */
    }

    .admin-sidebar::-webkit-scrollbar {
        display: none;
    }

    .admin-nav-item {
        padding: 10px 16px;
        white-space: nowrap;
        width: auto;
        border-radius: var(--radius-sm);
        border: 1px solid transparent;
    }

    .admin-nav-item.active {
        border-right: none;
        border: 1px solid var(--accent-primary);
        background: var(--accent-glow);
    }

    .admin-content {
        padding: 16px;
    }

    .navbar {
        padding: 0 16px;
        display: flex !important;
        justify-content: space-between !important;
    }

    #navbarToggle {
        display: flex !important;
        background: var(--bg-tertiary) !important;
        border: 1.5px solid var(--accent-primary) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .navbar-nav {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 10px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        transform: translateY(-150%);
        transition: transform 0.3s ease;
        visibility: hidden;
        z-index: 999;
    }

    .navbar-nav.show {
        display: flex;
        transform: translateY(0);
        visibility: visible;
    }

    .lang-switcher {
        margin-right: 0 !important;
        margin-bottom: 15px;
        justify-content: center;
        border-bottom: 1px solid var(--border-light);
        padding-bottom: 15px;
    }

    .nav-user {
        margin-top: 10px;
        border-top: 1px solid var(--border-light);
        padding-top: 15px;
    }

    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding-left: 20px;
        display: none;
    }

    .nav-user .nav-dropdown.show {
        display: block;
    }

    .chat-input-container {
        padding: 8px 10px;
    }

    .chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .messages-area {
        height: calc(100vh - 130px);
    }
}

.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }
}

/* ============ SECTION TITLES ============ */
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.section-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ============ TABS ============ */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    position: relative;
    transition: var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-secondary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px 2px 0 0;
}

/* ============ USER PROFILE ============ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.profile-info .role-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============ CHANNEL SETTINGS ============ */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.settings-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }
}

/* ============ ONLINE COUNT ============ */
.online-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--success);
    font-weight: 600;
}

.online-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

/* ============ DM (DIRECT MESSAGES) ============ */
.dm-layout {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.dm-conversations {
    width: 340px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.dm-conversations-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dm-conversations-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
}

.dm-search {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
}

.dm-search input {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.dm-search input:focus {
    border-color: var(--accent-primary);
}

.dm-search input::placeholder {
    color: var(--text-muted);
}

.dm-list {
    flex: 1;
    overflow-y: auto;
}

.dm-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: inherit;
    position: relative;
}

.dm-conv-item:hover {
    background: var(--bg-hover);
}

.dm-conv-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

.dm-conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.dm-conv-avatar .status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.dm-conv-info {
    flex: 1;
    min-width: 0;
}

.dm-conv-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dm-conv-name .dm-time {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.dm-conv-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dm-unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

.dm-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--bg-chat);
}

.dm-chat-header {
    padding: 12px 20px;
    background: rgba(250, 249, 246, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 140, 66, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.dm-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.dm-chat-header-info {
    flex: 1;
}

.dm-chat-header-name {
    font-size: 1rem;
    font-weight: 700;
}

.dm-chat-header-status {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.dm-message {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    animation: messageSlideIn 0.3s ease;
    max-width: 75%;
}

.dm-message.sent {
    margin-left: auto;
    flex-direction: row-reverse;
}

.dm-message.received {
    margin-right: auto;
}

.dm-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: white;
    flex-shrink: 0;
    margin-top: 4px;
}

.dm-msg-bubble {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.dm-message.received .dm-msg-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}

.dm-message.sent .dm-msg-bubble {
    background: var(--accent-gradient);
    color: white;
    border-top-right-radius: 4px;
}

.dm-msg-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}

.dm-message.sent .dm-msg-wrapper {
    flex-direction: row-reverse;
}

.dm-msg-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
    opacity: 0.8;
}

.dm-message.sent .dm-msg-time {
    color: var(--text-muted);
}

.dm-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}

.dm-empty-state .empty-icon {
    font-size: 4rem;
    opacity: 0.4;
}

.dm-empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.dm-empty-state p {
    font-size: 0.88rem;
    max-width: 300px;
    text-align: center;
}

/* DM nav badge */
.nav-dm-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    animation: pulse-dot 2s ease-in-out infinite;
}

@media (max-width: 768px) {
    .dm-layout {
        position: relative;
    }

    .dm-conversations {
        width: 100%;
        position: absolute;
        inset: 0;
        z-index: 10;
        display: flex;
        transition: transform 0.3s ease, visibility 0.3s ease;
    }

    .dm-chat-area {
        width: 100%;
        position: absolute;
        inset: 0;
        z-index: 5;
        display: flex;
    }

    /* When a chat is active, slide the list out and bring chat to front */
    .dm-layout.show-chat .dm-conversations {
        transform: translateX(-100%);
        visibility: hidden;
    }

    .dm-layout.show-chat .dm-chat-area {
        z-index: 15;
    }

    .dm-message {
        max-width: 90%;
    }
}

/* Banned List in Modal */
.banned-list {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.banned-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
}

.banned-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.banned-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.banned-user-details {
    display: flex;
    flex-direction: column;
}

.banned-username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.banned-reason {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.moderator-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.mod-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mod-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}


/* Quick Mod Panel */
.mod-panel-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.mod-panel-trigger {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.mod-panel-trigger:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mod-quick-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.mod-quick-menu.show {
    display: flex;
}

.mod-menu-item {
    padding: 10px 15px;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-fast);
}

.mod-menu-item:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
}

.mod-menu-item:hover {
    background: var(--bg-hover);
    color: var(--accent-secondary);
}

/* Emoji Picker */
.emoji-picker-container {
    position: absolute;
    bottom: 70px;
    right: 20px;
    width: 300px;
    height: 250px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.emoji-picker-container.show {
    display: flex;
}

.emoji-header {
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.emoji-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 5px;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: var(--bg-hover);
}

/* Embed Specific Adjustments */
.btn-input-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
}

.btn-input-action:hover {
    color: var(--accent-primary);
    background: var(--bg-hover);
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============ USER CARD ============ */
.user-card-modal {
    position: fixed;
    z-index: 9999;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 280px;
    padding: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: cardAppear 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.user-card-header {
    height: 80px;
    background: var(--accent-gradient);
    position: relative;
    cursor: move;
}

.user-card-avatar-wrap {
    position: absolute;
    bottom: -40px;
    left: 20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 4px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.user-card-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
}

.user-card-body {
    padding: 50px 20px 20px;
}

.user-card-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-card-status {
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online {
    background: #43A047;
    box-shadow: 0 0 8px rgba(67, 160, 71, 0.5);
}

.status-offline {
    background: #8E847B;
}

.user-card-bio {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.user-card-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.user-card-btn {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-card-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.user-card-btn.primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

.user-card-btn.primary:hover {
    color: white;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
}

/* ============ IMAGE WIDGET (DRAGGABLE/RESIZABLE) ============ */
.chat-image-wrap {
    margin-top: 5px;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: zoom-in;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
}

.chat-image-wrap:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.chat-img-thumb {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.image-widget-container {
    position: fixed;
    bottom: 20px;
    right: 320px;
    /* Offset from sidebar */
    width: 450px;
    height: 450px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    overflow: hidden;
}

/* Youtube Embedding Components */
.yt-widget-container {
    position: fixed;
    bottom: 30px;
    right: 340px;
    width: 480px;
    height: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    overflow: hidden;
}

.yt-widget-container.show {
    opacity: 1;
    visibility: visible;
}

.yt-widget-header {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    flex: 0 0 auto;
}

.yt-widget-header:active {
    cursor: grabbing;
}

.yt-widget-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.yt-widget-body {
    position: relative;
    width: 100%;
    flex: 1;
    background: #000;
    overflow: hidden;
}

.yt-widget-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.chat-youtube-wrap {
    display: inline-block;
    vertical-align: middle;
}

.chat-youtube-wrap:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    transition: transform 0.2s ease, box-shadow 0.2s;
}

.image-widget-container.show {
    opacity: 1;
    visibility: visible;
}

.image-widget-header {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    flex: 0 0 auto;
}

.image-widget-header:active {
    cursor: grabbing;
}

.image-widget-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
}

.image-widget-actions {
    display: flex;
    gap: 5px;
}

.image-widget-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    transition: var(--transition);
}

.image-widget-btn:hover {
    color: var(--text-primary);
}

.image-widget-body {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02);
}

.image-widget-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
    will-change: transform;
}

.image-widget-body img:active {
    cursor: grabbing;
}

/* Badge Styles are kept at the end */


/* Badge Styles */
.badge {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.35rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    line-height: 1.4;
}

.badge-root {
    background: var(--danger);
}

.badge-admin {
    background: #7b0000;
}

/* Matches dark red in image */
.badge-mod {
    background: var(--success);
}

.badge-user {
    background: #546e7a;
}

/* Hide user badge in chat and DMs but keep on profile/admin */
.message-header .badge-user,
.dm-message .badge-user {
    display: none;
}