/* CSS variables for Premium Dark & Light Themes */
:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Theme Dark (Default) */
    --bg-base: #07070c;
    --bg-surface: rgba(15, 15, 27, 0.65);
    --bg-surface-hover: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(255, 255, 255, 0.18);
    
    /* Primary Accent Color (Vibrant Purple & Blue) */
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.25);
    --primary-hover: #7c3aed;
    --primary-text: #ffffff;
    
    --secondary: #3b82f6;
    --secondary-glow: rgba(59, 130, 246, 0.25);
    
    /* Semantic Colors */
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-title: #ffffff;
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.15);
    
    /* Shadows & Border Radius */
    --shadow-premium: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --card-radius: 20px;
    --element-radius: 12px;
    --glow-opacity: 0.25;
}

body.light-theme {
    --bg-base: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-surface-hover: rgba(0, 0, 0, 0.02);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-active: rgba(0, 0, 0, 0.15);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --primary-hover: #4f46e5;
    
    --text-main: #334155;
    --text-muted: #64748b;
    --text-title: #0f172a;
    
    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 8px 20px -6px rgba(0, 0, 0, 0.05);
    --glow-opacity: 0.06;
}

/* Reset and Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    overflow-x: hidden;
    padding: 2rem 1rem;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Glow Background Effects */
.glow-bg {
    position: fixed;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: var(--glow-opacity);
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.glow-1 {
    top: -200px;
    left: -200px;
    background: radial-gradient(circle, var(--primary) 0%, rgba(0,0,0,0) 70%);
}

.glow-2 {
    bottom: -200px;
    right: -200px;
    background: radial-gradient(circle, var(--secondary) 0%, rgba(0,0,0,0) 70%);
}

.container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 1;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.25rem;
}

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

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--element-radius);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.5px;
}

.logo-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Theme Toggle Button */
.btn-icon {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-icon:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-color-active);
    transform: scale(1.05);
}

.sun-icon { display: none; }
body.light-theme .sun-icon { display: block; }
body.light-theme .moon-icon { display: none; }

/* Dashboard Card */
.dashboard-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
    padding: 0 1rem;
    gap: 0.5rem;
    position: relative;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 1.25rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-title);
}

.tab-btn:hover svg {
    transform: translateY(-1px);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active svg {
    opacity: 1;
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px 3px 0 0;
}

/* Tab Panels */
.tabs-content {
    padding: 2rem;
    flex: 1;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Panel Header */
.panel-header {
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 0.35rem;
}

.panel-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Dropzone style */
.dropzone-container {
    border: 2px dashed var(--border-color);
    border-radius: var(--element-radius);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropzone-container:hover, .dropzone-container.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.03);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.dropzone-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.dropzone-container:hover .dropzone-icon {
    transform: scale(1.1);
    background: var(--primary);
    color: #fff;
}

.dropzone-text {
    text-align: center;
}

.dropzone-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 0.25rem;
}

.dropzone-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* File Info Bar */
.file-info-bar {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.file-info-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-info-details svg {
    color: var(--success);
    width: 24px;
    height: 24px;
}

.file-name {
    font-weight: 600;
    color: var(--text-title);
    font-size: 0.95rem;
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Selection Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-control, .input-control {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--element-radius);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.select-control:focus, .input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

.select-control option {
    background: #0f0f1b;
    color: #fff;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--element-radius);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.95rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

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

.btn-secondary {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--border-color-active);
    background: var(--bg-surface-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Data Preview Table */
.table-preview-card {
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    overflow: hidden;
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
}

.table-preview-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
}

.table-preview-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.table-wrapper {
    overflow-x: auto;
    max-height: 280px;
}

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

th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: var(--text-title);
    position: sticky;
    top: 0;
    z-index: 10;
}

tr:hover {
    background: var(--bg-surface-hover);
}

/* Column Mapping Grid */
.mapping-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.mapping-header {
    display: grid;
    grid-template-columns: 1.5fr 1.5fr 1fr 1fr;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-items: center;
}

.mapping-row {
    display: grid;
    grid-template-columns: 1.5fr 1.5fr 1fr 1fr;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    font-size: 0.9rem;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.mapping-row:hover {
    border-color: var(--border-color-active);
    background: rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .mapping-header {
        display: none;
    }
    .mapping-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
    }
    .mapping-row::before {
        font-weight: 600;
        font-size: 0.8rem;
        color: var(--text-muted);
    }
}

.source-col {
    font-weight: 600;
    color: var(--text-title);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    user-select: none;
}

.checkbox-container input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* SQL Preview Area */
.sql-preview-card {
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    background: #09090f;
    margin-top: 1.5rem;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.sql-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.sql-preview-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sql-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

pre {
    margin: 0;
    padding: 1.25rem;
    overflow: auto;
    max-height: 400px;
}

code {
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.keyword { color: #ff79c6; font-weight: 600; }
.string { color: #f1fa8c; }
.number { color: #bd93f9; }
.table-name { color: #8be9fd; }
.comment { color: #6272a4; }

/* Script Tabs */
.script-tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.script-tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.script-tab-btn.active {
    background: var(--primary);
    color: white;
}

/* Info Alert */
.info-alert {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--element-radius);
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.info-alert-icon {
    color: var(--secondary);
    display: flex;
    align-items: flex-start;
}

.info-alert-icon svg {
    width: 20px;
    height: 20px;
}

.info-alert-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 0.15rem;
}

.info-alert-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(15, 15, 27, 0.9);
    border: 1px solid var(--success);
    color: var(--text-title);
    padding: 0.75rem 1.25rem;
    border-radius: var(--element-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    color: var(--success);
}
