/* ============================================
   jWebIRC - Modern CSS Stylesheet
    Version: 2.1
    Updated: 03.01.2026
    Bootstrap: 5.3.3
   Author: Andreas Pschorn
   ============================================ */

/* ===== CSS Variables (Bootstrap 5 compatible) ===== */
:root {
    /* Colors - Modern Dark Theme */
    --primary-color: #5865f2;
    --primary-dark: #4752c4;
    --primary-light: #7983f5;
    --primary-hover: #4752c4;
    --accent-color: #00b894;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    
    /* Backgrounds - Dark Mode */
    --background-main: #1e1e1e;
    --background-secondary: #2d2d3d;
    --background-tertiary: #404050;
    --background-hover: #4a4a5a;
    --background-active: #555565;
    --background-gradient: #1e1e1e;
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #d0d0d0;
    --text-muted: #a0a0a0;
    --text-link: #7983f5;
    
    /* Borders & Shadows */
    --border-color: #505060;
    --border-color-light: #606070;
    --border-radius: 6px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.45);
    --glow-primary: 0 0 20px rgba(88, 101, 242, 0.3);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Other */
    --transition-speed: 0.2s;
    --font-size-base: 14px;
    --max-width: 1400px;
    --scrollbar-width: 8px;
    --hue-rotate: 0deg;
}

/* ===== Typing Indicator Bar ===== */

.typing-bar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 88px;
    min-width: 260px;
    max-width: 520px;
    background: var(--primary-color);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg), var(--glow-primary);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translate(-50%, 10px);
    pointer-events: none;
    z-index: 9998;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}

.typing-bar.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.typing-bar.hide {
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: none !important;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-text {
    color: var(--text-primary);
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots .typing-dot {
    width: 7px;
    height: 7px;
    background: white;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

.typing-dots .typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots .typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0) scale(0.9);
        opacity: 0.6;
    }
    40% {
        transform: translateY(-8px) scale(1.1);
        opacity: 1;
    }
}

/* ===== Base Styles & Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
    overflow: hidden;
    filter: hue-rotate(var(--hue-rotate));
}

body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
}

::-webkit-scrollbar-track {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
}

::-webkit-scrollbar-thumb {
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    transition: background var(--transition-speed) ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--background-hover);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

p {
    margin: 0;
    color: var(--text-primary);
}

/* ===== Links ===== */
a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== Login Page Styles ===== */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    background: var(--background-main);
    overflow-y: auto;
    box-sizing: border-box;
}

.login-card {
    background: rgba(45, 45, 61, 0.95);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    padding: var(--spacing-2xl);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-header i {
    display: block;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: 3rem;
    filter: drop-shadow(var(--glow-primary));
}

.login-header h2 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Form Styles ===== */
.login-form {
    margin-bottom: var(--spacing-lg);
}

.form-floating {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: var(--text-secondary);
}

.form-floating > .form-control {
    height: calc(3.5rem + 2px);
    padding: 1rem 0.75rem;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    pointer-events: none;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #ffffff;
    background-color: #404050;
    border: 2px solid #505060;
    border-radius: calc(var(--border-radius) / 2);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.form-control:focus {
    color: #ffffff;
    background-color: #4a4a5a;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.3);
}

.form-control::placeholder {
    color: #b0b0b0;
    opacity: 1;
}

/* ===== Button Styles ===== */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 2px solid transparent;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: calc(var(--border-radius) / 2);
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary {
    color: #ffffff;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.w-100 {
    width: 100% !important;
}

.mb-3 {
    margin-bottom: var(--spacing-md) !important;
}

/* ===== Login Footer ===== */
.login-footer {
    text-align: center;
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.login-footer small {
    color: #c0c0c0;
    font-size: 0.875rem;
}

.login-footer i {
    margin: 0 var(--spacing-xs);
    color: var(--primary-color);
}

/* ===== Chat Container Layout ===== */
.chat-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 220px;
    grid-template-rows: 36px 36px 1fr 60px;
    grid-template-areas:
        "nav nav"
        "topic topic"
        "chat users"
        "input input";
    gap: 0;
    padding: 0;
    margin: 0;
    background: var(--background-main);
    overflow: visible;
    box-sizing: border-box;
}

/* Status window (no nicklist and no topic) uses full width */
.chat-container.status-view {
    grid-template-columns: 1fr;
    grid-template-rows: 40px 1fr 60px;
    grid-template-areas:
        "nav"
        "chat"
        "input";
}

.chat-container.status-view .right_frame,
.chat-container.status-view .topic_frame {
    display: none;
}

/* ===== Modern Navigation Bar ===== */
.top_frame {
    grid-area: nav;
    background: rgba(45, 45, 61, 1);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(88, 101, 242, 0.2);
    position: relative;
    z-index: 100;
    min-height: 36px;
    max-height: 36px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Vertical Mode (Sidebar) */
.top_frame.vertical {
    flex-direction: column;
    align-items: stretch;
    max-height: none;
    min-height: 0;
    height: 100%;
    border: none;
    border-radius: 8px;
    background: rgba(45, 45, 61, 1);
}

/* Navigation Container */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 8px;
    gap: 12px;
}

.top_frame.vertical .nav-container {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 12px;
    gap: 16px;
}

/* ===== Brand Section ===== */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 4px 8px;
    background: rgba(88, 101, 242, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(88, 101, 242, 0.4);
    transition: all 0.3s ease;
    cursor: default;
    height: 28px;
}

.nav-brand:hover {
    background: rgba(88, 101, 242, 0.3);
    box-shadow: var(--shadow-md), var(--glow-primary);
    transform: translateY(-1px);
}

.nav-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 4px;
    color: white;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(88, 101, 242, 0.4);
}

@keyframes iconPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(88, 101, 242, 0.6);
    }
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.nav-brand-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    line-height: 1.1;
}

.nav-brand-subtitle {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

/* ===== Tabs Section ===== */
.nav-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    position: relative;
}

