/* Modern Design System - Premium Dark Theme & Glassmorphism */
:root {
    --bg-main: #0a0b10;
    --bg-glass: rgba(18, 20, 30, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);
    
    --surface-card: rgba(26, 28, 45, 0.45);
    --surface-inner: rgba(13, 14, 24, 0.8);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Glowing Accents */
.glass-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.12) 0%, transparent 45%);
    pointer-events: none;
}

/* Main Container Layout */
.app-container {
    position: relative;
    z-index: 2;
    display: flex;
    width: 96%;
    height: 94%;
    max-width: 1600px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
}

/* Sidebar Styling */
.sidebar {
    width: 380px;
    border-right: 1px solid var(--border-glass);
    background: rgba(10, 11, 16, 0.5);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-glass);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 36px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.app-header .subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Connection Badge */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: var(--transition-fast);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-lang {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.badge-lang:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
}

.badge-error {
    background: var(--danger-bg);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-success {
    background: var(--success-bg);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

/* Sidebar Sections */
.panel-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: opacity var(--transition-normal);
}

.panel-section.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.panel-section h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.panel-section h2 span {
    font-size: 20px;
    color: var(--primary);
}

/* Inputs & Form Elements */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

input[type="text"],
input[type="password"],
select,
textarea {
    background: var(--surface-inner);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Input with action wrapper */
.input-with-action {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-action input {
    padding-right: 44px;
}

.icon-btn {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.icon-btn span {
    font-size: 18px;
}

/* Radio buttons group */
.radio-group {
    display: flex;
    gap: 16px;
    background: var(--surface-inner);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.radio-label input {
    display: none;
}

.radio-label:has(input:checked) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    border: 1px solid transparent;
}

.btn-full {
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 16px var(--primary-glow);
}

.btn-secondary {
    background: var(--surface-inner);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}

.btn-success:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    background: var(--text-muted);
}

.btn-icon-only {
    padding: 10px;
    aspect-ratio: 1;
}

.btn span {
    font-size: 18px;
}

/* Main Workspace Area Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    overflow-y: auto;
}

/* Card layout */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 11, 16, 0.2);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title span {
    color: var(--primary);
    font-size: 22px;
}

.card-title h2 {
    font-size: 15px;
    font-weight: 600;
}

/* Dropdown presets menu */
.presets-dropdown {
    position: relative;
}

.presets-dropdown .arrow {
    font-size: 16px;
    transition: transform var(--transition-fast);
}

.presets-dropdown.open .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    background: #141522;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    flex-direction: column;
    padding: 8px;
}

.presets-dropdown.open .dropdown-menu {
    display: flex;
}

.dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
    width: 100%;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item strong {
    font-size: 13px;
    font-weight: 600;
}

.dropdown-item span {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Schema Editor Pane Layout */
.schema-card {
    flex: 1.3;
    min-height: 380px;
}

.editor-layout {
    display: flex;
    flex: 1;
    height: 100%;
}

.editor-pane, .preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-pane {
    border-right: 1px solid var(--border-glass);
}

.pane-header {
    background: rgba(13, 14, 24, 0.4);
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
}

.status-indicator {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-indicator.valid {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-indicator.invalid {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

textarea#schema-json {
    flex: 1;
    border: none;
    border-radius: 0;
    resize: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: rgba(10, 11, 16, 0.3);
    padding: 16px;
}

/* Schema Visual Preview styles */
.preview-pane {
    background: rgba(10, 11, 16, 0.1);
}

.preview-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-content .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    text-align: center;
}

.preview-content .empty-state span {
    font-size: 48px;
}

/* Preview parsed visual blocks */
.preview-table {
    background: var(--surface-inner);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    overflow: hidden;
}

.preview-table-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-table-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-table-meta {
    font-size: 10px;
    background: var(--primary-glow);
    color: #c7d2fe;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.preview-fields-list {
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-field-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-field-tag .field-type {
    font-size: 9px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Console Panel styling */
.console-card {
    flex: 1;
    min-height: 250px;
    background: #07080d;
}

.progress-bar-container {
    padding: 14px 20px 8px 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid var(--border-glass);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 999px;
    transition: width var(--transition-fast);
}

.console-wrapper {
    flex: 1;
    position: relative;
}

.console-output {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line {
    word-break: break-all;
    white-space: pre-wrap;
}

.log-system { color: var(--text-muted); }
.log-info { color: var(--info); }
.log-success { color: var(--success); }
.log-warning { color: var(--warning); }
.log-error { color: var(--danger); font-weight: 500; }
.log-api { color: #818cf8; }

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none !important;
}
