/* Global Vars & Reset */
:root {
    --bg-gradient: radial-gradient(circle at 50% -20%, #4c1d95 0%, #1e1b4b 50%, #0f172a 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --text-main: #ffffff;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.4;
    animation: pulse 10s infinite alternate;
}

.blob-1 {
    top: 20%;
    left: 20%;
    width: 400px;
    height: 400px;
    background: #8b5cf6;
}

.blob-2 {
    bottom: 20%;
    right: 20%;
    width: 500px;
    height: 500px;
    background: #3b82f6;
    animation-delay: 2s;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1.1);
    }
}

@keyframes float {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Layout Utilities */
.view {
    display: none;
    height: 100vh;
    flex-direction: column;
}

.view.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* Connect View Styles */
#connect-view {
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 100vh;
    height: auto;
}

.logo-container {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-title {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(to right, #93c5fd, #c4b5fd, #f9a8d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    line-height: 1.2;
}

@media (max-width: 768px) {
    .logo-title {
        font-size: 2.5rem;
    }
    
    .logo-subtitle {
        font-size: 1rem;
    }
    
    .glass-panel {
        padding: 1.5rem;
    }
}

.logo-subtitle {
    color: #bfdbfe;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.card-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.input-wrapper {
    position: relative;
}

.glass-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
    outline: none;
}

.glass-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(59, 130, 246, 0.5);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(16, 185, 129, 0.5);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    padding: 0 1rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.02);
}

.upload-zone:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.upload-content .icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.file-name {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Chat View Styles */
.glass-header {
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-logo {
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.glass-input-sm {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.85rem;
    width: 200px;
    outline: none;
}

.btn-sm {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: rgba(239, 68, 68, 0.2);
    color: white;
}

#chat-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.bubble {
    max-width: 80%;
    padding: 1.2rem;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.user .bubble {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 2px;
}

.assistant .bubble {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: #e2e8f0;
    border-bottom-left-radius: 2px;
}

.sql-block {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #93c5fd;
    overflow-x: auto;
}

.sql-label {
    font-weight: 700;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
}

.glass-footer {
    padding: 1.5rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
}

.input-area {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 16px;
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    resize: none;
    padding: 8px;
    font-size: 1rem;
    max-height: 100px;
}

.btn-icon {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.05);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-send {
    width: 20px;
    height: 20px;
    color: white;
}

/* Table Styles - Simplified */
.table-wrapper {
    margin-top: 1rem;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 16px;
    text-align: left;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td {
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
    color: #e2e8f0;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.message-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}

.message-box.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.message-box.success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}