.top_frame.vertical .nav-tabs-wrapper {
    flex-direction: column;
    align-items: stretch;
}

.nav-scroll-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 101, 242, 0.25);
    border: 1px solid rgba(88, 101, 242, 0.4);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.nav-scroll-btn:hover {
    background: rgba(88, 101, 242, 0.4);
    color: var(--text-primary);
    transform: scale(1.05);
}

.nav-scroll-btn:active {
    transform: scale(0.95);
}

.top_frame.vertical .nav-scroll-btn {
    display: none;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0;
    scrollbar-width: none;
    scroll-behavior: smooth;
    border: none !important;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.top_frame.vertical .nav-tabs {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    gap: 4px;
}

.nav-tab-strip {
    display: flex;
    gap: 6px;
}

.top_frame.vertical .nav-tab-strip {
    flex-direction: column;
    gap: 4px;
}

/* ===== Actions Section ===== */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
}

.top_frame.vertical .nav-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.nav-action-btn {
    position: relative;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(64, 64, 80, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Language toggle pill */
.nav-action-btn.lang-btn {
    min-width: 74px;
    height: 32px;
    padding: 0 10px;
    gap: 6px;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 6px;
}
.nav-action-btn.lang-btn span {
    line-height: 1;
    letter-spacing: 0.04em;
}

.nav-action-btn:hover {
    background: rgba(88, 101, 242, 0.4);
    border-color: rgba(88, 101, 242, 0.6);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-action-btn:active {
    transform: translateY(0);
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e74c3c;
    border: 2px solid var(--background-secondary);
    border-radius: 10px;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 4px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ===== Dropdown Menu ===== */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: rgba(35, 35, 50, 1);
    border: 1px solid rgba(88, 101, 242, 0.4);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(88, 101, 242, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.nav-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.top_frame.vertical .nav-dropdown {
    top: auto;
    bottom: 0;
    left: calc(100% + 12px);
    right: auto;
    transform: translateX(-10px);
}

.top_frame.vertical .nav-dropdown.open {
    transform: translateX(0);
}

.nav-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.nav-dropdown-header i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.nav-dropdown-content {
    padding: 8px;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    text-align: left;
}

/* Normalize button look inside dropdowns (language switch) */
button.nav-dropdown-item {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 12px 12px;
    margin: 0;
    width: 100%;
    text-align: left;
    color: var(--text-secondary);
    font: inherit;
}

.nav-dropdown-item:hover {
    background: rgba(88, 101, 242, 0.25);
    color: var(--text-primary);
}

.nav-dropdown-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-dropdown-item-left i {
    width: 20px;
    font-size: 0.95rem;
    color: var(--primary-light);
}

.nav-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 0;
}

/* Custom Toggle Switch */
.nav-toggle {
    position: relative;
    width: 42px;
    height: 22px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(80, 80, 96, 0.8);
    border-radius: 11px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-toggle:checked {
    background: var(--primary-color);
}

.nav-toggle::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-toggle:checked::before {
    transform: translateX(20px);
}

/* Slider Item */
.nav-dropdown-item.slider-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    cursor: default;
}

.nav-dropdown-item.slider-item:hover {
    background: transparent;
}

.nav-dropdown-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-dropdown-item-header i {
    width: 20px;
    font-size: 0.95rem;
    color: var(--primary-light);
}

.nav-dropdown-item-header span:first-of-type {
    flex: 1;
}

.nav-slider-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
    min-width: 42px;
    text-align: right;
}

.nav-slider-wrapper {
    position: relative;
    width: 100%;
    padding: 4px 0;
}

.nav-range-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(80, 80, 96, 0.8);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(88, 101, 242, 0.4);
    transition: all 0.2s ease;
}

.nav-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(88, 101, 242, 0.6);
}

.nav-range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(88, 101, 242, 0.4);
    transition: all 0.2s ease;
}

.nav-range-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(88, 101, 242, 0.6);
}

/* Hue slider specific styling */
.hue-slider {
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%),
        hsl(30, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)) !important;
    background-repeat: no-repeat !important;
    background-size: 100% 100% !important;
    transition: filter 0.2s ease;
}

.hue-track {
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%),
        hsl(30, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)) !important;
}

/* Layout toggles */
.chat-container.hide-topic {
    grid-template-rows: 36px 1fr 60px;
    grid-template-areas:
        "nav nav"
        "chat users"
        "input input";
}

.chat-container.hide-nicklist {
    grid-template-columns: 1fr;
    grid-template-areas:
        "nav"
        "topic"
        "chat"
        "input";
}

.chat-container.hide-topic.hide-nicklist {
    grid-template-rows: 36px 1fr 60px;
    grid-template-areas:
        "nav"
        "chat"
        "input";
}

.chat-container.hide-nicklist .right_frame {
    display: none !important;
}

.chat-container.hide-topic .topic_frame {
    display: none !important;
}

/* Hide topic and nicklist for Status window */
.chat-container.status-view .topic_frame {
    display: none !important;
}

.chat-container.status-view .right_frame {
    display: none !important;
}

.chat-container.status-view {
    grid-template-columns: 1fr !important;
    grid-template-rows: 36px 1fr 60px !important;
    grid-template-areas:
        "nav"
        "chat"
        "input" !important;
}

.chat-container.nav-left {
    grid-template-columns: 200px 1fr 220px;
    grid-template-rows: 48px 1fr 64px;
    grid-template-areas:
        "nav topic users"
        "nav chat users"
        "nav input users";
}

.chat-container.nav-left.hide-topic {
    grid-template-rows: 1fr 64px;
    grid-template-areas:
        "nav chat users"
        "nav input users";
}

.chat-container.nav-left.hide-nicklist {
    grid-template-columns: 200px 1fr;
    grid-template-areas:
        "nav topic"
        "nav chat"
        "nav input";
}

.chat-container.nav-left.hide-topic.hide-nicklist {
    grid-template-rows: 1fr 64px;
    grid-template-columns: 200px 1fr;
    grid-template-areas:
        "nav chat"
        "nav input";
}

