/* Premium Chat UI Styles - Dark Elegant Theme */

:root {
    --primary: #d4af37;
    --primary-dark: #aa8c2a;
    --primary-light: #e5c158;
    --accent: #1f2937;
    --accent-light: #374151;
    --bg: #0a0e27;
    --bg-light: #111827;
    --bg-lighter: #1f2937;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #1f2937;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

/* Chat Messages */
.message {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    animation: slideIn 0.3s ease-out;
    max-width: 90%;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #d4af37 0%, #aa8c2a 100%);
    margin-left: auto;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 8px 16px rgba(212, 175, 55, 0.2);
    color: #0a0e27;
}

.message.assistant {
    align-self: flex-start;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.05);
}

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

.message-content {
    line-height: 1.6;
    word-wrap: break-word;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Typing Effect */
.typing-indicator {
    display: flex;
    gap: 4px;
}

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

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Results Table */
.results-table {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow-x: auto;
    margin-top: 12px;
    font-size: 0.9em;
}

.results-table pre {
    margin: 0;
    padding: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #a1f3a2;
    font-family: 'Courier New', monospace;
}

/* SQL Display */
.sql-block {
    background: #0f172a;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    padding: 12px;
    margin-top: 8px;
    font-size: 0.85em;
}

.sql-block code {
    color: #e879f9;
    font-family: 'Courier New', monospace;
}

/* Input Focus */
#input-pergunta:focus {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    border-color: var(--primary) !important;
}

/* Button Animations */
#btn-enviar {
    position: relative;
    overflow: hidden;
}

#btn-enviar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s;
}

#btn-enviar:hover::before {
    left: 100%;
}

/* Scroll behavior */
#chat-container {
    scroll-behavior: smooth;
}

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

/* Dark mode (default) */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #f8fafc;
        --bg-light: #e2e8f0;
        --text: #0f172a;
        --text-muted: #64748b;
        --border: #cbd5e1;
    }
    
    .message.assistant {
        background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
        border: 1px solid #cbd5e1;
    }
    
    .skeleton {
        background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .message {
        max-width: 100%;
    }
    
    .message.user {
        margin-left: auto;
    }
}

/* Charts */
.chart-container {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1a1f35 0%, #0f172a 100%);
    border-radius: 12px;
    border: 1px solid #334155;
    margin-top: 8px;
}

.chart-container > * {
    width: 100% !important;
    height: auto !important;
}

/* Number Card */
.number-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    color: white;
}

.number-card-value {
    font-size: 48px;
    font-weight: bold;
    margin-top: 12px;
}

.number-card-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.export-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    background: #334155;
    color: #f1f5f9;
}

.export-btn:hover {
    background: #475569;
    transform: translateY(-2px);
}
