/* ═══════════════════════════════════════════════════════
   NoDiscord — Dark Theme CSS
   ═══════════════════════════════════════════════════════ */

:root {
    /* Colors */
    --bg-darkest: #1a1b1e;
    --bg-dark: #1e1f22;
    --bg-sidebar: #2b2d31;
    --bg-content: #313338;
    --bg-input: #383a40;
    --bg-hover: #35373c;
    --bg-active: #404249;
    --bg-elevated: #3a3c42;

    --text-primary: #f2f3f5;
    --text-secondary: #b5bac1;
    --text-muted: #6d6f78;
    --text-link: #00a8fc;

    --accent: #7c5bf5;
    --accent-hover: #6a4de0;
    --accent-light: rgba(124, 91, 245, 0.15);
    --accent-gradient: linear-gradient(135deg, #7c5bf5 0%, #5b8af5 100%);

    --green: #43b581;
    --green-dim: rgba(67, 181, 129, 0.2);
    --red: #f04747;
    --red-dim: rgba(240, 71, 71, 0.15);
    --yellow: #faa61a;
    --orange: #f57c5b;

    /* Layout */
    --sidebar-width: 260px;
    --users-width: 240px;
    --header-height: 52px;
    --voice-bar-height: 56px;

    /* Effects */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px 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(124, 91, 245, 0.3);

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

input {
    font-family: inherit;
}

.hidden {
    display: none !important;
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-active);
    border-radius: 3px;
}

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

/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════ */

.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darkest);
    z-index: 100;
}

.login-bg-orbs {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 8s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #7c5bf5;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: #5b8af5;
    bottom: -80px;
    right: -80px;
    animation-delay: -3s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: #f57c5b;
    top: 50%;
    left: 60%;
    animation-delay: -5s;
}

@keyframes float {

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

    33% {
        transform: translate(30px, -20px) scale(1.05);
    }

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

.login-card {
    position: relative;
    z-index: 10;
    background: rgba(43, 45, 49, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 420px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

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

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

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

    50% {
        transform: scale(1.05);
    }
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.auth-tab.active {
    background: var(--accent);
    color: white;
}

.auth-tab:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.auth-form.hidden {
    display: none;
}

.auth-error {
    background: rgba(240, 71, 71, 0.15);
    border: 1px solid rgba(240, 71, 71, 0.3);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    animation: shakeError 0.3s ease;
}

.auth-error.hidden {
    display: none;
}

@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-input);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-active);
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════
   MAIN APP LAYOUT
   ═══════════════════════════════════════════════════════ */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--users-width);
    grid-template-rows: 1fr auto;
    height: 100vh;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Sidebar ──────────────────────────────────────────── */

.sidebar {
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.3);
    grid-column: 1;
    grid-row: 1 / 3;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow-sm);
}

.brand-name {
    font-weight: 700;
    font-size: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}

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

/* Room list */
.room-list li {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Consistent gap between name and icons */
    /* justify-content: space-between; <-- Removed to prevent alignment issues */
    justify-content: flex-start;
    transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
}

.room-list li span:first-child {
    flex: 1;
    /* Name takes available space pushing others to right */
    text-align: left;
    /* Force alignment */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-list li:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.room-list li.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

.room-user-count {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Sidebar Footer / User Panel */
.sidebar-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.3);
    padding: 8px;
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

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

.user-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
}

.status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 3px solid var(--bg-sidebar);
}

.status-dot.online {
    background: var(--green);
}

.status-dot.speaking {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.status-dot.streaming {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-info .username {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .user-status {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Main Content ─────────────────────────────────────── */

.main-content {
    display: flex;
    flex-direction: column;
    background: var(--bg-content);
    min-width: 0;
    grid-column: 2;
}

.chat-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.channel-hash {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-muted);
}

.channel-users {
    margin-left: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.channel-info h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.room-info {
    margin-left: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Connect Voice Button */
.btn-connect-voice {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--accent), #5b8af5);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-connect-voice:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(124, 91, 245, 0.4);
}

.btn-connect-voice.hidden {
    display: none;
}

/* Waveform Canvas */
.waveform-canvas {
    width: 120px;
    height: 32px;
    margin-left: auto;
    flex-shrink: 0;
}

.waveform-canvas.hidden {
    display: none;
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 8px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
}

.message {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    animation: messageIn 0.25s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
}

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

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.message-username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.message-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

.message.system-message {
    justify-content: center;
    padding: 4px 0;
}

.message.system-message .message-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* Message Input */
.message-input-container {
    padding: 0 16px 16px;
    flex-shrink: 0;
}

.message-form {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 4px 4px 4px 16px;
    border: 2px solid transparent;
    transition: border-color var(--transition);
}

.message-form:focus-within {
    border-color: rgba(124, 91, 245, 0.3);
}

.message-form input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 8px 0;
}

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

.btn-send {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color var(--transition), background var(--transition);
}

.btn-send:hover {
    color: var(--accent);
    background: var(--accent-light);
}

/* ── Users Panel ──────────────────────────────────────── */

.users-panel {
    background: var(--bg-sidebar);
    border-left: 1px solid rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    grid-column: 3;
    grid-row: 1 / 3;
}

.users-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow-sm);
}

.users-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background var(--transition);
}

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

.user-item .avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.user-item .name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-item .badges {
    display: flex;
    gap: 4px;
    align-items: center;
}