.chat-container.nav-left .top_frame {
    align-self: stretch;
}

/* ===== Modern Navigation Tab Items (nv elements) ===== */
nv {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin: 0;
    background: rgba(64, 64, 80, 1);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    overflow: hidden;
    height: 28px;
    padding: 0 12px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

nv::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

nv .tab-label {
    cursor: pointer;
    flex: 1;
    position: relative;
    padding: 0 4px;
}

nv .tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    border-radius: 3px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    flex-shrink: 0;
}

nv:hover .tab-close {
    opacity: 1;
}

nv .tab-close:hover {
    background: rgba(255, 107, 107, 0.25);
    color: #ff6b6b;
    transform: rotate(90deg) scale(1.1);
}

nv:hover {
    background: rgba(88, 101, 242, 0.35);
    border-color: rgba(88, 101, 242, 0.5);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

nv.active {
    background: rgba(88, 101, 242, 0.4);
    border-color: rgba(88, 101, 242, 0.7);
    color: var(--text-primary);
    box-shadow: 0 3px 12px rgba(88, 101, 242, 0.4), 0 1px 0 rgba(88, 101, 242, 0.3) inset;
    font-weight: 600;
}

nv.active::before {
    transform: scaleX(1);
}

nv.active .tab-close {
    opacity: 0.7;
}

nv.unread {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.6);
    animation: tabPulse 2s ease-in-out infinite;
}

nv.unread::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #ff4757;
    border: 1.5px solid var(--background-secondary);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 71, 87, 0.3);
    animation: notificationPulse 2s ease-in-out infinite;
}

/* Notification (unread) takes priority over simple highlight */
nv.unread.highlighted {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.6);
    animation: tabPulse 2s ease-in-out infinite;
}

nv.highlighted:not(.unread) {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.5);
    animation: tabHighlight 1.5s ease-in-out infinite;
}

nv.highlighted:not(.unread)::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #ffc107;
    border: 1.5px solid var(--background-secondary);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.3);
    animation: highlightPulse 1.5s ease-in-out infinite;
}

@keyframes tabPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(255, 107, 107, 0);
    }
}

@keyframes tabHighlight {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 193, 7, 0);
    }
}

@keyframes notificationPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Vertical Mode Tab Styling */
.top_frame.vertical nv {
    width: 100%;
    justify-content: flex-start;
}

.top_frame.vertical nv::before {
    width: 3px;
    height: 100%;
    left: 0;
    top: 0;
    bottom: auto;
    transform: scaleY(0);
}

.top_frame.vertical nv.active::before {
    transform: scaleY(1);
}

/* ===== Topic Bar ===== */
.topic_frame {
    grid-area: topic;
    background: var(--background-secondary);
    border: none;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(88, 101, 242, 0.2);
    padding: 2px 6px;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    backdrop-filter: blur(12px);
    font-weight: 600;
    color: #f0f0f0;
    font-size: 0.9rem;
    line-height: 1.4;
    height: 36px;
    min-height: 36px;
    visibility: visible !important;
    opacity: 1 !important;
}

.topic-icon {
    color: #9ba3ff;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.topic-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f0f0f0;
}

/* Links in topic area use text color */
.topic_frame a,
.topic_frame a:link,
.topic_frame a:visited {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.topic_frame a:hover,
.topic_frame a:active {
    color: inherit;
    opacity: 0.8;
    text-decoration: none;
}

.topic-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    margin: 0;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Topic components - normal text unless control codes are used */
.topic-prefix {
    font-weight: normal;
    color: #d0d0d0;
}

.topic-content {
    font-weight: normal;
    color: #d0d0d0;
}

.topic-empty {
    font-weight: normal;
    color: #a0a0a0;
    font-style: italic;
}

/* ===== Chat Window ===== */
.chat_frame {
    grid-area: chat;
    background: rgba(45, 45, 61, 0.95);
    border: none;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
    transition: box-shadow var(--transition-speed) ease;
    backdrop-filter: blur(10px);
    min-height: 0;
    height: 100%;
}

/* Links in chat window use text color */
.chat_frame a,
.chat_frame a:link,
.chat_frame a:visited {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.chat_frame a:hover,
.chat_frame a:active {
    color: inherit;
    opacity: 0.8;
    text-decoration: underline;
}



/* ===== User List ===== */
.right_frame {
    grid-area: users;
    background: rgba(45, 45, 61, 0.95);
    border: none;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: box-shadow var(--transition-speed) ease;
    backdrop-filter: blur(10px);
    min-height: 0;
    height: 100%;
}



.user-list-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: #7983f5;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--border-color);
}

/* ===== Message Input ===== */
.post_frame {
    grid-area: input;
    background: rgba(45, 45, 61, 0.95);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    padding: 10px 12px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-height: 60px;
    max-height: 60px;
    flex-shrink: 0;
    position: relative;
}

.post_frame .input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    height: 100%;
    flex-wrap: nowrap;
}

.post_frame .form-control {
    flex: 1;
    min-width: 0;
    height: 40px !important;
    max-height: 40px !important;
    padding: 8px 12px !important;
}

.post_frame .btn-outline-secondary {
    background: transparent;
    border: 2px solid rgba(88, 101, 242, 0.4);
    color: var(--text-primary);
}

.post_frame .btn-outline-secondary:hover {
    background: rgba(88, 101, 242, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-light);
}

#emojiBtn, #formatHelpBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
}

