:root {
    --bg-primary: #F3F6F9;
    --bg-sidebar: #0F172A;
    --sidebar-text: #94a3b8;
    --sidebar-active: #22D3EE;
    --card-bg: #ffffff;
    --accent-blue: #22D3EE;
    --accent-teal: #0F766E;
    --primary-deep-blue: #0A1F44;
    --text-primary: #1E293B;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
}

p {
    margin: 0;
}

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

button {
    font-family: inherit;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 4px 0 24px -8px rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.sidebar-logo svg {
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.5));
    transition: all 0.3s;
}

.sidebar-logo:hover svg {
    filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.8));
    transform: rotate(5deg) scale(1.05);
}

.nav-item {
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    margin-bottom: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
    transition: height 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(15, 118, 110, 0.15));
    color: var(--accent-blue);
}

.nav-item.active::before {
    height: 24px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Cards & Containers */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(34, 211, 238, 0.3);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

.card-body {
    padding: 24px;
}

/* Chat UI */
.chat-window {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.9375rem;
    line-height: 1.6;
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
    animation: messageSlideIn 0.3s ease-out;
}

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

.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #0A1F44 0%, #0F766E 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-assistant {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.08);
}

/* Inputs & Buttons */
.input-group {
    display: flex;
    gap: 12px;
}

.text-input {
    flex: 1;
    padding: 14px 18px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
    background: white;
    color: var(--text-primary);
}

.text-input::placeholder {
    color: #94a3b8;
}

.text-input:focus {
    border-color: #22D3EE;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #0A1F44 0%, #0F766E 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px -4px rgba(10, 31, 68, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(10, 31, 68, 0.5);
}

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

.btn-primary:disabled {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom th {
    background: linear-gradient(180deg, #F3F6F9 0%, #e8eef3 100%);
    text-align: left;
    padding: 14px 16px;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--primary-deep-blue);
    border-bottom: 2px solid rgba(34, 211, 238, 0.3);
    border-top: 1px solid var(--border-color);
}

.table-custom th:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 8px;
}

.table-custom th:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 8px;
}

.table-custom td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
    transition: background-color 0.2s;
}

.table-custom td:first-child {
    border-left: 1px solid var(--border-color);
}

.table-custom td:last-child {
    border-right: 1px solid var(--border-color);
}

.table-custom tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.table-custom tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

.table-custom tbody tr:hover td {
    background: linear-gradient(135deg, rgba(10, 31, 68, 0.03), rgba(15, 118, 110, 0.03));;
}

/* Floating Chat Widget */
.floating-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-popup {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 50px -12px rgba(10, 31, 68, 0.25), 0 8px 16px -8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(34, 211, 238, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-popup-header {
    background: linear-gradient(135deg, #0A1F44 0%, #0F766E 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.chat-popup-header::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;
}

.chat-popup-header:hover::before {
    left: 100%;
}

.chat-popup-body {
    height: 400px;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.chat-popup-window {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 4px;
}

.chat-popup-window::-webkit-scrollbar {
    width: 6px;
}

.chat-popup-window::-webkit-scrollbar-track {
    background: transparent;
}

.chat-popup-window::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0A1F44, #0F766E);
    border-radius: 3px;
}

.chat-popup-window::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0F766E, #22D3EE);
}

.chat-toggle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0A1F44 0%, #0F766E 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px -8px rgba(10, 31, 68, 0.4), 0 4px 8px -4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    align-self: flex-end;
    margin-top: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chat-toggle-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #22D3EE, #0F766E);
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-toggle-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px -8px rgba(10, 31, 68, 0.5), 0 6px 12px -4px rgba(0, 0, 0, 0.15);
}

.chat-toggle-btn:hover::before {
    opacity: 1;
}

.chat-toggle-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.chat-toggle-btn svg {
    position: relative;
    z-index: 1;
}

/* Results Content Area */
.results-main {
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.results-placeholder {
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border: 2px dashed rgba(34, 211, 238, 0.3);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(10, 31, 68, 0.02), rgba(15, 118, 110, 0.02));
    position: relative;
    overflow: hidden;
}

.results-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.05) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.results-placeholder > * {
    position: relative;
    z-index: 1;
}

/* SQL Code Block */
.sql-block {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    border: 2px solid rgba(34, 211, 238, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    box-shadow: 0 4px 12px -4px rgba(10, 31, 68, 0.3);
}

.sql-block code {
    color: #22D3EE;
    display: block;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.sql-block::-webkit-scrollbar {
    height: 8px;
}

.sql-block::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.sql-block::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #0A1F44, #0F766E);
    border-radius: 4px;
}

.sql-block::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #0F766E, #22D3EE);
}

/* Fade-in Animation */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

/* Utility Classes */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.text-secondary { color: var(--text-secondary); }
.border { border: 1px solid var(--border-color); }
.rounded { border-radius: 8px; }
.table-responsive { overflow-x: auto; }

/* Enhanced Scrollbars for Main Content */
.main-content::-webkit-scrollbar {
    width: 10px;
}

.main-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0A1F44, #0F766E);
    border-radius: 5px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0F766E, #22D3EE);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(34, 211, 238, 0.2);
    border-top: 4px solid #22D3EE;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 2px solid #22D3EE;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid #22D3EE;
    outline-offset: 3px;
}