.badge {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge svg {
    width: 14px;
    height: 14px;
}

.badge.muted svg {
    stroke: var(--red);
}

.badge.deafened svg {
    stroke: var(--red);
}

.badge.streaming svg {
    stroke: var(--accent);
}

.user-item.speaking {
    background: var(--green-dim);
}

.user-item.speaking .avatar-sm {
    box-shadow: 0 0 0 2px var(--green);
}

/* Stream viewer — floating window */
.stream-viewer {
    position: fixed;
    z-index: 50;
    bottom: 80px;
    right: 20px;
    width: 480px;
    height: 310px;
    min-width: 320px;
    min-height: 220px;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    animation: streamIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.stream-viewer:hover {
    box-shadow: 0 16px 56px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(124, 91, 245, 0.2);
}

.stream-viewer.fullscreen {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
    z-index: 999;
}

.stream-viewer.minimized {
    width: 320px !important;
    height: 200px !important;
}

.stream-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.stream-header:active {
    cursor: grabbing;
}

.stream-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stream-live-badge {
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.stream-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.stream-header-buttons {
    display: flex;
    gap: 2px;
}

.stream-header-buttons .btn-icon {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity var(--transition), background var(--transition);
}

.stream-header-buttons .btn-icon:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.stream-video-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.stream-viewer video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Resize handle */
.stream-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    z-index: 10;
}

.stream-resize-handle::before {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.stream-viewer:hover .stream-resize-handle::before {
    border-color: rgba(255, 255, 255, 0.4);
}

.stream-viewer.fullscreen .stream-resize-handle {
    display: none;
}

/* ── Voice Controls Bar ───────────────────────────────── */

.voice-controls {
    grid-column: 2;
    height: var(--voice-bar-height);
    background: var(--bg-dark);
    border-top: 1px solid rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

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

.voice-indicator {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--green);
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.voice-channel-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
}

.voice-buttons {
    display: flex;
    gap: 4px;
}

.btn-voice {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}

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

.btn-voice.active {
    background: var(--red-dim);
    color: var(--red);
}

.btn-voice.active:hover {
    background: var(--red);
    color: white;
}

.btn-disconnect {
    color: var(--text-secondary);
}

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

.btn-voice.streaming-active {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-voice.streaming-active:hover {
    background: var(--accent);
    color: white;
}

/* ── Modal ────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 420px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    animation: cardIn 0.3s ease;
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 900px) {
    .app {
        grid-template-columns: 60px 1fr;
    }

    .users-panel {
        display: none;
    }

    .brand-name {
        display: none;
    }

    .sidebar-section .section-header span {
        display: none;
    }

    .room-list li {
        justify-content: center;
        padding: 10px;
    }

    .room-user-count {
        display: none;
    }
}

@media (max-width: 600px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

/* ── Toast Notifications ──────────────────────────────── */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(43, 45, 49, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    min-width: 320px;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
}

.toast.toast-removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }

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

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.toast-message strong {
    color: var(--text-primary);
    font-weight: 600;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    font-size: 16px;
    line-height: 1;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: toastProgress 8s linear forwards;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.toast.toast-warning {
    border-left: 3px solid var(--yellow);
}

.toast.toast-error {
    border-left: 3px solid var(--red);
}

.toast.toast-info {
    border-left: 3px solid var(--accent);
}

/* ── File Upload & Media ────────────────────────────── */
#btn-upload {
    margin-right: 8px;
    color: var(--text-muted);
}

#btn-upload:hover {
    color: var(--text-primary);
}

.message-media {
    margin-top: 6px;
    max-width: 100%;
}

.message-media img,
.message-media video {
    max-width: 400px;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
}

.message-media audio {
    width: 100%;
    max-width: 400px;
    margin-top: 4px;
}

.message-file {
    margin-top: 6px;
}

.message-file a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 10px 14px;
    border-radius: 4px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.message-file a:hover {
    background: var(--bg-active);

}

/* ═══════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS
   ═══════════════════════════════════════════════════════ */

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
        /* Slightly wider for better touch targets */
        --users-width: 260px;
    }

    .app {
        grid-template-columns: 1fr;
        /* Single column layout */
        grid-template-rows: 1fr auto;
        /* Content + Voice controls */
        position: relative;
    }

    /* Sidebars hidden by default */
    .sidebar,
    .users-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 100;
        box-shadow: var(--shadow-lg);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        /* Ensure flex layout works */
        flex-direction: column;
        background: var(--bg-sidebar);
    }

    .sidebar {
        left: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    .users-panel {
        right: 0;
        width: var(--users-width);
        transform: translateX(100%);
        border-left: 1px solid rgba(0, 0, 0, 0.3);
    }

    /* Active states for sidebars */
    .sidebar.active {
        transform: translateX(0);
    }

    .users-panel.active {
        transform: translateX(0);
    }

    /* Main Content takes full width */
    .main-content {
        grid-column: 1;
        width: 100%;
    }

    /* Mobile Toggle Buttons */
    .mobile-toggle {
        display: flex !important;
        /* Override .hidden */
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: var(--text-secondary);
        border-radius: var(--radius-sm);
        cursor: pointer;
    }

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

    /* Header Adjustments */
    .chat-header {
        padding: 0 8px;
        gap: 8px;
    }

    .channel-info {
        flex: 1;
        min-width: 0;
        /* Allow text truncation */
    }

    .channel-hash {
        font-size: 18px;
    }

    h2#current-room-name {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .room-info {
        display: none;
        /* Hide extra info on mobile to save space */
    }

    /* Hide connect voice button text on mobile, keep icon */
    .btn-connect-voice span {
        display: none;
    }

    .btn-connect-voice {
        padding: 8px;
    }

    /* Waveform hidden on mobile to save space/performance */
    .waveform-canvas {
        display: none !important;
    }
}