:root {
    --primary: #003366;
    --primary-hover: #002244;
    --primary-soft: rgba(0, 51, 102, 0.1);
    --secondary: #e11d48;
    --accent: #f59e0b;

    --bg-aura: #f8fafc;
    --surface: rgba(255, 255, 255, 0.85);
    --border: rgba(0, 0, 0, 0.08);

    --text-dark: #0f172a;
    --text-mid: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow-card: 0 10px 40px -10px rgba(0, 51, 102, 0.15);
    
    --transition: 0.2s ease;
}

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

body {
    background-color: var(--bg-aura);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

h1,h2,h3, .btn-text, .section-title { font-family: 'Outfit', sans-serif; }

/* Background Orbs */
.bg-effects {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.15; }
.orb:nth-child(1) { width: 500px; height: 500px; background: var(--primary); top: -10%; right: -5%; animation: float 15s infinite alternate; }
.orb:nth-child(2) { width: 400px; height: 400px; background: var(--secondary); bottom: -10%; left: -10%; animation: float 20s infinite alternate-reverse; }
.orb:nth-child(3) { width: 300px; height: 300px; background: var(--accent); top: 30%; left: 30%; opacity: 0.1; animation: float 18s infinite alternate; }

@keyframes float { from { transform: translate(0, 0); } to { transform: translate(40px, 80px); } }

/* Layout Shell */
.app-container {
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    gap: 20px;
}

/* Header */
.app-header { text-align: center; flex-shrink: 0; }
.logo-icon { width: auto; height: 50px; background: transparent; border-radius: 0; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 15px; box-shadow: none; }
.logo-icon img { height: 100%; max-width: 250px; object-fit: contain; }
.app-header h1 { font-size: 2.2rem; color: var(--text-dark); margin-bottom: 5px; }
.app-header p { font-size: 1.05rem; color: var(--text-mid); max-width: 600px; margin: 0 auto; }

/* Tab Selector */
.tab-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 6px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 100px;
    margin: 0 auto;
    position: relative;
    flex-shrink: 0;
}
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 25px;
    border-radius: 100px;
    border: none;
    background: transparent;
    color: var(--text-mid);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1;
}
.tab-btn svg { width: 18px; height: 18px; }
.tab-btn.active { color: white; background: var(--primary); box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3); }
.tab-btn:hover:not(.active) { color: var(--text-dark); }

/* Alerts */
.error-alert { flex-shrink: 0; background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; padding: 12px 20px; border-radius: var(--radius-md); display: flex; align-items: center; gap: 10px; font-weight: 500; }
.error-alert svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.error-alert[hidden] { display: none; }
.success-alert { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; }

/* View Panes */
.view-pane {
    flex: 1;
    display: none;
    flex-direction: column;
    min-height: 0;
    animation: fadeUp 0.3s ease;
}
.view-pane.active { display: flex; }

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

/* Glass Cards container */
.glass-card { background: var(--surface); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow-card); }
.panel-container { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Section Title */
.section-title { font-size: 1.4rem; font-weight: 600; display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.step-badge { background: var(--primary); color: white; width: 28px; height: 28px; display: inline-flex; justify-content: center; align-items: center; border-radius: 50%; font-size: 0.9rem; font-family: 'Inter', sans-serif; }

/* Upload Styles */
.drop-zone { border: 2px dashed rgba(79, 70, 229, 0.3); border-radius: var(--radius-md); padding: 50px 20px; text-align: center; cursor: pointer; transition: all 0.2s; background: rgba(255, 255, 255, 0.5); }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.icon-upload { margin-bottom: 15px; }
.icon-upload svg { width: 44px; height: 44px; fill: var(--primary); opacity: 0.8; }
.drop-label { font-size: 1.2rem; font-weight: 600; color: var(--text-dark); margin-bottom: 5px; }
.drop-hint { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; }
.file-status { display: inline-block; font-size: 0.9rem; font-weight: 500; color: var(--primary); background: var(--primary-soft); padding: 5px 12px; border-radius: 20px; }
.file-status:empty { display: none; }

/* Process Section */
.process-section { text-align: center; }
.btn-process { background: var(--primary); color: white; padding: 16px 35px; font-size: 1.1rem; border-radius: 50px; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 10px 20px rgba(0, 51, 102, 0.3); transition: all 0.3s; }
.btn-process:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 15px 25px rgba(0, 51, 102, 0.4); }
.btn-process:disabled { background: var(--text-light); box-shadow: none; cursor: not-allowed; opacity: 0.7; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 1s infinite linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Results Section */
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; border-bottom: 1px solid var(--border); padding-bottom: 20px; flex-shrink: 0;}
.results-header h2 { font-size: 1.4rem; color: var(--text-dark); }
.btn-download { display: inline-flex; align-items: center; gap: 8px; background: #10b981; color: white; padding: 10px 15px; text-decoration: none; border-radius: var(--radius-sm); font-weight: 600; transition: transform 0.2s; }
.btn-download:hover { transform: translateY(-2px); }
.btn-download svg { width: 18px; height: 18px; fill: white; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px; flex-shrink: 0;}
.stat-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 15px; text-align: center; }
.stat-value { font-size: 1.8rem; font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--text-dark); display: block; margin-bottom: 2px; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-card.accent .stat-value { color: var(--secondary); }
.stat-card.primary .stat-value { color: var(--primary); }

.preview-container { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.table-scroll { overflow-y: auto; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; flex: 1;}
.preview-table { width: 100%; border-collapse: collapse; text-align: left; }
.preview-table th { position: sticky; top: 0; background: #f8fafc; padding: 12px 20px; font-size: 0.85rem; font-weight: 600; color: var(--text-mid); border-bottom: 1px solid var(--border); z-index: 10;}
.preview-table td { padding: 12px 20px; font-size: 0.9rem; border-bottom: 1px solid #f1f5f9; color: var(--text-dark); }
.preview-table tr:last-child td { border-bottom: none; }

/* Database Section */
.db-toolbar { display: flex; gap: 15px; margin-bottom: 20px; flex-shrink: 0;}
.db-search { flex: 1; min-width: 200px; }
.db-search input, .db-add input { width: 100%; padding: 12px 15px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; outline: none; transition: border-color 0.2s; background: white;}
.db-search input:focus, .db-add input:focus { border-color: var(--primary); }
.db-add { display: flex; gap: 10px; width: 40%; min-width: 250px; }
.btn-action { background: var(--text-dark); color: white; border: none; padding: 0 18px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; transition: opacity 0.2s; white-space: nowrap; font-size: 0.9rem;}
.btn-action:hover { opacity: 0.85; }

.btn-delete { background: #fee2e2; color: #991b1b; border: none; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: background 0.2s; }
.btn-delete:hover { background: #fecaca; }
