/**
 * Aurion AI Chat Interface Styles
 * Modern, sleek design with purple/yellow gradient and smooth animations
 */

:root {
    /* Default Theme Colors */
    --theme-primary: #8a2be2;
    --theme-secondary: #ba55d3;
    --theme-input-border: #8a2be2;
    
    --bg-gradient-start: rgba(138, 43, 226, 0.15);
    --bg-gradient-mid: rgba(186, 85, 211, 0.12);
    --bg-gradient-end: rgba(255, 215, 0, 0.15);
    --chat-bg: rgba(255, 255, 255, 0.85);
    --chat-header-bg: rgba(255, 255, 255, 0.95);
    --message-user-bg: rgb(229, 243, 255);
    --message-ai-bg: rgba(248, 249, 250, 0.95);
    --input-bg: rgba(255, 255, 255, 0.95);
    --text-primary: rgb(13, 13, 13);
    --text-secondary: #6c757d;
    --text-muted: #999;
    --input-placeholder: #b8b8b8;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.15);
    --aurion-logo-bg: linear-gradient(135deg, #8a2be2, #b2f1ff);
    --user-avatar-bg: linear-gradient(135deg, #ffd700, #ffed4e);
    --modal-bg: rgba(255, 255, 255, 0.98);
    
    /* Font Size Scale - Default Medium */
    --font-size-multiplier: 1;
}

[data-theme="dark"] {
	--bg-gradient-start: rgb(138 43 226);
	--bg-gradient-mid: rgb(75 0 130);
	--bg-gradient-end: rgba(0, 0, 0, 0.7);
    --chat-bg: rgba(18, 18, 18, 0.85);
    --chat-header-bg: rgba(20, 20, 20, 0.95);
    --message-user-bg: rgba(138, 43, 226, 0.25);
    --message-ai-bg: rgba(30, 30, 30, 0.95);
    --input-bg: rgba(45, 45, 45, 0.95);
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --input-placeholder: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.25);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.7);
    --modal-bg: rgba(20, 20, 20, 0.98);
}

/* Dark mode specific overrides */
/* Message sender colors are now handled by theme-specific rules */

