/* ==========================================================================
   DATABRICKS AUDIO AUTO-UPLOADER DESIGN SYSTEM
   Dark Mode & Glassmorphism Aesthetics
   ========================================================================== */

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --surface: rgba(19, 27, 46, 0.75);
    --surface-hover: rgba(30, 41, 69, 0.85);
    --surface-border: rgba(255, 255, 255, 0.08);
    --surface-border-focus: rgba(99, 102, 241, 0.5);

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);

    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-code: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Background Ambient Glows */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
}
.bg-glow-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
    top: -100px;
    left: -100px;
}
.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.04) 100%);
    bottom: -150px;
    right: -150px;
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.logo-text h1 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(120deg, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Connection Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.badge-checking {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
}
.badge-connected {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}
.badge-disconnected {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

/* ==========================================================================
   KPI CARDS GRID
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.kpi-card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.25s ease, border-color 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--surface-border-focus);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.icon-blue { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.kpi-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.text-success { color: var(--success); font-weight: 500; }
.text-warning { color: var(--warning); font-weight: 500; }
.text-amber { color: #fbbf24; }
.text-blue { color: #818cf8; }
.text-green { color: #34d399; }

/* Switch Toggle UI */
.sync-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 2px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #374151;
    transition: 0.3s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.sync-status-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* ==========================================================================
   UPLOAD PROGRESS BANNER
   ========================================================================== */
.upload-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    animation: fadeIn 0.3s ease;
}

.banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.banner-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #e0e7ff;
}
.banner-title i { color: var(--accent-cyan); font-size: 1.1rem; }
.banner-pct {
    font-weight: 700;
    color: #38bdf8;
    font-family: var(--font-code);
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   MAIN CARD & TABS
   ========================================================================== */
.main-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--surface-border);
    background: rgba(11, 15, 25, 0.6);
    padding: 6px 12px 0;
    gap: 6px;
    overflow-x: auto;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.tab-content {
    display: none;
    padding: 24px;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

/* Toolbar */
.action-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--surface-border);
}

.folder-path-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-border);
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: #c7d2fe;
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-path-display i { color: var(--primary); }

.toolbar-buttons {
    display: flex;
    gap: 10px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    border-color: var(--surface-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline-danger {
    background: transparent;
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}
.btn-outline-danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 1rem;
}
.btn-icon:hover { color: #fff; }

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-border);
}

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

.custom-table th {
    background: rgba(11, 15, 25, 0.8);
    color: var(--text-muted);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--surface-border);
    white-space: nowrap;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.file-ext-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}
.status-uploaded { background: var(--success-bg); color: var(--success); }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-modified { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.status-failed { background: var(--danger-bg); color: var(--danger); }

/* ==========================================================================
   CONFIG FORM
   ========================================================================== */
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #e0e7ff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-group label i { color: var(--primary); }

.form-group input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    color: #fff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.input-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-password-wrapper input {
    width: 100%;
    padding-right: 42px;
}
.input-password-wrapper .btn-icon {
    position: absolute;
    right: 8px;
}

.help-text {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* ==========================================================================
   LOGS & HISTORY
   ========================================================================== */
.logs-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e7ff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-header h3 i { color: var(--accent-cyan); }

.history-list-box, .terminal-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    height: 480px;
    overflow-y: auto;
    padding: 14px;
}

.terminal-box {
    font-family: var(--font-code);
    font-size: 0.82rem;
    line-height: 1.6;
    color: #d1d5db;
}

.log-line {
    margin-bottom: 4px;
    word-break: break-all;
}
.log-info { color: #93c5fd; }
.log-success { color: #86efac; font-weight: 600; }
.log-warning { color: #fde047; }
.log-error { color: #fca5a5; font-weight: 600; }

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: #fff;
}
.history-meta {
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ==========================================================================
   GUIDE
   ========================================================================== */
.guide-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.guide-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.guide-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-list {
    margin-left: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.8;
}
.step-list code {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-code);
}

.code-snippet {
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 10px 0;
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: #38bdf8;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    box-shadow: var(--shadow-md);
    color: #fff;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 420px;
    animation: slideInRight 0.3s ease;
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 900px) {
    .config-grid, .logs-layout { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }
    .app-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .header-right { width: 100%; justify-content: space-between; }
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
