/* ================================================================
   VERITAS ASSISTANT - APPLE INTELLIGENCE INSPIRED DESIGN
   Featuring: Glowing cognitive states, provenance cards, SQL terminal,
   and smooth, hardware-accelerated animations
   ================================================================ */

/* ================================================================
   MAIN CONTAINER
   ================================================================ */
.chat-container {
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 250px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================================
   APPLE INTELLIGENCE GLOWING STATE (Pulsing Cognitive Border)
   Activated when the AI is actively thinking/processing
   ================================================================ */
.chat-container.thinking {
    animation: cognitiveGlow 2.5s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3),
                0 0 0 6px rgba(118, 75, 162, 0.2),
                0 0 20px rgba(240, 147, 251, 0.15);
}

@keyframes cognitiveGlow {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4),
                    0 0 0 6px rgba(118, 75, 162, 0.25),
                    0 0 25px rgba(240, 147, 251, 0.2);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.6),
                    0 0 0 8px rgba(118, 75, 162, 0.4),
                    0 0 35px rgba(240, 147, 251, 0.3);
    }
}

/* Glowing gradient border sweep */
.chat-container.thinking::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        60deg,
        #667eea,
        #764ba2,
        #f093fb,
        #667eea
    );
    background-size: 300% 300%;
    border-radius: 16px;
    z-index: -1;
    opacity: 0.6;
    animation: gradientSweep 4s ease-in-out infinite;
    will-change: background-position;
}

@keyframes gradientSweep {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ================================================================
   MESSAGES AREA
   ================================================================ */
.messages-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.messages-area::-webkit-scrollbar {
    width: 8px;
}

.messages-area::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.2s;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ================================================================
   SUGGESTIVE PROMPT CARDS (Empty State)
   Beautiful, clickable prompt suggestions when chat is empty
   ================================================================ */
.suggestive-prompts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.suggestive-prompt-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 25px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.suggestive-prompt-card::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;
}

.suggestive-prompt-card:hover::before {
    left: 100%;
}

.suggestive-prompt-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}

.suggestive-prompt-card:active {
    transform: translateY(-1px) scale(1.0);
}

.prompt-card-icon {
    font-size: 24px;
    margin-right: 12px;
    display: inline-block;
}

.prompt-card-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

/* ================================================================
   PROVENANCE CARDS (Smart Ingestion References)
   Clickable inline cards showing rule/file references
   ================================================================ */
.provenance-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 4px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1.5px solid #3b82f6;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.provenance-card:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.provenance-card.rule-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    color: #92400e;
}

.provenance-card.rule-card:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    border-color: #d97706;
}

.provenance-card-icon {
    font-size: 16px;
}

/* ================================================================
   XCODE-STYLE SQL TERMINAL (In-Bubble Code Console)
   Dark, professional, read-only terminal for SQL display
   ================================================================ */
.sql-terminal-container {
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    border: 1px solid #334155;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sql-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

.sql-terminal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

.sql-terminal-copy-btn {
    padding: 5px 12px;
    background: #334155;
    color: #e2e8f0;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sql-terminal-copy-btn:hover {
    background: #475569;
}

.sql-terminal-copy-btn.copied {
    background: #10b981;
    color: white;
}

.sql-terminal-code {
    padding: 15px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.sql-terminal-code::-webkit-scrollbar {
    height: 6px;
}

.sql-terminal-code::-webkit-scrollbar-track {
    background: #0f172a;
}

.sql-terminal-code::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

/* SQL syntax highlighting (basic) */
.sql-keyword {
    color: #c084fc;
    font-weight: 600;
}

.sql-string {
    color: #34d399;
}

.sql-number {
    color: #fbbf24;
}

/* ================================================================
   EXPORT BUTTON DROPDOWN
   Unified export manager with 4 format options
   ================================================================ */
.export-dropdown-container {
    position: relative;
    display: inline-block;
}

.export-trigger-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

.export-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-dropdown-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.export-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.export-option:last-child {
    border-bottom: none;
}

.export-option:hover {
    background: #f8fafc;
}

.export-option-icon {
    font-size: 18px;
}

.export-option-text {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

/* ================================================================
   CHAT INPUT AREA
   ================================================================ */
.chat-input-area {
    display: flex;
    gap: 15px;
    padding: 20px;
    border-top: 2px solid #e5e7eb;
    background: white;
    position: relative;
}

.chat-input-area.thinking {
    pointer-events: none;
    opacity: 0.7;
}

#chat-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

#chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#chat-input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

#send-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

#send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

#send-btn:active:not(:disabled) {
    transform: translateY(0);
}

#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ================================================================
   TYPING INDICATOR (Enhanced)
   ================================================================ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    margin-bottom: 15px;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 180px);
        border-radius: 12px;
    }

    .messages-area {
        padding: 20px;
    }

    .suggestive-prompts-container {
        padding: 20px;
    }

    .chat-input-area {
        padding: 15px;
        gap: 10px;
    }

    #chat-input {
        font-size: 14px;
        padding: 12px 16px;
    }

    #send-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ================================================================
   HARDWARE ACCELERATION
   Ensures smooth animations on all devices
   ================================================================ */
.chat-container,
.chat-container.thinking,
.suggestive-prompt-card,
.provenance-card,
.export-trigger-btn,
#send-btn {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}