/* Dark mode input improvements - WHY: Better contrast and visibility */
[data-theme="dark"] .message-input,
[data-theme="dark"] .onboarding-input,
[data-theme="dark"] .onboarding-textarea,
[data-theme="dark"] .settings-input,
[data-theme="dark"] .settings-textarea {
    background: rgba(50, 50, 50, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .message-input::placeholder,
[data-theme="dark"] .onboarding-input::placeholder,
[data-theme="dark"] .onboarding-textarea::placeholder,
[data-theme="dark"] .settings-textarea::placeholder {
    color: #a8a8a8;
    opacity: 0.4;
}

/* Dark mode emoji button - WHY: More visible outline */
[data-theme="dark"] .btn-emoji {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(40, 40, 40, 0.95);
}

[data-theme="dark"] .btn-emoji:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Dark mode input focus states - WHY: Clear visual feedback */
[data-theme="dark"] .message-input:focus,
[data-theme="dark"] .onboarding-input:focus,
[data-theme="dark"] .onboarding-textarea:focus,
[data-theme="dark"] .settings-input:focus,
[data-theme="dark"] .settings-textarea:focus {
    border-color: var(--theme-primary);
    background: rgba(55, 55, 55, 0.95);
}

[data-theme="dark"] .message.user .message-sender {
    color: var(--text-primary);
}
[data-theme="dark"] .chat-header small {
    color: #d0d0d0 !important;
}

[data-theme="dark"] .text-muted {
    color: #b0b0b0 !important;
}

[data-theme="dark"] .message-input {
    color: #f5f5f5;
    background: var(--input-bg) !important;
}

[data-theme="dark"] .message-input:focus {
    border-color: #9b9b9b;
    box-shadow: 0 0 0 3px rgba(155, 155, 155, 0.15);
    background: var(--input-bg) !important;
}

/* ========================================
   THEME VARIATIONS
   ======================================== */

/* Purple Dream Theme (Default) - Light Mode */
[data-aurion-theme="default"]:not([data-theme="dark"]) {
    --theme-primary: #8a2be2;
    --theme-secondary: #91ffff;
    --theme-input-border: #8a2be2;
    --bg-gradient-start: rgba(138, 43, 226, 0.15);
    --bg-gradient-mid: rgba(186, 85, 211, 0.12);
    --bg-gradient-end: rgba(255, 215, 0, 0.15);
    --message-user-bg: rgba(138, 43, 226, 0.12);
    --aurion-logo-bg: linear-gradient(135deg, #8a2be2, #91ffff);
}

/* Purple Dream Theme - Dark Mode */
[data-aurion-theme="default"][data-theme="dark"] {
    --theme-primary: #8a2be2;
    --theme-secondary: #91ffff;
    --theme-input-border: #8a2be2;
    --bg-gradient-start: rgb(0, 0, 0);
    --bg-gradient-mid: rgb(50, 20, 80);
    --bg-gradient-end: rgb(0, 0, 0);
    --message-user-bg: rgba(138, 43, 226, 0.25);
    --aurion-logo-bg: linear-gradient(135deg, #8a2be2, #91ffff);
}

/* Ocean Blue Theme - Light Mode */
[data-aurion-theme="ocean"]:not([data-theme="dark"]) {
    --theme-primary: #0077be;
    --theme-secondary: #00bfff;
    --theme-input-border: #0077be;
    --bg-gradient-start: rgba(0, 80, 150, 0.25);
    --bg-gradient-mid: rgba(0, 150, 255, 0.2);
    --bg-gradient-end: rgba(0, 200, 100, 0.25);
    --message-user-bg: rgba(0, 119, 190, 0.12);
    --aurion-logo-bg: linear-gradient(135deg, #0077be, #00bfff);
}

/* Ocean Blue Theme - Dark Mode */
[data-aurion-theme="ocean"][data-theme="dark"] {
    --theme-primary: #0077be;
    --theme-secondary: #004d7a;
    --theme-input-border: #0077be;
    --bg-gradient-start: rgb(0, 0, 0);
    --bg-gradient-mid: rgb(0, 40, 70);
    --bg-gradient-end: rgb(0, 0, 0);
    --message-user-bg: rgba(0, 119, 190, 0.25);
    --aurion-logo-bg: linear-gradient(135deg, #0077be, #004d7a);
}

/* Sunset Fire Theme - Light Mode */
[data-aurion-theme="sunset"]:not([data-theme="dark"]) {
    --theme-primary: #ff6b35;
    --theme-secondary: #ff8c42;
    --theme-input-border: #ff6b35;
    --bg-gradient-start: rgba(220, 80, 40, 0.25);
    --bg-gradient-mid: rgba(255, 100, 0, 0.2);
    --bg-gradient-end: rgba(220, 0, 120, 0.25);
    --message-user-bg: rgba(255, 107, 53, 0.12);
    --aurion-logo-bg: linear-gradient(135deg, #ff6b35, #ff8c42);
}

/* Sunset Fire Theme - Dark Mode */
[data-aurion-theme="sunset"][data-theme="dark"] {
    --theme-primary: #ff6b35;
    --theme-secondary: #b84a24;
    --theme-input-border: #ff6b35;
    --bg-gradient-start: rgb(0, 0, 0);
    --bg-gradient-mid: rgb(80, 30, 15);
    --bg-gradient-end: rgb(0, 0, 0);
    --message-user-bg: rgba(255, 107, 53, 0.25);
    --aurion-logo-bg: linear-gradient(135deg, #ff6b35, #b84a24);
}

/* Forest Green Theme - Light Mode */
[data-aurion-theme="forest"]:not([data-theme="dark"]) {
    --theme-primary: #2d6a4f;
    --theme-secondary: #52b788;
    --theme-input-border: #2d6a4f;
    --bg-gradient-start: rgba(30, 90, 65, 0.25);
    --bg-gradient-mid: rgba(20, 120, 20, 0.2);
    --bg-gradient-end: rgba(0, 160, 180, 0.25);
    --message-user-bg: rgba(45, 106, 79, 0.12);
    --aurion-logo-bg: linear-gradient(135deg, #2d6a4f, #52b788);
}

/* Forest Green Theme - Dark Mode */
[data-aurion-theme="forest"][data-theme="dark"] {
    --theme-primary: #2d6a4f;
    --theme-secondary: #1b4332;
    --theme-input-border: #2d6a4f;
    --bg-gradient-start: rgb(0, 0, 0);
    --bg-gradient-mid: rgb(15, 45, 30);
    --bg-gradient-end: rgb(0, 0, 0);
    --message-user-bg: rgba(45, 106, 79, 0.25);
    --aurion-logo-bg: linear-gradient(135deg, #2d6a4f, #1b4332);
}

/* Rose Pink Theme - Light Mode */
[data-aurion-theme="rose"]:not([data-theme="dark"]) {
    --theme-primary: #d8345f;
    --theme-secondary: #e85d75;
    --theme-input-border: #d8345f;
    --bg-gradient-start: rgba(200, 40, 85, 0.25);
    --bg-gradient-mid: rgba(230, 20, 130, 0.2);
    --bg-gradient-end: rgba(120, 30, 200, 0.25);
    --message-user-bg: rgba(216, 52, 95, 0.12);
    --aurion-logo-bg: linear-gradient(135deg, #d8345f, #e85d75);
}

/* Rose Pink Theme - Dark Mode */
[data-aurion-theme="rose"][data-theme="dark"] {
    --theme-primary: #d8345f;
    --theme-secondary: #9a2342;
    --theme-input-border: #d8345f;
    --bg-gradient-start: rgb(0, 0, 0);
    --bg-gradient-mid: rgb(70, 20, 40);
    --bg-gradient-end: rgb(0, 0, 0);
    --message-user-bg: rgba(216, 52, 95, 0.25);
    --aurion-logo-bg: linear-gradient(135deg, #d8345f, #9a2342);
}

/* ========================================
   AI Message Sender Colors by Theme
   WHY: Match AI message sender name to theme colors for better visual cohesion
   ======================================== */

/* Purple Dream - AI Sender & Header */
[data-aurion-theme="default"]:not([data-theme="dark"]) .message.ai .message-sender,
[data-aurion-theme="default"]:not([data-theme="dark"]) .message.assistant .message-sender,
[data-aurion-theme="default"]:not([data-theme="dark"]) .aurion-name-header {
    color: #7a40b8 !important;
}

[data-aurion-theme="default"][data-theme="dark"] .message.ai .message-sender,
[data-aurion-theme="default"][data-theme="dark"] .message.assistant .message-sender,
[data-aurion-theme="default"][data-theme="dark"] .aurion-name-header {
    color: #c396ff !important;
}

/* Ocean Blue - AI Sender & Header */
[data-aurion-theme="ocean"]:not([data-theme="dark"]) .message.ai .message-sender,
[data-aurion-theme="ocean"]:not([data-theme="dark"]) .message.assistant .message-sender,
[data-aurion-theme="ocean"]:not([data-theme="dark"]) .aurion-name-header {
    color: #0066a0 !important;
}

[data-aurion-theme="ocean"][data-theme="dark"] .message.ai .message-sender,
[data-aurion-theme="ocean"][data-theme="dark"] .message.assistant .message-sender,
[data-aurion-theme="ocean"][data-theme="dark"] .aurion-name-header {
    color: #5eb8ff !important;
}

/* Sunset Fire - AI Sender & Header */
[data-aurion-theme="sunset"]:not([data-theme="dark"]) .message.ai .message-sender,
[data-aurion-theme="sunset"]:not([data-theme="dark"]) .message.assistant .message-sender,
[data-aurion-theme="sunset"]:not([data-theme="dark"]) .aurion-name-header {
    color: #d65530 !important;
}

[data-aurion-theme="sunset"][data-theme="dark"] .message.ai .message-sender,
[data-aurion-theme="sunset"][data-theme="dark"] .message.assistant .message-sender,
[data-aurion-theme="sunset"][data-theme="dark"] .aurion-name-header {
    color: #ff9b7a !important;
}

/* Forest Green - AI Sender & Header */
[data-aurion-theme="forest"]:not([data-theme="dark"]) .message.ai .message-sender,
[data-aurion-theme="forest"]:not([data-theme="dark"]) .message.assistant .message-sender,
[data-aurion-theme="forest"]:not([data-theme="dark"]) .aurion-name-header {
    color: #256547 !important;
}

[data-aurion-theme="forest"][data-theme="dark"] .message.ai .message-sender,
[data-aurion-theme="forest"][data-theme="dark"] .message.assistant .message-sender,
[data-aurion-theme="forest"][data-theme="dark"] .aurion-name-header {
    color: #70d9a0 !important;
}

/* Rose Pink - AI Sender & Header */
[data-aurion-theme="rose"]:not([data-theme="dark"]) .message.ai .message-sender,
[data-aurion-theme="rose"]:not([data-theme="dark"]) .message.assistant .message-sender,
[data-aurion-theme="rose"]:not([data-theme="dark"]) .aurion-name-header {
    color: #b82d52 !important;
}

[data-aurion-theme="rose"][data-theme="dark"] .message.ai .message-sender,
[data-aurion-theme="rose"][data-theme="dark"] .message.assistant .message-sender,
[data-aurion-theme="rose"][data-theme="dark"] .aurion-name-header {
    color: #ff7a9f !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* WHY: Comprehensive emoji support with web font fallback
       - System emoji fonts first: Apple Color Emoji (macOS/iOS), Segoe UI Emoji (Windows)
       - Noto Color Emoji from Google Fonts as universal fallback for newer emojis
       - Ensures all Unicode emojis render correctly across all platforms */
    font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 32px;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    background-size: 400% 400%;
    background-attachment: fixed;
    min-height: 100vh;
    overflow: hidden;
    /* WHY: Animated gradient creates dynamic visual interest */
    animation: gradientShift 8s ease-in-out infinite;
    /* WHY: Optimize text rendering for better emoji display */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dynamic gradient animation - WHY: Creates visible movement in background */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 50% 75%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 25%;
    }
    100% {
        background-position: 0% 50%;
    }
}


.chat-container {
    max-width: 1800px;
    width: 85%;
    min-width: 80%;
    height: 90vh;
    margin: 5vh auto;
    background: var(--chat-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-header {
    background: var(--chat-header-bg);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* WHY: Create stacking context so dropdown can layer above messages */
    z-index: 5; /* WHY: Ensure header (and its absolutely-positioned children) sit above messages */
}

.aurion-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--aurion-logo-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
    margin-right: 16px;
    padding: 7px;
}

.aurion-logo-svg {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1); /* Make SVG white */
}

.chat-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.version-badge {
	font-size: 1.1rem;
	font-weight: 500;
	color: #999696;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	padding: 5px 8px;
	display: inline-block;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
	background: rgb(246 246 246 / 50%);
	vertical-align: middle;
	top: -2px;
	position: relative;
}

[data-theme="dark"] .version-badge {
    color: #909090;
    border-color: #505050;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.message-sender .version-badge {
	font-size: 0.95rem;
	padding: 0px 8px;
}

.chat-header small {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-theme-toggle, .btn-profile {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--message-ai-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0;
}

.btn-theme-toggle:hover, .btn-profile:hover {
    transform: scale(1.1);
    background: var(--message-user-bg);
    border-color: var(--theme-primary);
}

.btn-theme-toggle i {
    font-size: 1.8rem;
    color: var(--text-primary);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.6rem;
    background-size: cover;
    background-position: center;
}

/* Animated SVG spinner for loading avatar */
.avatar-spinner {
    width: 28px;
    height: 28px;
    display: inline-block;
}

.avatar-spinner circle {
    animation: spinDash 1.5s ease-in-out infinite;
    transform-origin: center;
}

/* Larger spinner for onboarding and settings */
.onboarding-avatar .avatar-spinner,
.settings-avatar .avatar-spinner {
    width: 48px;
    height: 48px;
}

@keyframes spinDash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.profile-dropdown-menu {
    position: fixed;
    top: calc(5vh + 55px);
    right: 30px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    min-width: 275px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100002;
    pointer-events: none;
}

/* New Chat Header Button (Mobile Only) */
.btn-new-chat-header {
    display: none; /* Hidden on desktop */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--message-user-bg);
    color: var(--theme-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-new-chat-header:hover {
    background: var(--message-assistant-bg);
    transform: scale(1.05);
}

.btn-new-chat-header i {
    font-weight: bold;
}

/* Dark mode dropdown background */
[data-theme="dark"] .profile-dropdown-menu {
    background: rgba(20, 20, 20, 0.98);
}

/* Triangle arrow pointing up to avatar */
.profile-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--border-color);
}

.profile-dropdown-menu::after {
    content: '';
    position: absolute;
    top: -9px;
    right: 21px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid rgba(255, 255, 255, 0.98);
}

[data-theme="dark"] .profile-dropdown-menu::after {
    border-bottom-color: rgba(20, 20, 20, 0.98);
}

.profile-dropdown-menu * {
    pointer-events: auto;
}

.profile-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.profile-user-name {
	text-align: left;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 20px 5px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.profile-menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--message-ai-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.profile-menu-item:hover {
    background: var(--message-user-bg);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    transform: translateX(3px);
}

.profile-menu-item i {
    font-size: 1.1rem;
}

.theme-selector-compact {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 8px 0;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    pointer-events: auto;
}

.theme-circle-compact {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    pointer-events: auto;
    flex-shrink: 0;
}

.theme-circle-compact:hover {
    transform: scale(1.15);
}

.theme-circle-compact.active {
    border-color: var(--theme-primary);
    transform: scale(1.25);
    box-shadow: 0 0 0 2px var(--chat-bg), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-circle-compact[data-theme="default"] {
    background: linear-gradient(135deg, #8a2be2, #ba55d3);
}

.theme-circle-compact[data-theme="ocean"] {
    background: linear-gradient(135deg, #0077be, #00bfff);
}

.theme-circle-compact[data-theme="sunset"] {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
}

.theme-circle-compact[data-theme="forest"] {
    background: linear-gradient(135deg, #2d6a4f, #52b788);
}

.theme-circle-compact[data-theme="rose"] {
    background: linear-gradient(135deg, #d8345f, #e85d75);
}

/* Font Size Selector */
.size-selector-compact {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px 0 8px;
    pointer-events: auto;
}

.size-btn-compact {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: transparent;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    flex-shrink: 0;
    color: var(--text-primary);
}

.size-btn-compact:hover {
    transform: scale(1.1);
    border-color: var(--theme-primary);
    background: var(--message-user-bg);
}

.size-btn-compact.active {
    border-color: var(--theme-primary);
    background: var(--message-user-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 20%, transparent);
}

/* Different icon sizes for each button */
.size-btn-compact[data-size="xs"] i {
    font-size: 0.8rem;
}

.size-btn-compact[data-size="sm"] i {
    font-size: 1rem;
}

.size-btn-compact[data-size="md"] i {
    font-size: 1.2rem;
}
.size-btn-compact[data-size="lg"] i {
    font-size: 1.4rem;
}

.size-btn-compact[data-size="xl"] i {
    font-size: 1.6rem;
}

/* Dark Mode Toggle (Mobile Only in Dropdown) */
.dark-mode-toggle-mobile {
    display: none; /* Hidden on desktop */
    padding: 16px 0 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.dark-mode-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    background: var(--message-user-bg);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.dark-mode-switch:hover {
    background: var(--message-assistant-bg);
    transform: scale(1.02);
}

.dark-mode-label {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-mode-label::before {
    content: '🌙';
    font-size: 1.4rem;
}

.dark-mode-checkbox {
    display: none;
}

.dark-mode-slider {
    position: relative;
    width: 60px;
    height: 32px;
    background: var(--border-color);
    border-radius: 32px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.dark-mode-slider::before {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.dark-mode-checkbox:checked + .dark-mode-slider {
    background: var(--theme-primary);
}

.dark-mode-checkbox:checked + .dark-mode-slider::before {
    transform: translateX(28px);
}

/* Font Size Classes - WHY: Apply proportional scaling to chat text AND input */
.font-size-xs .message-bubble {
    font-size: 16px !important;
    line-height: 1.6;
}

.font-size-xs .message-bubble p,
.font-size-xs .message-bubble li,
.font-size-xs .message-bubble code {
    font-size: 16px !important;
}

.font-size-xs .message-bubble h3 {
    font-size: 18px !important;
}

.font-size-xs .message-input,
.font-size-xs .custom-placeholder {
    font-size: 16px !important;
}

.font-size-sm .message-bubble {
    font-size: 19px !important;
    line-height: 1.65;
}

.font-size-sm .message-bubble p,
.font-size-sm .message-bubble li,
.font-size-sm .message-bubble code {
    font-size: 19px !important;
}

.font-size-sm .message-bubble h3 {
    font-size: 22px !important;
}

.font-size-sm .message-input,
.font-size-sm .custom-placeholder {
    font-size: 19px !important;
}

/* Medium is default (23px) - no override needed for messages, but input uses 1.43rem */
.font-size-md .message-input,
.font-size-md .custom-placeholder {
    font-size: 23px !important;
}

.font-size-lg .message-bubble {
    font-size: 27px !important;
    line-height: 1.75;
}

.font-size-lg .message-bubble p,
.font-size-lg .message-bubble li,
.font-size-lg .message-bubble code {
    font-size: 27px !important;
}

.font-size-lg .message-bubble h3 {
    font-size: 32px !important;
}

.font-size-lg .message-input,
.font-size-lg .custom-placeholder {
    font-size: 27px !important;
}

.font-size-xl .message-bubble {
    font-size: 31px !important;
    line-height: 1.7;
}

.font-size-xl .message-bubble p,
.font-size-xl .message-bubble li,
.font-size-xl .message-bubble code {
    font-size: 31px !important;
}

.font-size-xl .message-bubble h3 {
    font-size: 38px !important;
}

.font-size-xl .message-input,
.font-size-xl .custom-placeholder {
    font-size: 31px !important;
}

/* Scale larger headings (h1, h2) proportionally */
.font-size-xs .message-bubble h1,
.font-size-xs .message-bubble h2 {
    transform: scale(0.85);
    transform-origin: left;
}

.font-size-sm .message-bubble h1,
.font-size-sm .message-bubble h2 {
    transform: scale(0.92);
    transform-origin: left;
}

.font-size-lg .message-bubble h1,
.font-size-lg .message-bubble h2 {
    transform: scale(1.15);
    transform-origin: left;
}

.font-size-xl .message-bubble h1,
.font-size-xl .message-bubble h2 {
    transform: scale(1.3);
    transform-origin: left;
}

/* Input Textarea Font Size Classes */
.input-size-xs {
    font-size: 16px !important;
}

.input-size-xs::placeholder {
    font-size: 16px !important;
}

.input-size-sm {
    font-size: 19px !important;
}

.input-size-sm::placeholder {
    font-size: 19px !important;
}

/* Medium (md) is default at 23px - no class needed */

.input-size-lg {
    font-size: 27px !important;
}

.input-size-lg::placeholder {
    font-size: 27px !important;
}

.input-size-xl {
    font-size: 31px !important;
}

.input-size-xl::placeholder {
    font-size: 31px !important;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.message-bubble h3 {
	margin-bottom: 30px!important;
	margin-top: 30px!important;
}
.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.message {
    display: flex;
    margin-bottom: 24px;
    animation: messageSlideIn 0.4s ease;
    opacity: 0;
    animation-fill-mode: forwards;
}

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

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.message-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.4rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    padding: 5px;
}

.message.ai .message-avatar {
    background: var(--aurion-logo-bg);
    margin-right: 12px;
    padding: 10px;
}

.aurion-avatar-svg {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1); /* Make SVG white */
}

.message.user .message-avatar {
    background: var(--user-avatar-bg);
    margin-left: 12px;
    color: #333;
}

.message-content-wrapper {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.message.user .message-content-wrapper {
    align-items: flex-end;
}

.message.ai .message-content-wrapper {
    align-items: flex-start;
    max-width: 100%;
    width: 100%;
    flex: 1;
}

.message.user .message-sender { 
	color: rgb(13, 13, 13); 
 }

.message-sender {
	font-size: 23px;
	font-weight: 500;
	/* Color set by theme-specific rules */
	margin-top: 15px;
	padding: 0 4px;
	margin-left: 5px;
	padding-bottom: 20px;
 }

.message-bubble {
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 23px;
    line-height: 44px;
    margin-top: 20px;
    word-wrap: break-word;
    max-width: 100%;
    /* WHY: Only transition transform and box-shadow for hover effect
       Removed 'all' to prevent giant flash when content/size changes during streaming */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* WHY: Ensure emoji fonts are explicitly inherited and rendered properly */
    font-family: inherit;
    font-variant-emoji: emoji;
}

/* Markdown content defaults inside message bubbles */

.message.user .message-bubble p {
	margin: 5px 15px;
	margin-top: 1px;
 }

.message-bubble p {
    margin: 0 0 0.6rem 0;
    margin-top: 23px;
}
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    margin: 0.6rem 0 0.4rem;
    line-height: 32px;
}
.message-bubble ul,
.message-bubble ol {
    padding-left: 1.25rem;
    margin: 0.4rem 0 0.6rem;
}
.message-bubble li { margin: 0.25rem 0; }
.message-bubble hr {
    border: none;
    border-top: 1px solid var(--text-secondary);
    border-top-width: 1px;
    margin: 3em 0;
    opacity: 0.5;
}
.message-bubble code {
    background: rgba(0,0,0,0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
}
.message-bubble pre {
    background: rgba(0,0,0,0.06);
    padding: 0.9rem 1rem;
    border-radius: 10px;
    overflow: auto;
}
.message-bubble strong,
.message-bubble b {
    font-weight: 600;
}
.message-bubble em,
.message-bubble i {
    font-style: italic;
}
.message-bubble blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin: 0.6rem 0;
    font-style: italic;
    opacity: 0.9;
}
/* Color swatch circles for hex codes - replaces hex text with just a circle */
.color-swatch-circle {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.2);
    vertical-align: middle;
    margin: 0 2px;
    cursor: help;
}

.message.user .message-bubble {
    background: var(--message-user-bg);
    border-top-right-radius: 0px;
}

.message.ai .message-bubble {
   /* background: var(--message-ai-bg); */
    border-bottom-left-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.message.user .message-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Limit Reached Message Bubble - Pink Alert */
.limit-reached-bubble {
    background: rgba(255, 182, 193, 0.25) !important;
    border: 2px solid rgba(255, 105, 135, 0.5) !important;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 22px !important;    
    margin-top: 5px !important;
}

[data-theme="dark"] .limit-reached-bubble {
    background: rgba(255, 105, 135, 0.15) !important;
    border-color: rgba(255, 105, 135, 0.4) !important;
}

.limit-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.limit-reached-bubble strong {
	color: #d81b60;
	font-size: 0.8em;
	font-weight: 400;
	line-height: 1.4em;
	margin-top: 10px;
}

[data-theme="dark"] .limit-reached-bubble strong {
    color: #ff6b9d;
}

.limit-icon {
    flex-shrink: 0;
    color: #d81b60;
    width: 28px;
    height: 28px;
}

[data-theme="dark"] .limit-icon {
    color: #ff6b9d;
}

.new-invite-code-btn {
    align-self: center;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary), var(--theme-primary));
    background-size: 200% 200%;
    animation: buttonGradientShift 4s ease-in-out infinite;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-primary) 30%, transparent);
    position: relative;
    overflow: hidden;
}

.new-invite-code-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0.3),
        transparent 50%,
        transparent
    );
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

.new-invite-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.new-invite-code-btn:active {
    transform: translateY(0);
}

.new-invite-code-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.new-invite-code-btn:disabled::before {
    animation: none;
}

.letter-fade {
    display: inline;
    animation: letterFadeIn 0.15s ease;
}

@keyframes letterFadeIn {
    from {
        opacity: 0;
        filter: blur(2px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

.input-area {
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    padding: 26px 39px;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 100000;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.message-input {
    flex: 1;
    font-size: 1.43rem;
    padding: 21px 26px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--chat-bg);
    color: var(--text-primary);
    resize: none;
    max-height: 195px;
    min-height: 68px;
    height: auto;
    transition: all 0.3s ease;
    font-family: inherit;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-input.has-overflow {
    padding-right: 16px; /* WHY: Make room for scrollbar when visible */
}

/* WHY: Hide scrollbar on single line, show on multi-line (2nd+ row) */
.message-input::-webkit-scrollbar {
    width: 0px;
}

.message-input.has-overflow::-webkit-scrollbar {
    width: 10px;
}

.message-input.has-overflow::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.message-input.has-overflow::-webkit-scrollbar-thumb {
    background: var(--theme-primary);
    border-radius: 10px;
    border: 2px solid var(--chat-bg);
}

.message-input.has-overflow::-webkit-scrollbar-thumb:hover {
    background: var(--theme-secondary);
}

.message-input:focus {
    outline: none;
    border-color: var(--theme-input-border);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 10%, transparent);
}

.message-input::placeholder {
    color: transparent;
}

.custom-placeholder {
    position: absolute;
    left: 109px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--input-placeholder);
    opacity: 0.6;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 195px);
    font-size: 1.43rem;
    transition: opacity 0.2s;
}

.custom-placeholder .placeholder-emoji {
    opacity: 0.4;
}

.btn-emoji, .btn-send {
    width: 73px;
    height: 73px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.69rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-emoji {
    background: var(--chat-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-emoji:hover {
    background: var(--message-user-bg);
    transform: scale(1.1);
}

.btn-send {
    background: linear-gradient(135deg, var(--theme-primary), #8cd5d5, var(--theme-primary));
    background-size: 200% 200%;
    color: white;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-primary) 30%, transparent);
    /* WHY: Subtle gradient animation creates a living, breathing button effect */
    animation: buttonGradientShift 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

/* Subtle gradient animation for send button - WHY: Adds visual interest and draws attention */
@keyframes buttonGradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Optional shimmer effect overlay */
.btn-send::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%
    );
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.btn-send:hover  { 
	color: white!important;
 }

.btn-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.btn-send:hover:not(:disabled) i {
    animation: gentleSpin 2s linear infinite;
}

@keyframes gentleSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send:disabled::before {
    animation: none;
}

/* Welcome Message */
.welcome-message {
    position: absolute;
    top: 50%;
    left: 80px;
    right: 80px;
    transform: translateY(-50%);
    z-index: 1;
    opacity: 1;
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
}

.welcome-message.hidden {
    opacity: 0;
    transform: translateY(-45%);
}

.welcome-text {
    font-size: 3rem;
    line-height: 3.3rem;
    font-weight: 500;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    padding: 20px;
    width: 100%;
    animation: welcomePulse 2s ease-in-out infinite;
}

@keyframes welcomePulse {
    0%, 100% {
        opacity: 0.85;
    }
    50% {
        opacity: 1;
    }
}

[data-theme="dark"] .welcome-text {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
	position: absolute;
	bottom: 140px;
	left: 50%;
	transform: translateX(-50%);
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: transparent;
	backdrop-filter: blur(10px);
	border: 2px solid color-mix(in srgb, var(--theme-primary) 30%, transparent);
	color: var(--theme-primary);
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 100001;
	box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-primary) 30%, transparent);
	transition: all 0.3s ease;
	opacity: 0;
	pointer-events: none;
}

.scroll-to-bottom-btn.show {
    opacity: 1;
    pointer-events: auto;
}

.scroll-to-bottom-btn:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--theme-primary) 50%, transparent);
}

.scroll-to-bottom-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.scroll-to-bottom-btn i {
    font-size: 28px;
}

[data-theme="dark"] .scroll-to-bottom-btn {
    background: transparent;
    border: 2px solid color-mix(in srgb, var(--theme-primary) 40%, transparent);
    color: var(--theme-primary);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-primary) 25%, transparent);
}

[data-theme="dark"] .scroll-to-bottom-btn:hover {
    box-shadow: 0 12px 32px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}
 

/* Theme-specific button gradients for better contrast - WHY: Sunset and Rose need more distinct color variations */
[data-aurion-theme="sunset"] .btn-send {
    background: linear-gradient(135deg, #ff6b35, #ffbc00, #ff6b35);
    background-size: 200% 200%;
    animation: buttonGradientShift 4s ease-in-out infinite;
}

[data-aurion-theme="rose"] .btn-send {
    background: linear-gradient(135deg, #d8345f, #ff5dc6, #d8345f);
    background-size: 200% 200%;
    animation: buttonGradientShift 4s ease-in-out infinite;
}

/* Tooltipster Custom Styling - WHY: Small, elegant tooltips that match the interface */
/* Base Tooltipster theme overrides */
.tooltipster-noir {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tooltipster-noir.tooltipster-sidetip .tooltipster-box {
    border-radius: 8px;
}

.tooltipster-noir .tooltipster-content {
    font-size: 12px;
    padding: 6px 12px;
    font-weight: 500;
}

/* Arrow (triangle) sizing */
.tooltipster-noir.tooltipster-sidetip .tooltipster-arrow {
    height: 10px;
    width: 18px;
}

/* Light mode: white card with dark text and subtle border */
.tooltipster-noir.tooltipster-sidetip .tooltipster-box {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.18);
}
.tooltipster-noir .tooltipster-content { color: #1a1a1a; }

.tooltipster-noir.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-background { border-bottom-color: rgba(255, 255, 255, 0.98); }
.tooltipster-noir.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-border { border-bottom-color: rgba(0, 0, 0, 0.18); }
.tooltipster-noir.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-background { border-top-color: rgba(255, 255, 255, 0.98); }
.tooltipster-noir.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-border { border-top-color: rgba(0, 0, 0, 0.18); }

/* Dark mode: dark card with light text and subtle light border */
[data-theme="dark"] .tooltipster-noir.tooltipster-sidetip .tooltipster-box {
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .tooltipster-noir .tooltipster-content { color: #ffffff; }

[data-theme="dark"] .tooltipster-noir.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-background { border-bottom-color: rgba(30, 30, 30, 0.98); }
[data-theme="dark"] .tooltipster-noir.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-border { border-bottom-color: rgba(255, 255, 255, 0.18); }
[data-theme="dark"] .tooltipster-noir.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-background { border-top-color: rgba(30, 30, 30, 0.98); }
[data-theme="dark"] .tooltipster-noir.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-border { border-top-color: rgba(255, 255, 255, 0.18); }

/* Invite Code Usage Progress Bar in Profile Dropdown */
.invite-usage-container {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.invite-usage-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    line-height: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.invite-usage-count {
    font-weight: 700;
    color: #5b5b5c;
}

.invite-usage-bar {
    height: 15px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

[data-theme="dark"] .invite-usage-bar {
    background: rgba(255, 255, 255, 0.1);
}

.invite-usage-fill {
    height: 100%;
    background: var(--theme-primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Invite Code Onboarding Step Styling */
.invite-code-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
}

.invite-code-input {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: lowercase;
}

.invite-code-feedback {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 1.4rem;
    font-weight: 500;
    text-align: center;
    display: none;
}

.invite-code-feedback.success {
    display: block;
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.invite-code-feedback.error {
    display: block;
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

[data-theme="dark"] .invite-code-feedback.success {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

[data-theme="dark"] .invite-code-feedback.error {
    background: rgba(244, 67, 54, 0.2);
    color: #e57373;
}

.emoji-picker-container {
    position: absolute;
    bottom: 117px;
    left: 39px;
    z-index: 100000;
    animation: emojiSlideUp 0.3s ease;
}

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

emoji-picker {
    --border-radius: 16px;
    box-shadow: var(--shadow);
    /* WHY: Scale emoji picker 30% larger to match input area sizing */
    font-size: 130%;
    transform: scale(1.3);
    transform-origin: bottom left;
    position: relative;
    z-index: 100001;
}

.modal-content {
    background: var(--modal-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-hover);
}

.modal-header {
    padding: 30px 30px 20px;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 30px;
    color: var(--text-primary);
}

.modal-body p {
    font-size: 1.4rem;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 20px 30px 30px;
}

.modal-content .form-control {
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.4rem;
    padding: 14px 18px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.modal-content .form-control:focus {
    outline: none;
    border-color: var(--theme-input-border);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 10%, transparent);
}

.modal-content .btn-primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    border: none;
    font-size: 1.1rem;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modal-content .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.message.assistant .message-bubble, .message.ai .message-bubble {
	margin-top: -20px;
}

/* Error Message Styling - WHY: Pink color for error messages to stand out */
.message.error-message .message-bubble {
    color: #e91e63 !important;
}

[data-theme="dark"] .message.error-message .message-bubble {
    color: #ff4d94 !important;
}

code { 
	color: #bf17ac!important;
}

/* Responsive Design - Tablet and below */
@media (max-width: 999px) {
    /* Hide pin button in sidebar below 1000px */
    .btn-pin-sidebar {
        display: none !important;
    }
}

/* Responsive Design - Mobile Optimization */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    /* Thinner header bar on mobile */
    .chat-header {
        padding: 8px 10px;
        min-height: 50px;
    }
    
    .chat-header h1 {
        font-size: 1.2rem;
    }
    
    .chat-header .text-muted {
        font-size: 1rem;
    }
    
    .header-subtitle {
        font-size: 0.7rem;
    }
    
    .header-controls {
        gap: 6px;
    }
    
    /* Hide theme toggle button on mobile */
    .btn-theme-toggle {
        display: none;
    }
    
    /* Show new chat button in header on mobile */
    .btn-new-chat-header {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide floating new chat button on mobile */
    .new-chat-floating {
        display: none !important;
    }
    
    .btn-profile {
        width: 50px;
        height: 50px;
    }
    
    .profile-avatar {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .aurion-logo {
        width: 50px;
        height: 50px;
    }
    
    /* Messages area with proper padding */
    #messagesContainer {
        padding: 15px;
    }
    
    .message-content-wrapper {
        max-width: 85%;
    }
    
    /* Message bubble text padding - reduced on mobile */
    .message-bubble {
        padding: 10px 0px;
    }
    
    /* Thinner input area on mobile */
    .input-area {
        padding: 8px 10px;
        gap: 4px;
    }
    
    .input-wrapper {
        padding: 8px 10px 8px 14px;
        min-height: 42px;
        flex: 1;
    }
    
    .message-input {
        font-size: 16px;
        padding: 10px 12px;
        min-height: 40px;
    }
    
    .message-input::placeholder {
        padding-left: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 16px;
    }
    
    .custom-placeholder {
        left: 63px;
        font-size: 16px;
        max-width: calc(100% - 107px);
    }
    
    /* Smaller emoji button on mobile */
    .btn-emoji {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .btn-send {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    /* Smaller emoji picker on mobile */
    emoji-picker {
        width: 350px !important;
        max-height: 400px;
        font-size: 100% !important;
        transform: scale(1) !important;
        --emoji-size: 1.6rem !important;
        --category-emoji-size: 1.3rem !important;
        --emoji-padding: 0.35rem !important;
    }
    
    .emoji-picker-container {
        left: 10px;
        bottom: 60px;
    }
    
    /* Reduced font sizes for all 5 settings on mobile - WHY: Better readability on small screens */
    .font-size-xs .message-bubble {
        font-size: 0.75rem !important;
        line-height: 1.4;
    }
    
    .font-size-xs .message-input,
    .font-size-xs .custom-placeholder {
        font-size: 12px !important;
    }
    
    .font-size-sm .message-bubble {
        font-size: 0.8rem !important;
        line-height: 1.5;
    }
    
    .font-size-sm .message-input,
    .font-size-sm .custom-placeholder {
        font-size: 13px !important;
    }
    
    .font-size-md .message-bubble {
        font-size: 0.9rem !important;
        line-height: 1.45;
    }
    
    .font-size-md .message-input,
    .font-size-md .custom-placeholder {
        font-size: 14px !important;
    }
    
    .font-size-lg .message-bubble {
        font-size: 0.95rem !important;
        line-height: 1.7;
    }
    
    .font-size-lg .message-input,
    .font-size-lg .custom-placeholder {
        font-size: 15px !important;
    }
    
    .font-size-xl .message-bubble {
        font-size: 1.15rem !important;
        line-height: 1.7;
    }
    
    .font-size-xl .message-input,
    .font-size-xl .custom-placeholder {
        font-size: 18px !important;
    }
    
    /* Sidebar full width on mobile */
    .sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    .sidebar.open ~ #chatContainer {
        margin-left: 0;
        width: 100%;
    }
    
    /* Hide pin button in sidebar on mobile */
    .btn-pin-sidebar {
        display: none !important;
    }
    
    /* Smaller avatars on mobile */
    .message-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;	    
    }
    
    /* Simple margin on avatar only */
    .message.ai .message-avatar,
    .message.assistant .message-avatar {
        margin-left: 20px;
        margin-right: 12px;
    }
    
    .message.ai,
    .message.assistant {
        align-items: flex-start;
    }
    
    .message-sender {
        font-size: 1.2rem;
        margin-top: 0;
        margin-bottom: 4px;
        padding-bottom: 0;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    /* Override negative margin on AI message bubble for mobile */
    .message.assistant .message-bubble,
    .message.ai .message-bubble {
        margin-top: 8px;
        margin-left: -20px;
    }
    
    .version-badge {
        font-size: 0.8rem;
        padding: 2px 5px;
    }
    
    /* Hide user sender name on mobile to save space */
    .message.user .message-sender {
        display: none;
    }
    
    /* Extra padding above first user message */
    .message.user:first-of-type {
        padding-top: 20px;
    }
    
    /* Show dark mode toggle on mobile */
    .dark-mode-toggle-mobile {
        display: block;
    }
    
    /* Disable all tooltips on mobile */
    .tooltipster-base,
    .tooltip,
    [data-toggle="tooltip"],
    .tooltipster-content {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Position dropdown higher on mobile */
    .profile-dropdown-menu {
        top: 60px;
        right: 10px;
    }
    
    /* Welcome message on mobile */
    .welcome-message {
        left: 15px;
        right: 15px;
    }
    
    .welcome-text {
        font-size: 2rem;
        line-height: 2.3rem;
    }
    
    /* Scroll to bottom button */
    .scroll-to-bottom-btn {
        bottom: 80px;
        width: 48px;
        height: 48px;
    }
    
    /* Hide floating sidebar toggle on mobile - use in-header toggle instead */
    .sidebar-toggle {
        display: block !important;
        position: static !important;
        width: 42px;
        height: 42px;
        margin-right: 8px;
        font-size: 1.1rem;
        opacity: 1;
        pointer-events: auto;
        transition: none;
        left: auto !important;
        top: auto !important;
        transform: none !important;
    }
    
    .sidebar-toggle.hidden {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .chat-header .d-flex {
        display: flex !important;
        align-items: center;
    }
    
    /* Move toggle into header */
    .chat-header {
        display: flex;
        align-items: center;
    }
    
    .new-chat-floating {
        width: 46px;
        height: 46px;
        left: 10px;
        font-size: 1.2rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .chat-header {
        padding: 6px 8px;
        min-height: 48px;
    }
    
    .chat-header h1 {
        font-size: 1.1rem;
    }
    
    /* Show new chat button in header on mobile */
    .btn-new-chat-header {
        display: flex !important;
        width: 46px;
        height: 46px;
    }
    
    /* Hide floating new chat button on mobile */
    .new-chat-floating {
        display: none !important;
    }
    
    .btn-theme-toggle {
        width: 36px;
        height: 36px;
    }
    
    .btn-profile {
        width: 46px;
        height: 46px;
    }
    
    .profile-avatar {
        width: 46px;
        height: 46px;
        font-size: 0.9rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    #messagesContainer {
        padding: 0px;
    }
    
    .message-bubble {
        padding: 8px 0px;
    }
    
    .input-area {
        padding: 6px 8px;
        gap: 3px;
    }
    
    .input-wrapper {
        padding: 6px 8px 6px 3px;
        min-height: 38px;
    }
    
    .message-input {
        font-size: 15px;
        padding: 8px 10px;
        min-height: 36px;
    }
    
    .message-input::placeholder {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
    }
    
    .custom-placeholder {
        left: 64px;
        font-size: 15px;
        max-width: calc(100% - 109px);
    }
    
    .btn-emoji {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    
    .btn-send {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }
    
    emoji-picker {
        width: 350px !important;
        max-height: 400px;
        font-size: 100% !important;
        transform: scale(1) !important;
        --emoji-size: 1.5rem !important;
        --category-emoji-size: 1.2rem !important;
        --emoji-padding: 0.3rem !important;
    }
    
    .emoji-picker-container {
        left: 8px;
        bottom: 56px;
    }
    
    .aurion-logo {
        width: 46px;
        height: 46px;
    }
    
    .sidebar-toggle {
        display: block !important;
        position: static !important;
        width: 38px;
        height: 38px;
        margin-right: 6px;
        font-size: 1rem;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .sidebar-toggle.hidden {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    /* Hide pin button in sidebar on mobile */
    .btn-pin-sidebar {
        display: none !important;
    }
    
    .new-chat-floating {
        width: 42px;
        height: 42px;
        left: 8px;
        font-size: 1.1rem;
    }
    
    /* Message avatar adjustments for extra small mobile */
    .message.ai .message-avatar,
    .message.assistant .message-avatar {
        margin-left: 15px;
        margin-right: 10px;
    }
    
    .message.ai,
    .message.assistant {
        align-items: flex-start;
    }
    
    .message-sender {
        margin-top: 0;
        padding-bottom: 0;
        gap: 5px;	   
        margin-left: -5px;
    }
    
    /* Override negative margin on AI message bubble */
    .message.assistant .message-bubble,
    .message.ai .message-bubble {
        margin-top: 8px;
        margin-left: -35px;
    }
    
    .welcome-text {
        font-size: 1.6rem;
        line-height: 2rem;
    }
    
    /* Disable all tooltips on mobile */
    .tooltipster-base,
    .tooltip,
    [data-toggle="tooltip"],
    .tooltipster-content {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Position dropdown higher on extra small mobile */
    .profile-dropdown-menu {
        top: 75px;
        right: 8px;
    }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ========================================
   ONBOARDING MODAL STYLES
   ======================================== */

/* Blurred backdrop for onboarding/personalize modal */
#onboardingModal ~ .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] #onboardingModal ~ .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.3);
}

.onboarding-modal-dialog {
    max-width: 780px;
}

.onboarding-modal-content {
    background: var(--modal-bg);
    backdrop-filter: blur(25px);
    border-radius: 26px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

.onboarding-progress {
    height: 6px;
    background: var(--border-color);
    overflow: hidden;
    position: relative;
}

.onboarding-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary));
    width: 25%;
    transition: width 0.4s ease;
}

.onboarding-title {
    font-size: 2.34rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: auto;
}

@media (max-width: 480px) {
    .onboarding-title {
        font-size: 1.8rem;
    }
}

.onboarding-body {
    padding: 26px 39px;
    min-height: 400px;
}

@media (max-width: 768px) {
    .onboarding-body {
        padding: 20px 24px;
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .onboarding-body {
        padding: 18px 20px;
        min-height: 320px;
    }
}

.onboarding-step {
    display: none;
    animation: fadeInStep 0.4s ease;
}

.onboarding-step.active {
    display: block;
}

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

.onboarding-label {
    font-size: 1.7rem!important;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 35px; 
    text-align: center;
}

@media (max-width: 480px) {
    .onboarding-label {
        font-size: 1.5rem!important;
        margin-bottom: 25px;
    }
}

.onboarding-sublabel {
    font-size: 1.17rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

@media (max-width: 480px) {
    .onboarding-sublabel {
        font-size: 1.05rem;
        margin-bottom: 15px;
    }
}

.optional {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.onboarding-input {
    font-size: 1.43rem;
    padding: 18px 24px;
    border-radius: 16px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.onboarding-input:focus {
    outline: none;
    border-color: var(--theme-input-border);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-primary) 15%, transparent);
}

.onboarding-input::placeholder {
    color: var(--input-placeholder);
    opacity: 0.35;
}

.invite-code-help {
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 1.3rem;
    color: var(--text-secondary);
    text-align: center;
}

.invite-code-help a {
    color: var(--theme-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.invite-code-help a:hover {
    color: var(--theme-primary-hover);
    text-decoration: underline;
}

.onboarding-textarea {
    font-size: 1.2rem;
    padding: 18px 24px;
    border-radius: 16px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    resize: vertical;
    min-height: 150px;
    transition: all 0.3s ease;
}

.onboarding-textarea:focus {
    outline: none;
    border-color: var(--theme-input-border);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-primary) 15%, transparent);
}

.onboarding-textarea::placeholder {
    color: var(--input-placeholder);
    opacity: 0.35;
}

.char-count {
    text-align: right;
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Final Onboarding Step Styling */
.final-step-icon {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 25px;
    animation: bounceIn 0.8s ease;
}

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

.final-step-title {
    font-size: 1.7rem !important;
    text-align: center; 
    margin-bottom: 35px !important;
}

.final-step-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 500px;
}

.final-step-list li {
    font-size: 1.35rem;
    color: var(--text-primary) !important;
    padding: 18px 20px;
    margin-bottom: 12px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    display: flex !important;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.3s ease;
    opacity: 1 !important;
    transform: translateX(0) !important;
}

.final-step-list.animating li {
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.5s ease forwards;
}

.final-step-list.animating li:nth-child(1) { animation-delay: 0.1s; }
.final-step-list.animating li:nth-child(2) { animation-delay: 0.2s; }
.final-step-list.animating li:nth-child(3) { animation-delay: 0.3s; }
.final-step-list.animating li:nth-child(4) { animation-delay: 0.4s; }
.final-step-list.animating li:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.final-step-list li:before {
    content: '✨';
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.final-step-list li:hover {
    border-color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 5%, var(--input-bg));
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .final-step-list {
        max-width: 100%;
    }
    
    .final-step-list li {
        font-size: 1.2rem;
        padding: 15px 18px;
    }
}

@media (max-width: 480px) {
    .final-step-list li {
        font-size: 1.2rem;
        padding: 12px 15px;
        margin-bottom: 10px;
    }
    
    .final-step-list li:before {
        font-size: 1.3rem;
    }
}

/* Avatar Upload */
.onboarding-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.onboarding-avatar {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-primary) 30%, transparent);
    background-size: cover;
    background-position: center;
}

.onboarding-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.onboarding-avatar-edit {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-primary);
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.onboarding-avatar-edit:hover {
    transform: scale(1.1);
    background: var(--theme-primary);
    color: white;
}

/* Theme Selection */
.onboarding-themes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .onboarding-themes {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .onboarding-themes {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-clip: padding-box;
}

@media (max-width: 768px) {
    .theme-circle {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .theme-circle {
        width: 60px;
        height: 60px;
    }
}

.theme-option:hover .theme-circle {
    transform: scale(1.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.theme-option.active .theme-circle {
	border-color: transparent;
	transform: scale(1.2);
	box-shadow: 0 0 0 5px var(--theme-primary), 0 8px 24px rgba(0, 0, 0, 0.25);
}

@media (max-width: 480px) {
    .theme-option.active .theme-circle {
        box-shadow: 0 0 0 3px var(--theme-primary), 0 8px 24px rgba(0, 0, 0, 0.25);
    }
}

.theme-option span {
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 768px) {
    .theme-option span {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .theme-option span {
        font-size: 0.95rem;
    }
}

.theme-option.active span {
    color: var(--text-primary);
    font-weight: 600;
}

/* Theme Colors */
.theme-option[data-theme="default"] .theme-circle {
    background: linear-gradient(135deg, #8a2be2, #ba55d3);
}

.theme-option[data-theme="ocean"] .theme-circle {
    background: linear-gradient(135deg, #0077be, #00bfff);
}

.theme-option[data-theme="sunset"] .theme-circle {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
}

.theme-option[data-theme="forest"] .theme-circle {
    background: linear-gradient(135deg, #2d6a4f, #52b788);
}

.theme-option[data-theme="rose"] .theme-circle {
    background: linear-gradient(135deg, #d8345f, #e85d75);
}

/* Dark Mode Toggle in Onboarding */
.onboarding-dark-toggle {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: var(--input-bg);
    border-radius: 16px;
    border: 2px solid var(--border-color);
}

@media (max-width: 480px) {
    .onboarding-dark-toggle {
        padding: 16px;
    }
}

.onboarding-dark-toggle label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .onboarding-dark-toggle label {
        font-size: 1.3rem;
        gap: 10px;
    }
}

.onboarding-dark-toggle input[type="checkbox"] {
    width: 50px;
    height: 26px;
    appearance: none;
    background: var(--border-color);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.onboarding-dark-toggle input[type="checkbox"]:checked {
    background: var(--theme-primary);
}

.onboarding-dark-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.onboarding-dark-toggle input[type="checkbox"]:checked::before {
    left: 26px;
}

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

/* Footer Buttons */
.onboarding-footer {
    padding: 26px 39px 39px;
    display: flex;
    gap: 16px;
    align-items: stretch; /* WHY: Ensure buttons have equal height */
}

.onboarding-btn {
    flex: 1 1 0%; /* WHY: Equal widths regardless of content length */
    min-width: 0; /* WHY: Allow shrinking below intrinsic content width */
    display: inline-flex; /* WHY: Consistent centering with icons/text */
    align-items: center;
    justify-content: center;
    gap: 8px; /* WHY: Space between icon and text */
    font-size: 1.43rem;
    padding: 18px;
    min-height: 58px; /* WHY: Force equal height across buttons */
    line-height: 1.1; /* WHY: Avoid line-height affecting overall height */
    white-space: nowrap; /* WHY: Keep label in one line to avoid height jumps */
    border-radius: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.onboarding-btn i {
    font-size: 1.25rem; /* WHY: Normalize icon size */
}

.onboarding-btn.btn-secondary {
    background: var(--message-ai-bg);
    border: none;
    color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--border-color) inset;
}

.onboarding-btn.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 0 2px var(--border-color) inset, 0 6px 20px rgba(0, 0, 0, 0.15);
}

.onboarding-btn.btn-primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    border: none;
    color: white;
}

.onboarding-btn.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.onboarding-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   SETTINGS MODAL
   ======================================== */

.settings-modal-dialog {
    max-width: 900px;
}

.settings-modal-content {
    background: var(--modal-bg);
    border: none;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.settings-title {
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0;
}

.settings-body {
    display: flex;
    gap: 0;
    padding: 0;
    min-height: 500px;
}

/* Sidebar Navigation */
.settings-sidebar {
    width: 250px;
    background: var(--message-ai-bg);
    border-right: 1px solid var(--border-color);
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top-left-radius: 24px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.settings-nav-item:first-child {
  /*  border-top-left-radius: 24px; */
}

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

.settings-nav-item.active {
    background: var(--message-user-bg);
    color: var(--theme-primary);
    border-left-color: var(--theme-primary);
    font-weight: 600;
}

.settings-nav-item i {
    font-size: 1.3rem;
}

/* Content Area */
.settings-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    max-height: 600px;
}

/* Content Header with Title and Close Button */
.settings-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    border-bottom: 1px solid var(--border-color);
}

.settings-content-header .settings-title {
    margin: 0;
}

.settings-content-header .btn-close {
    font-size: 1.2rem;
}

/* Adjust section padding */
.settings-section {
    padding: 30px 40px;
    display: none;
}

.settings-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.settings-section-title {
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.settings-description {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.settings-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.settings-input {
    font-size: 1.15rem;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.settings-input:focus {
    outline: none;
    border-color: var(--theme-input-border);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 10%, transparent);
}

.settings-textarea {
    font-size: 1.1rem;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.settings-textarea:focus {
    outline: none;
    border-color: var(--theme-input-border);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 10%, transparent);
}

.settings-textarea::placeholder {
    color: var(--input-placeholder);
    opacity: 0.6;
}

/* Avatar in Settings */
.settings-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.settings-avatar {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-primary) 30%, transparent);
    background-size: cover;
    background-position: center;
}

.settings-avatar:hover {
    transform: scale(1.05);
}

.settings-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-primary);
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.settings-avatar-edit:hover {
    transform: scale(1.1);
    background: var(--theme-primary);
    color: white;
}

/* Dark Mode Toggle in Settings */
.settings-dark-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--message-ai-bg);
    border-radius: 12px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 1.1rem;
}

.settings-dark-toggle input[type="checkbox"] {
    width: 52px;
    height: 28px;
    appearance: none;
    background: var(--border-color);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-dark-toggle input[type="checkbox"]:checked {
    background: var(--theme-primary);
}

.settings-dark-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.settings-dark-toggle input[type="checkbox"]:checked::before {
    left: 26px;
}

/* Theme Selection in Settings */
.settings-themes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.theme-option-settings {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 12px;
    border-radius: 12px;
    background: var(--message-ai-bg);
    border: 2px solid transparent;
}

.theme-option-settings:hover {
    background: var(--message-user-bg);
    transform: translateY(-3px);
}

.theme-option-settings.active {
    border-color: var(--theme-primary);
    background: var(--message-user-bg);
}

.theme-circle-settings {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-option-settings:hover .theme-circle-settings {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.theme-circle-settings {
    background: linear-gradient(135deg, #8a2be2, #ba55d3);
}

.theme-option-settings[data-theme="default"] .theme-circle-settings {
    background: linear-gradient(135deg, #8a2be2, #ba55d3);
}

.theme-option-settings[data-theme="ocean"] .theme-circle-settings {
    background: linear-gradient(135deg, #0077be, #00bfff);
}

.theme-option-settings[data-theme="sunset"] .theme-circle-settings {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
}

.theme-option-settings[data-theme="forest"] .theme-circle-settings {
    background: linear-gradient(135deg, #2d6a4f, #52b788);
}

.theme-option-settings[data-theme="rose"] .theme-circle-settings {
    background: linear-gradient(135deg, #d8345f, #e85d75);
}

.theme-option-settings span {
	font-size: 1.25rem;
	font-weight: 400;
	color: var(--text-primary);
	text-align: center;
	line-height: 24px;
}

/* Settings Footer */
.settings-footer {
    padding: 20px 30px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.settings-btn {
    padding: 12px 28px;
    font-size: 1.1rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.settings-btn.btn-secondary {
    background: var(--message-ai-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.settings-btn.btn-secondary:hover {
    background: var(--message-user-bg);
    transform: translateY(-2px);
}

.settings-btn.btn-primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    border: none;
    color: white;
}

.settings-btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

/* ========================================
   SIDEBAR STYLES
   ======================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 380px;
    background: var(--chat-header-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    transition: transform 1.0s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    will-change: transform;
}

.sidebar.open {
    transform: translateX(0);
    transition: transform 1.0s ease-in-out;
}

/* Sidebar guaranteed animations (1s) */
@keyframes sidebarSlideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

@keyframes sidebarSlideOut {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

.sidebar.opening {
  animation: sidebarSlideIn 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.sidebar.closing {
  animation: sidebarSlideOut 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-new-chat {
    width: 48px;
    height: 48px;
    padding: 0;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-new-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.sidebar-chats {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    padding: 8px 9px;
    margin-bottom: 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 1px solid transparent;
}

/* Smooth animation when chat moves to top */
@keyframes chatSlideIn {
    0% {
        opacity: 0.5;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-item:hover {
    background: var(--message-ai-bg);
    border-color: var(--border-color);
}

.chat-item.active {
    background: var(--message-user-bg);
    border-color: var(--theme-primary);
    font-weight: 600;
}

.chat-item-icon {
    font-size: 1.2rem;
    opacity: 0.7;
}

.chat-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.sidebar-toggle {
    position: fixed;
    left: 20px;
    top: calc(5vh + 0px);
    width: 48px;
    height: 48px;
    background: var(--chat-bg);
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    z-index: 999;
    box-shadow: var(--shadow);
    color: var(--text-primary);
    font-size: 1.3rem;
}

.sidebar-toggle:hover {
    background: var(--message-user-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.sidebar-toggle.hidden {
    opacity: 0;
    pointer-events: none;
}

/* New Chat Floating Button */
.new-chat-floating {
    position: fixed;
    left: 20px;
    top: calc(5vh + 60px);
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 999;
    box-shadow: var(--shadow);
    color: white;
    font-size: 1.3rem;
}

.new-chat-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.new-chat-floating.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Adjust chat container when sidebar is open */
#chatContainer {
    transition: margin-left 1.0s ease-in-out, width 1.0s ease-in-out;
    will-change: margin-left, width;
}

.sidebar.open ~ #chatContainer {
    margin-left: 410px;
    width: calc(95% - 410px);
    min-width: calc(95% - 410px);
}

/* Chat container temporary shift during sidebar animation */
@keyframes chatShiftRight {
  from { transform: translateX(0); }
  to   { transform: translateX(410px); }
}

@keyframes chatShiftLeft {
  from { transform: translateX(410px); }
  to   { transform: translateX(0); }
}

#chatContainer.animating-open {
  animation: chatShiftRight 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#chatContainer.animating-close {
  animation: chatShiftLeft 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Sidebar controls */
.sidebar-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-pin-sidebar,
.btn-collapse-sidebar {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.btn-pin-sidebar:hover,
.btn-collapse-sidebar:hover {
    background: var(--message-ai-bg);
    border-color: var(--theme-primary);
}

.btn-pin-sidebar.active {
    background: var(--message-user-bg);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

/* Dark mode sidebar adjustments */
[data-theme="dark"] .sidebar {
    background: rgba(25, 25, 25, 0.95);
    border-right-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .chat-item:hover {
    background: rgba(50, 50, 50, 0.8);
}

[data-theme="dark"] .sidebar-toggle {
    background: rgba(30, 30, 30, 0.95);
}