@import url('lib/tailwindcss/dist/preflight.css');

:root {
    --bg-gradient-start: rgb(225 227 233);
    --bg-gradient-end: #f4f4f4;
    --text-color: #000000;
    --text-muted: #666666;
    --border-color: #E5E7EB;
    --input-bg: #ffffff;
    --chat-container-bg: #F9FAFB;
    --btn-default-bg: #D1D5DB;
    --btn-default-hover: #E5E7EB;
    --btn-default-border: #9CA3AF;
    --btn-subtle-border: #D1D5DB;
    --btn-subtle-hover-border: #93C5FD;
    --btn-subtle-hover-bg: #DBEAFE;
    --error-color: #e50000;
    --success-color: #26b050;
    --spinner-border-color: #4152d5;
    --user-message-bg: rgb(182 215 232);
    --user-message-text: #1F2937;
    --assistant-icon-bg: #9b72ce;
    --assistant-message-bg: rgba(0, 0, 0, 0.03);
    --search-message-bg: rgba(0, 0, 0, 0.02);
    --table-alt-bg: rgba(0, 0, 0, 0.05);
    --code-bg: rgba(0, 0, 0, 0.05);
    --link-color: #3b82f6;
    --citation-bg: #ffffff;
    --citation-text: inherit;
    --citation-border: #a770de;
    --citation-hover-outline: #865cb1;
    --citation-active-bg: rgba(0,0,0,0.05);
    --citation-icon: currentColor;
}

:root.dark-mode {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #121212;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --border-color: #2d2d2d;
    --input-bg: #222222;
    --chat-container-bg: #181818;
    --btn-default-bg: #333333;
    --btn-default-hover: #444444;
    --btn-default-border: #555555;
    --btn-subtle-border: #444444;
    --btn-subtle-hover-border: #666666;
    --btn-subtle-hover-bg: #333333;
    --error-color: #ff5555;
    --success-color: #55ff55;
    --spinner-border-color: #7080ff;
    --user-message-bg: #2d5474;
    --user-message-text: #e5e7eb;
    --assistant-icon-bg: #7050a0;
    --assistant-message-bg: rgba(255, 255, 255, 0.05);
    --search-message-bg: rgba(255, 255, 255, 0.03);
    --table-alt-bg: rgba(255, 255, 255, 0.05);
    --code-bg: rgba(255, 255, 255, 0.1);
    --link-color: #60a5fa;
    --citation-bg: #2a2a3a;
    --citation-text: #ffffff;
    --citation-border: #8c5cbd;
    --citation-hover-outline: #a979e6;
    --citation-active-bg: rgba(255,255,255,0.1);
    --citation-icon: #d4d4d4;
}

/* Override Tailwind preflight resets for TTS buttons specifically */
.tts-toggle-button,
.tts-speak-button,
button.tts-toggle-button,
button.tts-speak-button {
    appearance: button !important;
    cursor: pointer !important;
    border-radius: 0.375rem !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    opacity: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.tts-toggle-button:hover,
.tts-speak-button:hover,
button.tts-toggle-button:hover,
button.tts-speak-button:hover {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05) !important;
}

.tts-toggle-button.enabled,
button.tts-toggle-button.enabled {
    background-color: rgba(34, 197, 94, 0.2) !important;
    border-color: rgba(34, 197, 94, 0.4) !important;
    color: #22c55e !important;
}

.tts-toggle-button.enabled:hover,
button.tts-toggle-button.enabled:hover {
    background-color: rgba(34, 197, 94, 0.3) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
}