/* ===== Format Help Tooltip ===== */
.format-help {
    position: absolute;
    bottom: 70px;
    right: 10px;
    background: var(--background-secondary);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 320px;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.format-help-header {
    background: var(--primary-color);
    padding: 12px 16px;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    font-weight: 600;
}

.format-help-close {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.format-help-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.format-help-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.format-help-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.format-help-item:hover {
    background: var(--background-hover);
    transform: translateX(4px);
}

.format-help-item kbd {
    background: var(--background-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    min-width: 70px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.format-help-item strong,
.format-help-item em,
.format-help-item u,
.format-help-item s,
.format-help-item code {
    flex: 1;
    color: var(--text-secondary);
}

.format-help-item code {
    background: var(--background-main);
    padding: 2px 6px;
    border-radius: 3px;
}

/* ===== Color Picker (Ctrl+K) ===== */
.color-picker {
    position: fixed;
    background: var(--background-secondary);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 320px;
    z-index: 1200;
    animation: slideUp 0.2s ease-out;
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--primary-color);
    color: var(--text-primary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    font-weight: 600;
}

.color-picker-close {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
}

.color-picker-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.color-picker-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
}

.color-picker-section {
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    padding: 10px;
    box-shadow: inset 0 0 0 1px var(--border-color);
}

.color-picker-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.color-grid button {
    width: 100%;
    padding-top: 100%;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    outline: none;
}

.color-grid button.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.4);
}

.color-grid button::after {
    content: attr(data-color-code);
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 10px;
    color: #000;
    background: rgba(255, 255, 255, 0.8);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
}

.color-grid button:nth-child(1)::after,
.color-grid button:nth-child(2)::after,
.color-grid button:nth-child(14)::after,
.color-grid button:nth-child(15)::after,
.color-grid button:nth-child(16)::after {
    color: #000;
}

.color-picker-clear {
    margin-top: 10px;
    width: 100%;
    border: 1px dashed var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.color-picker-clear:hover {
    border-color: var(--primary-color);
    color: var(--primary-light);
}

.color-picker-actions {
    padding: 10px 12px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* ===== Custom Scrollbar ===== */
.chat_frame::-webkit-scrollbar,
.right_frame::-webkit-scrollbar,
.topic_frame::-webkit-scrollbar,
.top_frame::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.chat_frame::-webkit-scrollbar-track,
.right_frame::-webkit-scrollbar-track,
.topic_frame::-webkit-scrollbar-track,
.top_frame::-webkit-scrollbar-track {
    background: rgba(30, 30, 40, 0.5);
    border-radius: 4px;
}

.chat_frame::-webkit-scrollbar-thumb,
.right_frame::-webkit-scrollbar-thumb,
.topic_frame::-webkit-scrollbar-thumb,
.top_frame::-webkit-scrollbar-thumb {
    background: rgba(88, 101, 242, 0.4);
    border-radius: 4px;
    transition: background var(--transition-speed) ease;
}

.chat_frame::-webkit-scrollbar-thumb:hover,
.right_frame::-webkit-scrollbar-thumb:hover,
.topic_frame::-webkit-scrollbar-thumb:hover,
.top_frame::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--background-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    filter: drop-shadow(var(--glow-primary));
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Message Styling ===== */
.chat-message {
    padding: var(--spacing-xs) 0;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-timestamp {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 2px;
}

.chat-nick {
    font-weight: 600;
    margin-right: 2px;
}

/* ===== IRC Message Styling ===== */
.chat_frame {
    line-height: 1.6;
    font-size: 14px;
}

/* IRC Timestamps */
.chat_frame span[style*="color: #808080"] {
    color: #909090 !important;
    font-size: 0.85em;
}

/* IRC Status messages (==) */
.chat_frame span[style*="color: #ff0000"] {
    color: #ff6b6b !important;
}

.chat_frame span[style*="color: #00ff00"] {
    color: #51cf66 !important;
}

.chat_frame span[style*="color: #ffff00"] {
    color: #ffd43b !important;
}

/* IRC Nicknames - different colors */
.chat_frame span[style*="color: #ff00ff"] {
    color: #da77f2 !important;
    font-weight: 600;
}

.chat_frame span[style*="color: #00ffff"] {
    color: #66d9e8 !important;
    font-weight: 600;
}

.chat_frame span[style*="color: #0000ff"] {
    color: #5c7cfa !important;
    font-weight: 600;
}

/* IRC User-Modes (@, %, +) in the user list */
.right_frame span[style*="color: #ff00ff"] {
    color: #da77f2 !important;
    font-weight: bold;
}

.right_frame span[style*="color: #00ffff"] {
    color: #66d9e8 !important;
    font-weight: bold;
}

/* Status symbols styling - Emojis/Icons */
.right_frame .nick-entry {
    display: inline-flex;
    align-items: center;
    gap: 0.15em;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.right_frame .nick-entry:hover {
    opacity: 0.8;
}

/* Away status styling */
.right_frame .nick-entry.away {
    opacity: 0.5;
}

.right_frame .nick-entry.away .nick-name {
    font-style: italic;
}

.right_frame .away-indicator {
    font-size: 0.9em;
    opacity: 0.7;
    margin-right: 0.1em;
    filter: grayscale(0.3);
}

.right_frame .status-symbol {
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.15s ease, filter 0.15s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.right_frame .nick-name {
    display: inline-block;
    line-height: 1.2;
}

.right_frame .status-symbol:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* Owner/Founder (~) 👑 - Gold glow */
.right_frame .status-q {
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Admin/Protected (&) 🛡️ - Red glow */
.right_frame .status-a {
    filter: drop-shadow(0 0 4px rgba(255, 68, 68, 0.6)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Operator (@) ⭐ - Green/Yellow glow */
.right_frame .status-o {
    filter: drop-shadow(0 0 4px rgba(255, 223, 0, 0.6)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Half-op (%) ⚡ - Cyan/Electric glow */
.right_frame .status-h {
    filter: drop-shadow(0 0 4px rgba(0, 188, 212, 0.6)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Voice (+) 💬 - Light Blue glow */
.right_frame .status-v {
    filter: drop-shadow(0 0 4px rgba(100, 181, 246, 0.5)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.right_frame div {
    padding: 4px 8px;
    margin: 1px 0;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.right_frame div:hover {
    background-color: var(--background-hover);
}

/* ===== Nick Context Menu ===== */
.nick-context-menu {
    position: fixed;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 4px 0;
    z-index: 10000;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
}

.nick-context-menu.show {
    display: block;
    animation: menuFadeIn 0.15s ease-out;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nick-context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.nick-context-menu-item:hover {
    background-color: var(--background-hover);
}

.nick-context-menu-item:active {
    background-color: var(--background-active);
}

.nick-context-menu-item.info-item {
    cursor: default;
    opacity: 0.8;
    font-size: 0.9em;
}

.nick-context-menu-item.info-item:hover {
    background-color: transparent;
}

.nick-context-menu-item .menu-icon {
    width: 18px;
    text-align: center;
    font-size: 16px;
    opacity: 0.8;
}

.nick-context-menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}

/* IRC Links */
.chat_frame a {
    color: var(--primary-light);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.chat_frame a:hover {
    border-bottom-color: var(--primary-light);
}

/* IRC Channel names */
.chat_frame span[style*="#channel"] {
    color: #51cf66 !important;
    font-weight: 500;
}

/* Better readability for all text in chat */
.chat_frame,
.chat_frame * {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== Utility Classes ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-center {
    text-align: center !important;
}

/* ===== Responsive Design ===== */
/* Hide user list on smaller windows */
@media (max-width: 1024px) {
    .chat-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "nav"
            "topic"
            "chat"
            "input";
    }
    
    .right_frame {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-rows: 44px 36px 1fr 75px;
        padding: 4px;
        gap: 4px;
        height: 100dvh;
    }
    
    .top_frame {
        min-height: 44px;
        max-height: 44px;
        padding: 8px 12px;
        flex-shrink: 0;
    }
    
    .topic_frame {
        min-height: 36px;
        max-height: 36px;
        flex-shrink: 0;
    }
    
    .post_frame {
        min-height: 75px !important;
        max-height: 75px !important;
        padding: 12px !important;
        display: flex !important;
        flex-shrink: 0;
    }
    
    .chat_frame {
        min-height: 0 !important;
        overflow-y: auto !important;
        flex: 1;
    }
    
    .post_frame .input-group {
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .post_frame .form-control {
        height: 44px !important;
        max-height: 44px !important;
        font-size: 16px !important;
    }
    
    .post_frame .btn {
        height: 44px;
        padding: 10px 16px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .post_frame .btn-outline-secondary {
        min-width: 44px;
        padding: 10px;
    }
    
    .login-card {
        padding: var(--spacing-lg);
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .chat-container {
        grid-template-rows: 50px 40px 1fr 90px;
        height: 100dvh;
    }
    
    .top_frame {
        min-height: 50px;
        max-height: 50px;
        padding: 10px 12px;
        flex-shrink: 0;
    }
    
    .topic_frame {
        min-height: 40px;
        max-height: 40px;
        padding: 8px 12px;
        flex-shrink: 0;
    }
    
    .post_frame {
        min-height: 90px !important;
        max-height: 90px !important;
        padding: 14px 12px !important;
        display: flex !important;
        flex-shrink: 0;
    }
    
    .chat_frame {
        min-height: 0 !important;
        overflow-y: auto !important;
        flex: 1;
    }
    
    .post_frame .input-group {
        flex-wrap: nowrap;
        gap: 6px;
    }
    
    .post_frame .form-control {
        height: 50px !important;
        max-height: 50px !important;
        font-size: 16px !important;
        padding: 12px 14px !important;
    }
    
    .post_frame .btn {
        height: 50px;
        min-width: 70px;
        padding: 12px 14px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .post_frame .btn-outline-secondary {
        min-width: 50px;
        padding: 12px;
    }
    
    .chat_frame {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .nav-title {
        font-size: 0.95rem;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* ===== Print Styles ===== */
@media print {
    .login-container,
    .post_frame,
    .top_frame,
    .topic_frame,
    .right_frame,
    .loading-screen {
        display: none;
    }
    
    .chat_frame {
        position: relative;
        box-shadow: none;
        border: 1px solid #000;
    }
}
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    font-size: var(--font-size-base);
}

body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--background-main);
    text-align: left;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Links ===== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Layout Container ===== */
#pagecontent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(300px, 90vw, 30em);
    height: clamp(400px, 80vh, 20em);
}

/* ===== Login Container ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.login-card {
    background: rgba(45, 45, 61, 0.95);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 450px;
    animation: slideUp 0.4s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.login-header h2 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.login-form .form-floating {
    position: relative;
}

.login-form .form-control {
    border-radius: calc(var(--border-radius) / 2);
    border: 2px solid var(--border-color);
    transition: all var(--transition-speed) ease;
    font-size: 1rem;
    padding: 0.75rem;
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(153, 0, 0, 0.1);
}

.login-form .btn-primary {
    background: var(--primary-color);
    border: none;
    border-radius: calc(var(--border-radius) / 2);
    padding: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.login-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(153, 0, 0, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

/* ===== Chat Container ===== */
.chat-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 200px;
    grid-template-rows: 40px 36px 1fr 60px;
    grid-template-areas:
        "nav nav"
        "topic topic"
        "chat users"
        "input input";
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--background-main);
}

/* ===== Form Elements ===== */
.post_frame textarea {
    font-family: inherit;
    overflow-y: auto;
    overflow-x: hidden;
    resize: vertical;
}

.post_field {
    border: 2px solid var(--border-color) !important;
    border-radius: calc(var(--border-radius) / 2) !important;
    font-size: 0.95rem !important;
    padding: var(--spacing-sm) !important;
    transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
    background-color: #404050 !important;
    color: #ffffff !important;
}

.post_field.preview-enabled {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    caret-color: transparent !important;
    text-shadow: none !important;
    background-color: #404050 !important;
    position: relative;
    z-index: 1;
}

.post_field.preview-enabled::placeholder {
    color: transparent !important;
}

.post_field:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.3) !important;
    background-color: #4a4a5a !important;
}

.post_field::placeholder {
    color: #b0b0b0 !important;
    opacity: 1 !important;
}

.post-input-wrapper {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.input-group .post-input-wrapper {
    display: flex;
}

.post-input-wrapper .post_field {
    width: 100%;
}

.post-preview {
    position: absolute;
    inset: 0;
    padding: var(--spacing-sm);
    font-size: 0.95rem;
    line-height: 1.4;
    font-family: inherit;
    color: var(--text-primary);
    pointer-events: none;
    white-space: pre-wrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    z-index: 2;
}

.post-preview .preview-placeholder {
    color: #b0b0b0;
}

.post-preview .preview-caret {
    display: inline-block;
    width: 1px;
    height: 1.2em;
    background: #ffffff;
    vertical-align: middle;
    animation: preview-caret-blink 1s step-end infinite;
}

@keyframes preview-caret-blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

.btn {
    border-radius: calc(var(--border-radius) / 2) !important;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background: var(--primary-color) !important;
    border: none !important;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(153, 0, 0, 0.3) !important;
}

.btn-outline-secondary {
    border: 2px solid rgba(88, 101, 242, 0.4) !important;
    color: var(--text-primary) !important;
    background: transparent !important;
}

.btn-outline-secondary:hover {
    background-color: rgba(88, 101, 242, 0.2) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-light) !important;
}

.post_frame {
    grid-area: input;
    border: none;
    background: rgba(45, 45, 61, 0.95);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.post_frame .input-group {
    display: flex;
    gap: var(--spacing-sm);
}

/* ===== Chat Frames ===== */
.chat_frame, .right_frame, .topic_frame {
    font-size: 0.95rem;
    border: 1px solid rgba(88, 101, 242, 0.3);
    background: rgba(45, 45, 61, 0.95);
    padding: var(--spacing-md);
    overflow-y: auto;
    overflow-x: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border-radius: var(--border-radius);
    transition: box-shadow var(--transition-speed) ease;
    backdrop-filter: blur(10px);
}





.topic-icon {
    color: var(--primary-color);
    flex-shrink: 0;
}

.topic-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat_frame {
    grid-area: chat;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat_frame:hover, .right_frame:hover {
    box-shadow: 0 6px 16px var(--shadow-hover);
}

.right_frame {
    grid-area: users;
    white-space: pre;
}

.user-list-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

/* Modern Scrollbar */
.chat_frame::-webkit-scrollbar,
.right_frame::-webkit-scrollbar,
.topic_frame::-webkit-scrollbar,
.top_frame::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.chat_frame::-webkit-scrollbar-track,
.right_frame::-webkit-scrollbar-track,
.topic_frame::-webkit-scrollbar-track,
.top_frame::-webkit-scrollbar-track {
    background: rgba(30, 30, 40, 0.5);
    border-radius: 4px;
}

.chat_frame::-webkit-scrollbar-thumb,
.right_frame::-webkit-scrollbar-thumb,
.topic_frame::-webkit-scrollbar-thumb,
.top_frame::-webkit-scrollbar-thumb {
    background: rgba(88, 101, 242, 0.4);
    border-radius: 4px;
    transition: background var(--transition-speed) ease;
}

.chat_frame::-webkit-scrollbar-thumb:hover,
.right_frame::-webkit-scrollbar-thumb:hover,
.topic_frame::-webkit-scrollbar-thumb:hover,
.top_frame::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== Message Styling ===== */
.chat-message {
    padding: var(--spacing-xs) 0;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-timestamp {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 2px;
}

.chat-nick {
    font-weight: 600;
    margin-right: 2px;
}

.chat-text {
    word-wrap: break-word;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    :root {
        --font-size-base: 13px;
    }
    
    .chat-container {
        grid-template-columns: 1fr;
        grid-template-rows: 36px 36px 1fr 70px;
        grid-template-areas:
            "nav"
            "topic"
            "chat"
            "input";
    }
    
    .right_frame {
        display: none;
    }
    
    .login-card {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: var(--spacing-xs);
        gap: var(--spacing-xs);
    }
    
    .post_frame {
        padding: var(--spacing-sm);
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
    [data-theme="dark"] {
        --background-light: #2d2d2d;
        --text-color: #e0e0e0;
        --border-color: #404040;
    }
}

/* ===== Utility Classes ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-center {
    text-align: center;
}

.mb-3 {
    margin-bottom: var(--spacing-md) !important;
}

.w-100 {
    width: 100% !important;
}
/* ===== RESPONSIVE DESIGN - MOBILE ===== */

/* Tablets (768px to 1024px) */
@media (max-width: 1024px) {
    :root {
        --font-size-base: 13px;
    }
    
    .chat-container {
        display: flex;
        flex-direction: column;
    }
    
    .top_frame {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }
    
    .container {
        width: 100%;
    }
}

/* Mobile Devices (max 768px) */
@media (max-width: 768px) {
    :root {
        --font-size-base: 12px;
        --spacing-md: 12px;
        --spacing-lg: 16px;
    }
    
    .chat-container {
        grid-template-columns: 1fr;
        grid-template-rows: 32px 28px 1fr 56px;
        gap: 1px;
        padding: 1px;
    }
    
    .top_frame {
        height: 32px;
        padding: 3px 4px;
        gap: 3px;
    }
    
    .topic_frame {
        height: 28px;
        min-height: 28px;
        padding: 2px 4px;
    }
    
    .right_frame {
        display: none;
    }
    
    .post_frame {
        height: 56px;
        min-height: 56px;
        padding: 3px;
    }
    
    #chat_input {
        height: 24px !important;
        padding: 3px !important;
        font-size: 12px !important;
        margin: 0;
    }
    
    #send_button {
        height: 24px;
        padding: 3px 6px;
        font-size: 11px;
        margin: 0;
    }
    
    #emojiBtn {
        height: 24px;
        padding: 3px 6px;
    }
    
    .message {
        padding: 2px 4px;
        font-size: 11px;
        line-height: 1.2;
    }
    
    .typing-bar {
        bottom: 60px;
        font-size: 11px;
    }
    
    ::-webkit-scrollbar {
        width: 4px;
    }
}

/* Small Phones (max 480px) */
@media (max-width: 480px) {
    :root {
        --font-size-base: 11px;
        --spacing-md: 8px;
    }
    
    .chat-container {
        grid-template-rows: 26px 22px 1fr 50px;
        gap: 0;
    }
    
    .top_frame {
        max-height: 26px;
        height: 26px;
        padding: 2px 3px;
        gap: 2px;
    }
    
    .topic_frame {
        height: 22px;
        min-height: 22px;
        padding: 2px;
    }
    
    .topic-text {
        font-size: 9px;
    }
    
    .message {
        padding: 2px;
        font-size: 9px;
    }
    
    .post_frame {
        height: 50px;
        min-height: 50px;
        padding: 2px;
    }
    
    #chat_input {
        height: 20px !important;
        padding: 2px !important;
        font-size: 10px !important;
        margin: 0;
    }
    
    #send_button {
        height: 20px;
        padding: 2px 4px;
        font-size: 8px;
        margin: 0;
    }
    
    #emojiBtn {
        height: 20px;
        padding: 2px 3px;
        font-size: 0.7rem;
    }
    
    .typing-bar {
        bottom: 52px;
        font-size: 9px;
    }
    
    ::-webkit-scrollbar {
        width: 3px;
    }
}

/* Ultra Small Windows/Phones (max 600px width) */
@media (max-width: 600px) {
    .chat-container {
        grid-template-columns: 1fr 100px;
        grid-template-rows: 26px 22px 1fr 50px;
        gap: 0;
        padding: 0;
    }
    
    .top_frame {
        padding: 2px 3px;
        gap: 2px;
        max-height: 26px;
        height: 26px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    nv {
        padding: 1px 3px 1px 4px;
        margin: 0;
        font-size: 0.7rem;
        gap: 2px;
        flex-shrink: 0;
    }
    
    nv .tab-close {
        width: 12px;
        height: 12px;
        font-size: 0.65rem;
    }
    
    .topic_frame {
        height: 22px;
        min-height: 22px;
        padding: 1px 2px;
        gap: 2px;
        display: flex;
        align-items: center;
    }
    
    .topic-icon {
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .topic-text {
        font-size: 9px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }
    
    .right_frame {
        width: 100px;
        padding: 2px;
    }
    
    .user-list-header {
        font-size: 8px;
        padding: 1px;
        margin-bottom: 2px;
        gap: 2px;
        display: flex;
        align-items: center;
    }
    
    .user-list-header i {
        font-size: 0.8rem;
        flex-shrink: 0;
    }
    
    .chat_frame {
        padding: 2px;
        font-size: 9px;
        line-height: 1.15;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scroll-behavior: smooth;
    }
    
    .message {
        padding: 0;
        font-size: 9px;
        line-height: 1.15;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .post_frame {
        padding: 2px;
        min-height: 50px;
        height: 50px;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        justify-content: flex-start;
        align-items: stretch;
    }
    
    .post_frame .input-group {
        display: flex;
        gap: 1px;
        flex: 0 0 auto;
        height: 22px;
        align-items: stretch;
        min-height: 0;
    }
    
    #emojiBtn {
        padding: 2px 3px !important;
        min-width: 22px !important;
        height: 22px !important;
        max-height: 22px !important;
        font-size: 0.75rem !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    #chat_input {
        padding: 2px 3px !important;
        font-size: 10px !important;
        min-height: 22px !important;
        height: 22px !important;
        max-height: 22px !important;
        flex: 1;
        margin: 0 !important;
        border: 1px solid var(--border-color) !important;
        resize: none !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
    
    #send_button {
        padding: 2px 4px !important;
        font-size: 8px !important;
        min-height: 22px !important;
        height: 22px !important;
        max-height: 22px !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        line-height: 1 !important;
    }
    
    .post_frame .btn {
        padding: 2px 3px !important;
        min-height: 22px !important;
        height: 22px !important;
        max-height: 22px !important;
        line-height: 1 !important;
        margin: 0 !important;
        border: 1px solid !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
    }
    
    .typing-bar {
        bottom: 52px;
        min-width: 200px;
        max-width: 85vw;
        padding: 3px 6px;
        font-size: 9px;
    }
    
    .typing-content {
        gap: 3px;
    }
    
    .typing-dots {
        gap: 2px;
    }
    
    .typing-dots .typing-dot {
        width: 3px;
        height: 3px;
    }
    
    ::-webkit-scrollbar {
        width: 3px;
        height: 3px;
    }
}
@media (max-width: 400px) {
    :root {
        --font-size-base: 10px;
        --spacing-md: 6px;
    }
    
    .chat-container {
        grid-template-columns: 1fr 150px;
        grid-template-rows: 28px 24px 1fr 44px;
    }
    
    .top_frame {
        max-height: 100px;
        padding: 4px;
    }
    
    .nav-window {
        gap: 2px;
        padding: 4px 2px;
    }
    
    .tab-button {
        padding: 3px 6px !important;
        font-size: 9px !important;
        min-width: 45px;
        max-width: 100%;
    }
    
    .close_button {
        width: 16px;
        height: 16px;
        padding: 0;
        font-size: 10px;
    }
    
    .topic_frame {
        min-height: 30px;
        padding: 4px;
    }
    
    .topic-text {
        font-size: 9px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .container {
        min-width: 0;
    }
    
    .page {
        font-size: 10px;
    }
    
    .message {
        padding: 3px 4px;
        font-size: 10px;
        line-height: 1.3;
    }
    
    .message-timestamp {
        font-size: 8px;
    }
    
    .typing_frame {
        min-height: 50px;
        padding: 4px;
        grid-template-rows: auto auto;
    }
    
    #chat_input {
        padding: 4px;
        font-size: 12px;
        margin-bottom: 3px;
        height: 24px;
    }
    
    #send_button {
        padding: 6px;
        font-size: 11px;
        height: 32px;
    }
    
    /* Scrollbars */
    .users {
        width: 140px;
    }
    
    /* Typing Bars */
    .typing-bar {
        bottom: 55px;
        left: 4px;
        right: 4px;
        max-width: calc(100% - 8px);
        padding: 8px 12px;
    }
    
    .typing-text {
        font-size: 10px;
    }
    
    .typing-dot {
        width: 4px;
        height: 4px;
        margin: 0 1px;
    }
    
    /* Login Modal */
    .login-container {
        padding: 12px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .form-group label {
        font-size: 11px;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="email"],
    select,
    textarea {
        font-size: 13px !important;
        padding: 6px !important;
    }
    
    button {
        padding: 8px 10px !important;
        font-size: 11px !important;
        min-height: 36px;
    }
    
    .btn {
        padding: 0.5rem 1rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 11px;
    }
    
    /* Modal */
    .modal {
        width: calc(100% - 10px);
        margin: 5px;
        max-height: 90vh;
    }
    
    .modal-content {
        padding: 12px;
        max-height: 85vh;
    }
    
    .modal-header {
        font-size: 12px;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .modal-body {
        padding: 8px;
        font-size: 10px;
    }
    
    .modal-footer {
        padding: 8px;
        gap: 6px;
    }
    
    /* Close button for modals */
    .close {
        font-size: 18px;
        width: 24px;
        height: 24px;
        line-height: 24px;
    }
    
    /* Scrollbar hidden on ultra-small */
    ::-webkit-scrollbar {
        width: 4px;
    }
}

/* Landscape Mode */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-container {
        grid-template-rows: 28px 24px 1fr 40px;
    }
    
    .top_frame {
        max-height: 80px;
        padding: 4px;
    }
    
    .topic_frame {
        min-height: 28px;
        padding: 2px 4px;
    }
    
    .topic-text {
        font-size: 11px;
    }
    
    .typing_frame {
        min-height: 44px;
        padding: 4px;
    }
    
    #chat_input {
        padding: 4px;
        margin-bottom: 2px;
        height: 20px;
    }
    
    #send_button {
        padding: 4px 8px;
        height: 28px;
        font-size: 12px;
    }
    
    .message {
        padding: 2px 4px;
        font-size: 11px;
    }
    
    .typing-bar {
        bottom: 48px;
    }
}

/* ===== LOGIN PAGE OPTIONS MENU ===== */

#loginOptionsContainer {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

#loginOptionsToggle {
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

#loginOptionsToggle:hover {
    background: var(--background-tertiary);
    border-color: var(--border-color-light);
    transform: scale(1.05);
}

#loginOptionsToggle:active {
    transform: scale(0.95);
}

#loginOptionsMenu {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
}

#loginOptionsMenu.show {
    display: block !important;
}

#loginOptionsMenu .nav-dropdown-header {
    padding: 12px 16px;
    background: var(--background-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

#loginOptionsMenu .nav-dropdown-content {
    padding: 8px;
}

#loginOptionsMenu .nav-dropdown-item {
    padding: 12px 12px;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: background var(--transition-speed) ease;
    margin-bottom: 4px;
}

#loginOptionsMenu .nav-dropdown-item:hover {
    background: var(--background-tertiary);
}

#loginOptionsMenu .slider-item {
    padding: 12px;
}

#loginOptionsMenu .nav-dropdown-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

#loginOptionsMenu .nav-dropdown-item-header i {
    color: var(--primary-color);
    min-width: 16px;
}

#loginOptionsMenu .nav-slider-value {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: auto;
    min-width: 40px;
    text-align: right;
}

#loginOptionsMenu .nav-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

#loginOptionsMenu .nav-range-slider {
    flex: 1;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--background-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#loginOptionsMenu .nav-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(88, 101, 242, 0.4);
}

#loginOptionsMenu .nav-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.6);
}

#loginOptionsMenu .nav-range-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(88, 101, 242, 0.4);
}

#loginOptionsMenu .nav-range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.6);
}

#loginOptionsMenu .nav-range-slider::-webkit-slider-runnable-track {
    background: var(--background-tertiary);
    height: 6px;
    border-radius: 3px;
}

#loginOptionsMenu .hue-slider::-webkit-slider-runnable-track {
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%),
        hsl(30, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)) !important;
    height: 6px;
    border-radius: 3px;
}

