/* Modern Color Palette & CSS Variables */
:root {
    /* Primary Colors */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-dark: #4338ca;

    /* Secondary Colors */
    --secondary-color: #06b6d4;
    --secondary-hover: #0891b2;

    /* Accent Colors */
    --accent-color: #a855f7;
    --accent-hover: #9333ea;

    /* Background Colors */
    --bg-light: #f8fafc;
    --bg-light-secondary: #f1f5f9;
    --bg-light-tertiary: #e2e8f0;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Chat Bubbles */
    --chat-user-bg-start: #667eea;
    --chat-user-bg-end: #764ba2;
    --chat-agent-bg-start: #f8fafc;
    --chat-agent-bg-end: #e2e8f0;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/* Base Styles */
body {
    padding-top: 95px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-light);
}

html {
    scroll-behavior: smooth;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Fixed Header Bar */
div.fixed-div {
    top: 60px;
    position: fixed;
    height: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--bg-light-tertiary);
    box-shadow: var(--shadow-sm);
    padding: 12px 0;
    z-index: 100;
}

div.fixed-div strong {
    color: var(--text-secondary);
    font-weight: 600;
}

div.fixed-div a {
    color: var(--primary-color);
    transition: all 0.2s ease;
    text-decoration: none;
}

div.fixed-div a:hover {
    color: var(--primary-hover);
}

/* Chat Bubbles */
div.query {
    background: linear-gradient(135deg, var(--chat-user-bg-start) 0%, var(--chat-user-bg-end) 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    margin-top: 25px;
    padding: 16px 20px;
    margin-left: 25%;
    width: 75%;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}

div.query:hover {
    transform: translateX(-2px);
}

div.query p {
    margin: 0;
    color: white;
}

div.response {
    background: linear-gradient(135deg, var(--chat-agent-bg-start) 0%, var(--chat-agent-bg-end) 100%);
    border: 1px solid #cbd5e1;
    border-radius: 18px 18px 18px 4px;
    margin-top: 25px;
    padding: 16px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

div.response:hover {
    box-shadow: var(--shadow-md);
    border-color: #94a3b8;
}

div.response p {
    margin: 0;
}

/* Chat Input Box */
div.chat-box {
    background: white;
    border-radius: 24px;
    margin-top: 25px;
    padding: 20px;
    margin-left: 25%;
    width: 75%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--bg-light-tertiary);
    transition: all 0.3s ease;
}

div.chat-box:focus-within {
    box-shadow: 0 20px 25px -5px rgba(102, 126, 234, 0.2);
    border-color: var(--primary-color);
}

div.chat-box input,
div.chat-box textarea {
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--text-primary);
}

div.chat-box input::placeholder,
div.chat-box textarea::placeholder {
    color: var(--text-muted);
}

/* Chat Pane */
div.chat-pane {
    top: 80px;
    background: var(--bg-light);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 var(--bg-light-secondary);
}

/* Custom scrollbar for webkit browsers */
div.chat-pane::-webkit-scrollbar {
    width: 8px;
}

div.chat-pane::-webkit-scrollbar-track {
    background: var(--bg-light-secondary);
    border-radius: 10px;
}

div.chat-pane::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

div.chat-pane::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Session Modal */
div.session-modal {
    position: absolute;
    top: 50px;
}

/* HTMX Loading Indicators */
.htmx-indicator {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
    visibility: visible;
}

.htmx-indicator::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--bg-light-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Bootstrap Overrides */

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar .nav-link:hover {
    color: #fff !important;
    transform: translateY(-1px);
}

.navbar .dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
    margin-top: 8px;
}

.navbar .dropdown-item {
    padding: 10px 20px;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 8px;
}

.navbar .dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* Fix for right-aligned dropdown overflow */
.navbar-nav.ml-auto .dropdown-menu {
    right: 0;
    left: auto;
}

.dropdown-menu-right,
.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--accent-hover) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-secondary {
    background: var(--bg-light-tertiary);
    color: var(--text-secondary);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 24px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #cbd5e1;
    color: var(--text-primary);
    transform: translateY(-1px);
    border-color: #94a3b8;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 14px;
    border-radius: 10px;
}

/* Modals */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    padding: 24px 30px;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: white;
}

.modal-header .close,
.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    color: white;
    text-shadow: none;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 30px;
    background: var(--bg-light);
}

.modal-body ul {
    list-style: none;
    padding-left: 0;
}

.modal-body ul li {
    margin-bottom: 8px;
}

.modal-body ul li a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 8px;
    display: inline-block;
}

.modal-body ul li a:hover {
    background: #ede9fe;
    color: var(--primary-hover);
    transform: translateX(4px);
}

/* Cards & Containers */
.container {
    max-width: 1200px;
}

/* Links */
a {
    color: var(--primary-color);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Responsive adjustments */
@media (max-width: 768px) {

    div.query,
    div.chat-box {
        margin-left: 0;
        width: 100%;
    }

    div.response {
        width: 100%;
    }
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
}