﻿/* ============== CHAT-BASED NL QUERY INTERFACE ============== */
.nl-query-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    padding: 0;
    background: var(--bg-primary);
}

.chat-header {
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: var(--text-primary);
}

.chat-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-primary);
}

.chat-message {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    max-width: 75%;
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-content p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.chip {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.chip:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.results-table-wrapper {
    margin-top: 16px;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.results-table th {
    background: var(--bg-secondary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

.results-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr:hover {
    background: var(--bg-secondary);
}

.column-note {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input-container textarea {
    flex: 1;
    padding: 14px 20px;
    border-radius: 28px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.btn-send {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102,126,234,0.5);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.typing-indicator .message-content {
    padding: 20px;
}

.typing-dots {
    display: flex;
    gap: 6px;
}

.typing-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-12px);
        opacity: 1;
    }
}

.chat-message.error .message-content {
    background: #ef4444;
    color: white;
}

.null-value {
    color: var(--text-tertiary);
    font-style: italic;
    opacity: 0.6;
}

/* Full Table Modal */
.full-table-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.btn-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 24px;
}

.full-table-wrapper {
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.full-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.full-table th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    z-index: 10;
}

.full-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.full-table tr:hover {
    background: var(--bg-secondary);
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-table-action {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-table-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}
