@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #0a0b10;
    --bg-surface: rgba(20, 22, 33, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Dashboard Container */
.dashboard {
    display: flex;
    width: 100%;
    height: 100vh;
    backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: rgba(10, 11, 16, 0.6);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--gradient-accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.suggestions-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
}

.suggestion-btn {
    width: 100%;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    text-align: left;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

/* Chat Main Area */
.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    margin: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
}

.chat-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bot-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bot-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.bot-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

/* Chat Messages */
.chat-messages {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: fadeIn 0.4s ease-out forwards;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.user .avatar {
    background: var(--gradient-accent);
    color: white;
}

.bot .avatar {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-purple);
    border: 1px solid var(--border-color);
}

.bubble {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.user .bubble {
    background: var(--gradient-accent);
    color: white;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.bot .bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Accordion SQL/Data details */
.sql-details {
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.sql-details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
    outline: none;
    transition: background 0.2s;
}

.sql-details summary:hover {
    background: rgba(255, 255, 255, 0.02);
}

.sql-details-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sql-code {
    font-family: var(--font-mono);
    background: rgba(10, 11, 16, 0.8);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #38bdf8;
    overflow-x: auto;
    white-space: pre-wrap;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Table results design */
.table-wrapper {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    max-height: 250px;
    overflow-y: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.results-table th {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.results-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.results-table tr:hover td {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.01);
}

/* Loading skeleton styling */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* Input Panel */
.chat-input-panel {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.input-wrapper {
    position: relative;
    flex-grow: 1;
}

.chat-input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: rgba(10, 11, 16, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.chat-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
    background: rgba(10, 11, 16, 0.8);
}

.send-btn {
    padding: 1.25rem 1.75rem;
    background: var(--gradient-accent);
    border: none;
    border-radius: 16px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .chat-container {
        margin: 0;
        border-radius: 0;
        border: none;
    }
}