/* Dark mode overrides for TTS buttons */
:root.dark-mode .tts-toggle-button,
:root.dark-mode .tts-speak-button,
:root.dark-mode button.tts-toggle-button,
:root.dark-mode button.tts-speak-button {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

:root.dark-mode .tts-toggle-button:hover,
:root.dark-mode .tts-speak-button:hover,
:root.dark-mode button.tts-toggle-button:hover,
:root.dark-mode button.tts-speak-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Ensure TTS button SVGs are properly styled */
.tts-toggle-button svg,
.tts-speak-button svg,
button.tts-toggle-button svg,
button.tts-speak-button svg {
    width: 1rem !important;
    height: 1rem !important;
    flex-shrink: 0 !important;
    display: block !important;
    pointer-events: none !important;
}

html {
    min-height: 100vh;
    color: var(--text-color);
}

html, .main-background-gradient {
    background: linear-gradient(to bottom, var(--bg-gradient-start), var(--bg-gradient-end) 25rem);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

    html::after {
        content: '';
        background-image: linear-gradient(to right, #3a4ed5, #3acfd5 15%, #d53abf 85%, red);
        width: 100%;
        height: 2px;
        position: fixed;
        top: 0;
    }

h1 {
    font-size: 2.25rem;
    line-height: 2.5rem;
    font-weight: 600;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success-color);
}

.invalid {
    outline: 1px solid var(--error-color);
}

.validation-message {
    color: var(--error-color);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.btn-default {
    display: flex;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    align-items: center;
    border-radius: 12px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    color: var(--text-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.btn-default::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s;
}

.btn-default:hover::before {
    left: 100%;
}

.btn-default:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-default svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    transition: transform 0.3s ease;
}

.btn-default:hover svg {
    transform: scale(1.1);
}

.btn-subtle {
    display: flex;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    align-items: center;
    border-radius: 20px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color);
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-subtle:hover {
    border-color: rgba(59, 130, 246, 0.6);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
}

:root.dark-mode .btn-subtle {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(139, 92, 246, 0.3);
}

:root.dark-mode .btn-subtle:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border-color: rgba(139, 92, 246, 0.5);
}

.page-width {
    max-width: 1024px;
    margin: auto;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .chat-header-controls {
        flex-direction: column;
        gap: 0.5rem;
        padding-top: 0.75rem;
    }
    
    .assistant-message {
        grid-template-columns: 1.5rem minmax(0, 1fr);
        gap: 0.125rem;
    }
    
    .user-message {
        max-width: calc(100% - 2rem);
        padding: 0.375rem 1rem;
        font-size: 0.875rem;
    }
    
    .assistant-message-text {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .page-width {
        margin: 0 1rem;
        max-width: calc(100% - 2rem);
    }
    
    h1 {
        font-size: 1.75rem;
        line-height: 2rem;
    }
    
    .btn-default, .btn-subtle {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    .message-list-container {
        margin: 1rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .chat-header-controls {
        align-items: stretch;
    }
    
    .chat-header-controls button {
        justify-content: center;
        min-height: 2.5rem;
    }
    
    .user-message {
        max-width: calc(100% - 1rem);
        padding: 0.25rem 0.75rem;
    }
    
    .assistant-message-text {
        padding: 0.375rem;
    }
    
    .page-width {
        margin: 0 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* Accessibility and Keyboard Navigation */
.btn-default:focus,
.btn-subtle:focus,
button:focus {
    outline: 2px solid var(--spinner-border-color);
    outline-offset: 2px;
}

.btn-default:focus-visible,
.btn-subtle:focus-visible,
button:focus-visible {
    outline: 2px solid var(--spinner-border-color);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--spinner-border-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --btn-default-border: #000000;
        --btn-subtle-border: #000000;
    }
    
    :root.dark-mode {
        --border-color: #ffffff;
        --btn-default-border: #ffffff;
        --btn-subtle-border: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =======================
   LANDING PAGE STYLES - UPDATED TO MATCH LOGIN DESIGN
   ======================= */

.landing-page-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at top, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
                radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

.landing-content {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 4rem;
    align-items: center;
    z-index: 2;
}

.hero-section {
    text-align: left;
}

.hero-icon {
    width: 48px !important;
    height: 48px !important;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: float 6s ease-in-out infinite;
}

.hero-icon svg {
    width: 24px !important;
    height: 24px !important;
    color: white;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-color), rgba(59, 130, 246, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-weight: 300;
}

.hero-features {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.feature-item svg {
    width: 24px;
    height: 24px;
    color: #3b82f6;
    flex-shrink: 0;
}

.feature-item span {
    color: var(--text-color);
    font-weight: 500;
}

.auth-card {
    background: var(--input-bg);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    animation: slideInRight 0.8s ease-out;
}

.auth-card-content {
    text-align: center;
}

.auth-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.auth-header p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.btn-signin {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-signin::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-signin:hover::before {
    left: 100%;
}

.btn-signin:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -5px rgba(59, 130, 246, 0.5);
}

.btn-signin svg {
    width: 20px;
    height: 20px;
}

.btn-signin .arrow-icon {
    transition: transform 0.3s ease;
}

.btn-signin:hover .arrow-icon {
    transform: translateX(4px);
}

.auth-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-note svg {
    width: 16px;
    height: 16px;
}

.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-element {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: floatAround 20s linear infinite;
}

.floating-element.element-1 {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-element.element-2 {
    top: 60%;
    right: 15%;
    animation-delay: -5s;
}

.floating-element.element-3 {
    bottom: 30%;
    left: 20%;
    animation-delay: -10s;
}

.floating-element.element-4 {
    top: 40%;
    right: 30%;
    animation-delay: -15s;
}

/* =======================
   LOGIN PAGE STYLES
   ======================= */

.login-page-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.login-content {
    max-width: 480px;
    width: 100%;
    z-index: 2;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 48px !important;
    height: 48px !important;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: float 6s ease-in-out infinite;
}

.login-logo svg {
    width: 24px !important;
    height: 24px !important;
    color: white;
}

.login-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 300;
}

.login-card {
    background: var(--input-bg);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
}

.success-message {
    text-align: center;
    padding: 2rem 0;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981, #22c55e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: bounceIn 0.6s ease-out;
}

.success-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.success-message h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 0.5rem;
}

.success-message p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.error-message,
.warning-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.warning-message {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #d97706;
}

.error-message svg,
.warning-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.login-form {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    z-index: 1;
}

.form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:focus + .form-label {
    color: #3b82f6;
}

.form-label {
    position: absolute;
    left: 3rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    transition: all 0.3s ease;
    background: var(--input-bg);
    padding: 0 0.5rem;
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
    top: 0;
    left: 2.5rem;
    font-size: 0.8rem;
    color: #3b82f6;
    transform: translateY(-50%);
}

.form-options {
    margin-bottom: 2rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    display: none !important;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    background-color: var(--input-bg);
    flex-shrink: 0;
}

.checkbox-custom:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.checkbox-input:checked ~ .checkbox-custom {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.checkbox-input:checked ~ .checkbox-custom::after {
    content: '✓' !important;
    color: white !important;
    font-size: 0.9rem !important;
    font-weight: bold !important;
    line-height: 1 !important;
    display: block !important;
}

/* Dark mode support */
:root.dark-mode .checkbox-custom {
    border-color: var(--border-color);
    background-color: var(--input-bg);
}

:root.dark-mode .checkbox-input:checked ~ .checkbox-custom {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

.checkbox-label {
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.4;
}

.btn-signin-form {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.btn-signin-form:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-signin-form:not(:disabled)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-signin-form:not(:disabled):hover::before {
    left: 100%;
}

.btn-signin-form:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -5px rgba(59, 130, 246, 0.5);
}

.btn-signin-form svg {
    width: 20px;
    height: 20px;
}

.btn-signin-form .arrow-icon {
    transition: transform 0.3s ease;
}

.btn-signin-form:not(:disabled):hover .arrow-icon {
    transform: translateX(4px);
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-footer {
    text-align: center;
}

.forgot-password {
    margin-bottom: 1rem;
}

.forgot-password a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password a:hover {
    color: #2563eb;
}

.register-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.register-note svg {
    width: 16px;
    height: 16px;
}

.login-bg-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bg-element {
    position: absolute;
    font-size: 3rem;
    opacity: 0.05;
    animation: floatAround 25s linear infinite;
}

.bg-element.element-1 {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.bg-element.element-2 {
    bottom: 20%;
    right: 15%;
    animation-delay: -8s;
}

.bg-element.element-3 {
    top: 70%;
    left: 20%;
    animation-delay: -16s;
}

.loading-spinner,
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =======================
   ANIMATIONS
   ======================= */

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes floatAround {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -20px) rotate(90deg); }
    50% { transform: translate(-10px, -30px) rotate(180deg); }
    75% { transform: translate(-30px, 10px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =======================
   RESPONSIVE DESIGN
   ======================= */

@media (max-width: 1024px) {
    .landing-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .hero-section {
        text-align: center;
    }
    
    .hero-title {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .landing-page-container,
    .login-page-container {
        padding: 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .auth-card,
    .login-card {
        padding: 2rem;
    }
    
    .feature-item {
        padding: 0.75rem;
    }
    
    .feature-item span {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .login-title {
        font-size: 2rem;
    }
    
    .auth-card,
    .login-card {
        padding: 1.5rem;
    }
    
    .hero-features {
        gap: 1rem;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* Force icon sizing - additional specificity */
.landing-page-container .hero-icon {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
}

.landing-page-container .hero-icon svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

.login-page-container .login-logo {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
}

.login-page-container .login-logo svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

/* =======================
   MODERN CHAT INTERFACE STYLES (ENHANCED)
   ======================= */

/* Chat page layout */
.chat-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--chat-container-bg);
}

/* Enhanced chat header */
.simple-header,
.chat-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-bottom: 2px solid rgba(59, 130, 246, 0.2);
    padding: 1.5rem 2rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.simple-header h3,
.chat-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
}

.simple-header p,
.chat-header p {
    color: var(--text-muted);
    margin: 0.25rem 0;
    font-weight: 500;
}

/* Chat container */
.simple-chat,
.chat-container {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Messages container */
.messages,
.message-list-container {
    background: var(--input-bg);
    border-radius: 20px;
    border: 2px solid rgba(59, 130, 246, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
    min-height: 500px;
    max-height: 600px;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}

/* Message items */
.message {
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.4s ease-out;
}

.message.user,
.user-message {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.message.user > div,
.user-message-content {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 20px 20px 4px 20px;
    max-width: 70%;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.message.user > div::before,
.user-message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.message.assistant,
.assistant-message {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.assistant-message-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.assistant-message-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: white;
}

.message.assistant > div,
.assistant-message-text {
    background: var(--assistant-message-bg);
    border: 2px solid rgba(139, 92, 246, 0.1);
    border-radius: 4px 20px 20px 20px;
    padding: 1.5rem;
    flex: 1;
    color: var(--text-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    line-height: 1.6;
}

/* Enhanced text formatting for assistant messages */
.assistant-message-text p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.assistant-message-text ol, .assistant-message-text ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.assistant-message-text ol li, .assistant-message-text ul li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.assistant-message-text ol li strong, .assistant-message-text ul li strong {
    color: #6366f1;
    font-weight: 600;
}

.assistant-message-text h1, .assistant-message-text h2, .assistant-message-text h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
}

.assistant-message-text h1 {
    font-size: 1.25rem;
    border-bottom: 2px solid rgba(139, 92, 246, 0.2);
    padding-bottom: 0.5rem;
}

.assistant-message-text h2 {
    font-size: 1.125rem;
}

.assistant-message-text h3 {
    font-size: 1rem;
}

.assistant-message-text strong {
    font-weight: 600;
    color: #6366f1;
}

/* Dark mode text formatting */
:root.dark-mode .assistant-message-text strong {
    color: #8b5cf6;
}

:root.dark-mode .assistant-message-text ol li strong, 
:root.dark-mode .assistant-message-text ul li strong {
    color: #8b5cf6;
}

/* Input area */
.input-area,
.chat-input-container {
    background: var(--input-bg);
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    padding: 1rem;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.input-area:focus-within,
.chat-input-container:focus-within {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.input-area input,
.input-area textarea,
.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 1rem;
    font-size: 1rem;
    color: var(--text-color);
    resize: none;
    font-family: inherit;
    min-height: 24px;
    max-height: 120px;
}

.input-area input::placeholder,
.input-area textarea::placeholder,
.chat-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.input-area button,
.send-button {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    flex-shrink: 0;
}

.input-area button:hover:not(:disabled),
.send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.input-area button:disabled,
.send-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-area button svg,
.send-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Alert styling */
.alert {
    padding: 1.5rem;
    margin: 1rem 2rem;
    border-radius: 16px;
    border: 2px solid;
    backdrop-filter: blur(8px);
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.05));
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--text-color);
}

.alert h4 {
    margin: 0 0 1rem 0;
    font-weight: 700;
    color: #3b82f6;
}

.alert pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 8px;
    margin: 0;
    white-space: pre-wrap;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Enhanced buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    color: white;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563, #6b7280);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.5);
    color: white;
}

/* ===================================
   MOBILE DASHBOARD SELECTOR FIX - Global Override
   =================================== */

@media (max-width: 768px) {
    /* Improved Mobile Layout */
    .chat-header-container {
        padding: 1rem !important;
    }
    
    .chat-header-controls {
        gap: 0.75rem !important;
        padding: 1rem 0 !important;
    }
    
    /* Enhanced Mobile Header Section - Three Column Layout */
    .mobile-header-section {
        display: grid !important;
        grid-template-columns: 48px 1fr 48px !important;
        align-items: center !important;
        gap: 0.5rem !important;
        flex: 1 !important;
        min-width: 0 !important;
        width: 100% !important;
    }
    
    /* Improved Burger Menu Button - Far Left Position */
    .mobile-header-section .burger-menu-button,
    .burger-menu-button {
        grid-column: 1 !important;
        flex-shrink: 0 !important;
        padding: 0.75rem !important;
        min-width: 48px !important;
        min-height: 48px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 12px !important;
        transition: all 0.15s ease !important; /* Faster response */
        touch-action: manipulation !important; /* Better touch response */
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        justify-self: start !important;
    }
    
    .mobile-header-section .burger-menu-button:active,
    .burger-menu-button:active {
        transform: scale(0.95) !important;
        background: rgba(255, 255, 255, 0.25) !important;
        border-color: rgba(255, 255, 255, 0.4) !important;
    }
    
    .mobile-header-section .burger-menu-button:hover,
    .burger-menu-button:hover {
        background: rgba(255, 255, 255, 0.2) !important;
        border-color: rgba(255, 255, 255, 0.4) !important;
        transform: translateY(-1px) !important;
    }
    
    /* Enhanced Dashboard Selector - Centered in Middle Column */
    .mobile-dashboard-section {
        grid-column: 2 !important;
        justify-self: center !important;
        width: 100% !important;
        max-width: 280px !important;
    }
    
    .mobile-dashboard-section .knowledge-base-selector-container,
    .mobile-dashboard-section [class*="knowledge-base-selector-container"] {
        margin-bottom: 0 !important;
        width: 100% !important;
        max-width: 280px !important; /* Limit max width for better centering */
    }
    
    .mobile-dashboard-section .knowledge-base-selector,
    .mobile-dashboard-section [class*="knowledge-base-selector"]:not([class*="container"]):not([class*="controls"]) {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem 1rem !important; /* Bigger padding */
        gap: 0.5rem !important;
        flex: 1 !important;
        overflow: hidden !important;
        background-color: rgba(255, 255, 255, 0.15) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 12px !important; /* More rounded */
        min-height: 48px !important; /* Touch-friendly height */
        transition: all 0.2s ease !important;
        cursor: pointer !important;
    }
    
    .mobile-dashboard-section .knowledge-base-selector:hover,
    .mobile-dashboard-section [class*="knowledge-base-selector"]:not([class*="container"]):not([class*="controls"]):hover {
        background-color: rgba(255, 255, 255, 0.2) !important;
        border-color: rgba(255, 255, 255, 0.4) !important;
        transform: translateY(-1px) !important;
    }
    
    .mobile-dashboard-section .knowledge-base-label,
    .mobile-dashboard-section [class*="knowledge-base-label"] {
        display: none !important; /* Hide label completely on mobile */
    }
    
    .mobile-dashboard-section .knowledge-base-select,
    .mobile-dashboard-section [class*="knowledge-base-select"] {
        font-size: 0.875rem !important; /* Bigger font */
        font-weight: 500 !important;
        min-width: 0 !important;
        flex: 1 !important;
        background: transparent !important;
        border: none !important;
        color: white !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        padding: 0.25rem 0 !important;
        outline: none !important;
        cursor: pointer !important;
    }
    
    .mobile-dashboard-section .knowledge-base-info,
    .mobile-dashboard-section [class*="knowledge-base-info"] {
        display: none !important; /* Hide collection count on mobile */
    }
    
    .mobile-dashboard-section .refresh-button,
    .mobile-dashboard-section [class*="refresh"] {
        display: none !important; /* Hide refresh button on mobile */
    }
    
    .mobile-dashboard-section .knowledge-base-selector-controls,
    .mobile-dashboard-section [class*="knowledge-base-selector-controls"] {
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        gap: 0.5rem !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .mobile-dashboard-section .knowledge-base-icon,
    .mobile-dashboard-section [class*="knowledge-base-icon"] {
        width: 16px !important; /* Slightly bigger icon */
        height: 16px !important;
        color: rgba(255, 255, 255, 0.8) !important;
        flex-shrink: 0 !important;
    }
}

/* Extra small screens - even more optimized */
@media (max-width: 480px) {
    .chat-header-container {
        padding: 0.75rem !important;
    }
    
    .mobile-header-section {
        grid-template-columns: 44px 1fr 44px !important;
        gap: 0.25rem !important;
    }
    
    .mobile-dashboard-section {
        max-width: 240px !important; /* Smaller max width for small screens */
    }
    
    .mobile-dashboard-section .knowledge-base-selector-container,
    .mobile-dashboard-section [class*="knowledge-base-selector-container"] {
        max-width: 240px !important; /* Smaller max width for small screens */
    }
    
    .mobile-dashboard-section .knowledge-base-selector,
    .mobile-dashboard-section [class*="knowledge-base-selector"]:not([class*="container"]):not([class*="controls"]) {
        padding: 0.625rem 0.75rem !important;
        min-height: 44px !important;
    }
    
    .mobile-dashboard-section .knowledge-base-select,
    .mobile-dashboard-section [class*="knowledge-base-select"] {
        font-size: 0.8125rem !important;
    }
    
    .mobile-header-section .burger-menu-button,
    .burger-menu-button {
        padding: 0.625rem !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
}