#loginOptionsMenu .nav-range-slider::-moz-range-track {
    background: var(--background-tertiary);
    height: 6px;
    border-radius: 3px;
    border: none;
}

#loginOptionsMenu .hue-slider::-moz-range-track {
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%),
        hsl(30, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)) !important;
    height: 6px;
    border-radius: 3px;
    border: none;
}



#loginOptionsMenu .nav-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}
/* ===== Cookie Warning Banner ===== */
.cookie-warning {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--background-secondary);
    border-top: 2px solid var(--primary-color);
    padding: var(--spacing-md);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    animation: slideUpCookie 0.3s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes slideUpCookie {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-warning.hide {
    animation: slideDownCookie 0.3s ease-out forwards;
}

@keyframes slideDownCookie {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.cookie-warning-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--spacing-md);
    align-items: center;
}

.cookie-warning-icon {
    font-size: 2rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.cookie-warning-text {
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.cookie-warning-title {
    font-weight: 700;
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1rem;
}

.cookie-warning-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.cookie-warning-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    white-space: nowrap;
}

.cookie-btn-accept {
    background: var(--primary-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.cookie-btn-accept:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover), var(--glow-primary);
    background: var(--primary-hover);
}

.cookie-btn-accept:active {
    transform: translateY(0);
}

/* Responsive Cookie Warning */
@media (max-width: 768px) {
    .cookie-warning {
        padding: var(--spacing-sm);
    }

    .cookie-warning-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .cookie-warning-icon {
        order: -1;
        font-size: 1.5rem;
    }

    .cookie-warning-actions {
        width: 100%;
    }

    .cookie-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cookie-warning-message {
        font-size: 0.85rem;
    }

    .cookie-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}