/* === THEME MATCHING INDEX.CSS === */
:root {
    /* Fonts */
    --font-sans: 'Poppins', 'Merriweather', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    
    /* Colors matching index.css */
    --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #06b6d4 100%);
    --accent-gradient: linear-gradient(135deg, #ff5f6d 0%, #845ec2 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Background colors */
    --bg-primary: linear-gradient(120deg, #f6f7fb 0%, #e9ebf3 100%);
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    
    /* Container backgrounds matching index.css */
    --surface-glass: linear-gradient(135deg, rgba(255,255,255,0.88) 60%, rgba(120,140,255,0.32) 100%);
    --surface-elevated: rgba(255, 255, 255, 0.95);
    --surface-card: #ffffff;
    
    /* Glass morphism variables */
    --glass-border: rgba(120,140,255,0.18);
    --glass-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.13), 0 2px 8px 0 rgba(0,0,0,0.06);
    
    /* Text colors */
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-white: #ffffff;
    
    /* Interactive colors */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    
    /* Form colors */
    --form-border: #e0e4fa;
    --form-focus: #6c7cff;
    --form-bg: #ffffff;
    
    /* Animation variables */
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: all 0.3s ease;
    --shadow-glow: 0 8px 32px rgba(30, 30, 40, 0.08);
}

/* === RESET & GLOBAL STYLES === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    padding-top: 102px; /* 70px navbar + 32px margin */
    overflow-y: auto;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(255,255,255,0.55) 0%, rgba(230,235,255,0.38) 100%);
    backdrop-filter: blur(32px) saturate(160%);
    -webkit-backdrop-filter: blur(32px) saturate(160%);
}

body > * {
    position: relative;
}

/* === NAVIGATION STYLES === */
.navbar-outer-container {
    position: fixed;
    top: 16px;
    left: 0;
    width: 100vw;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 9999 !important;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.navbar {
    position: relative;
    width: 92vw;
    max-width: 1400px;
    margin: 0 auto;
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(30, 30, 40, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-gradient);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: auto;
    z-index: 10000 !important;
    transition: var(--transition-smooth);
    animation: navbarSlideIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes navbarSlideIn {
    from {
        opacity: 0;
        transform: translateY(-100px) scale(0.95);
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        backdrop-filter: blur(20px);
    }
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.1) 100%);
    pointer-events: none;
    z-index: -1;
}

.navbar:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 16px 48px rgba(30, 30, 40, 0.15),
        0 8px 24px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.nav-brand {
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
    position: relative;
    flex-shrink: 0;
    margin-left: 2%;
}

.nav-brand img {
    max-height: 38px;
    width: auto;
    filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
    transition: var(--transition-smooth);
}

.nav-brand:hover {
    transform: scale(1.05);
}

.nav-brand:hover img {
    filter: brightness(0) invert(1) drop-shadow(0 4px 12px rgba(255, 255, 255, 0.3));
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
    flex-shrink: 0;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.nav-menu li a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    transition: left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-menu li a:hover::before {
    left: 100%;
}

.nav-menu li a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(0, 0, 0, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-menu li a:active {
    transform: translateY(0) scale(0.98);
}

.nav-menu li a.log-btn {
    background: var(--accent-gradient) !important;
    color: #fff !important;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    margin-left: 12px;
    box-shadow: 
        0 4px 16px rgba(132, 94, 194, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.nav-menu li a.log-btn:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0891b2 100%) !important;
    color: #fff !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 8px 24px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Mobile Navigation */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--text-white);
    margin: 2px 0;
    transition: var(--transition-smooth);
    border-radius: 1px;
}

.main-page-container {
    margin-top: 32px;
    min-height: calc(100vh - 134px);
    position: relative;
    z-index: 1;
}

/* === APP STRUCTURE & VIEWS === */
.app-container {
    min-height: calc(100vh - 134px);
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    min-height: 100%;
    width: 100%;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.view.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    background: var(--surface-glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 38px;
    margin: 0 1rem 2rem 1rem;
    box-shadow: var(--glass-shadow);
    position: relative;
    z-index: 1;
}

.app-header::before {
    display: none;
}

.app-header > * {
    position: relative;
    z-index: 1;
}

.app-header:hover {
    box-shadow: 
        0 12px 40px rgba(102, 126, 234, 0.15),
        0 6px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

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

.app-header .logo i {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.app-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding-left: 3rem;
}

main {
    padding: 2rem;
    flex-grow: 1;
}

.upload-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

/* === MODERN STEP CARDS === */
.step {
    background: var(--surface-glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 38px;
    padding: 48px 36px 40px 36px;
    border: 2px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transform: translateY(0);
    transition: var(--transition-smooth);
    position: relative;
    z-index: 1;
}

.step::before {
    display: none;
}

.step > * {
    position: relative;
    z-index: 1;
}

.step:hover {
    box-shadow: 
        0 12px 40px rgba(102, 126, 234, 0.15),
        0 6px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.step h2 {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(61, 82, 160, 0.3);
}

.step .step-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding-left: 47px;
    line-height: 1.6;
}

/* === MODERN UPLOAD AREA === */
.upload-card {
    background: transparent;
    border-radius: 16px;
}

.upload-area {
    text-align: center;
    padding: 4rem 2rem;
    border: 2px dashed var(--form-border);
    border-radius: 16px;
    background: var(--form-bg);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.upload-area:hover,
.upload-area.active {
    border-color: var(--form-focus);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 124, 255, 0.15);
}

.upload-area i {
    font-size: 4rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

.upload-area h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.upload-area h3 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: underline;
}

.upload-area p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* === MODERN FILE LIST === */
.file-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border-radius: 16px;
    background: var(--surface-card);
    border: 1.5px solid var(--form-border);
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--form-focus);
}

.file-icon {
    font-size: 2rem;
    margin-right: 1.25rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.file-icon.csv,
.file-icon.excel {
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.file-info {
    flex-grow: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.remove-btn {
    background: var(--surface-card);
    border: 1px solid var(--form-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--accent-pink);
    transition: var(--transition-smooth);
}

.remove-btn:hover {
    background: #ffe6ed;
    transform: scale(1.1);
    color: #e11d48;
    border-color: #fbbebe;
}

/* === MODERN CONFIG CARD === */
.config-card {
    background: var(--surface-card);
    border: 1.5px solid var(--form-border);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.config-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.config-card h3 i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

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

.form-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.form-group input[type="number"],
.form-group select {
    border-radius: 16px;
    border: 1.5px solid var(--form-border);
    background: var(--form-bg);
    box-shadow: 0 1px 4px 0 rgba(31, 38, 135, 0.03);
    font-size: 1.08rem;
    padding: 16px 20px;
    color: var(--text-primary);
    transition: border 0.2s, box-shadow 0.2s;
}

.form-group input[type="number"]:focus,
.form-group select:focus {
    border: 1.5px solid var(--form-focus);
    box-shadow: 0 2px 8px 0 rgba(108, 124, 255, 0.10);
    background: var(--form-bg);
    outline: none;
}

/* === MODERN BUTTONS === */
.btn {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 1rem;
    padding: 1rem 2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0) scale(0.98);
    transition: transform 0.1s ease;
}

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

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(61, 82, 160, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4c63b6 0%, #5a73cc 100%);
    box-shadow: 0 8px 24px rgba(61, 82, 160, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--form-focus);
}

.btn-danger {
    background: var(--warning-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.4);
}

.btn-lg {
    padding: 1.25rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 12px;
}

.btn-sm {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
}

.process-action {
    text-align: center;
    padding: 2rem 0;
}

/* === MAPPING SECTION === */
.mapping-card {
    background: var(--surface-card);
    border: 1.5px solid var(--form-border);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mapping-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.source-columns,
.target-columns {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--form-border);
}

.source-columns h3,
.target-columns h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.source-columns h3 i,
.target-columns h3 i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-source-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.search-source-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-source-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--form-border);
    border-radius: 8px;
    background: var(--form-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.column-pool,
.column-list {
    background: var(--form-bg);
    padding: 1rem;
    border-radius: 8px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--form-border);
}

.column-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-content: flex-start;
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.source-header-item,
.mapped-header-item {
    background: var(--surface-card);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--form-border);
    cursor: grab;
    user-select: none;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    color: var(--text-primary);
}

.source-header-item:hover,
.mapped-header-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.source-header-item:active,
.mapped-header-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.target-column {
    background: var(--surface-card);
    border: 1px solid var(--form-border);
    border-radius: 8px;
    padding: 1rem;
}

.target-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.target-column-header .name {
    font-weight: 600;
    color: var(--text-primary);
}

.target-column-header .actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.target-column-header .actions button:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.mapped-columns-container {
    background: var(--bg-tertiary);
    border-radius: 6px;
    min-height: 60px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--form-border);
    transition: var(--transition-smooth);
}

.mapped-columns-container.drag-over {
    background: rgba(108, 124, 255, 0.1);
    border-color: var(--form-focus);
}

.add-column-action {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.add-column-action input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid var(--form-border);
    border-radius: 8px;
    background: var(--form-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

/* === PREVIEW STYLES === */
.preview-header {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.export-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface-card);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--form-border);
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-group-inline label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-group-inline input,
.form-group-inline select {
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-group-inline input:focus,
.form-group-inline select:focus {
    outline: none;
    border-color: var(--form-focus);
    box-shadow: 0 0 0 2px rgba(108, 124, 255, 0.1);
}

.preview-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

.preview-intro {
    background: var(--surface-glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    padding: 2rem;
    border-radius: 16px;
    border: 2px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    position: relative;
    z-index: 1;
}

.preview-intro::before {
    display: none;
}

.preview-intro > * {
    position: relative;
    z-index: 1;
}

.preview-intro h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.preview-intro h3 i {
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.preview-intro p {
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 2rem;
}

/* === MODERN TOOLBAR === */
.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--surface-card);
    border-radius: 16px;
    border: 1px solid var(--form-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tool-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tool-btn {
    background: var(--surface-card);
    color: var(--text-secondary);
    border: 1px solid var(--form-border);
    width: 48px;
    height: 48px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1.25rem;
    position: relative;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tool-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 16px rgba(61, 82, 160, 0.3);
}

.tool-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--text-white);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tool-btn[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text-primary);
    z-index: 100;
}

/* === CONTENT AREA === */
.preview-content-area {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    min-height: 500px;
}

.table-container {
    background: var(--surface-card);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--form-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.table-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
}

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

.preview-table th,
.preview-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--form-border);
    white-space: nowrap;
    color: var(--text-primary);
}

.preview-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: grab;
    user-select: none;
}

.preview-table th:hover {
    background: #e2e8f0;
}

.preview-table th .th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.preview-table th .col-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s;
}

.preview-table th:hover .col-menu-btn {
    visibility: visible;
    opacity: 1;
}

.preview-table th .col-menu-btn:hover {
    background: var(--surface-card);
    color: var(--text-primary);
}

.preview-table tbody tr {
    transition: background-color 0.2s ease;
}

.preview-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.preview-table tbody td {
    color: var(--text-secondary);
}

/* === SIDEBAR === */
.preview-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.sidebar-card {
    background: var(--surface-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--form-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.sidebar-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.sidebar-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.sidebar-card h3 i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#statsWrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
    transition: var(--transition-smooth);
    border: 1px solid var(--form-border);
}

.stat-item:hover {
    transform: translateY(-2px);
    background: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-item .value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 500;
}

.file-stats-list {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--form-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.4rem 0;
}

.file-stat-item .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    padding-right: 1rem;
}

.file-stat-item .rows {
    font-weight: 500;
    color: var(--text-muted);
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 150px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--form-border);
}

.checkbox-item {
    display: flex;
    align-items: center;
}

.checkbox-item input {
    margin-right: 0.75rem;
    accent-color: var(--accent-blue);
    width: 16px;
    height: 16px;
}

.checkbox-item label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === MODALS === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface-card);
    border-radius: 16px;
    border: 1px solid var(--form-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    animation: modal-scale-in 0.3s ease forwards;
}

@keyframes modal-scale-in {
    to { transform: scale(1); }
}

.modal-content.large {
    max-width: 900px;
}

.modal-header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--form-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    background: var(--surface-card);
    border: 1px solid var(--form-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(1.05);
}

.modal-body {
    padding: 2rem;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-body input[type="text"],
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 1rem;
    border: 1.5px solid var(--form-border);
    border-radius: 12px;
    background: var(--form-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.modal-body input[type="text"]:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--form-focus);
    box-shadow: 0 2px 8px 0 rgba(108, 124, 255, 0.10);
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .checkbox-item {
    margin-top: 1rem;
}

.modal-footer {
    padding: 1rem 2rem 2rem 2rem;
    border-top: 1px solid var(--form-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Filter Rules Styling */
#filter-rules-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
    max-height: 40vh;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--form-border);
}

.filter-rule {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface-card);
    border-radius: 8px;
    border: 1px solid var(--form-border);
}

.filter-rule select,
.filter-rule input {
    font-size: 0.9rem;
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
}

.filter-rule .filter-column {
    flex-grow: 1;
}

.filter-rule .filter-condition {
    flex-grow: 1;
}

.filter-rule .filter-value {
    flex-grow: 2;
}

.filter-rule .remove-rule-btn {
    background: var(--surface-card);
    border: 1px solid var(--form-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-pink);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-rule .remove-rule-btn:hover {
    background: #ffe6ed;
    color: #e11d48;
    transform: scale(1.05);
}

#add-filter-rule-btn {
    margin-top: 0.5rem;
}

/* === PROGRESS OVERLAY === */
#progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-container {
    width: 90%;
    max-width: 500px;
    background: var(--surface-card);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--form-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid var(--form-border);
}

.progress {
    width: 0%;
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 10px;
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.progress-text .spin {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* New loader styles */
.flex-col {
    flex-direction: column;
}

.gap-4 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.w-28 {
    width: 7rem;
}

.h-28 {
    height: 7rem;
}

.border-8 {
    border-width: 2rem;
}

.text-blue-400 {
    color: #60a5fa;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.border-t-blue-400 {
    border-top-color: #60a5fa;
}

.rounded-full {
    border-radius: 9999px;
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === ALERTS === */
.alert-container {
    position: fixed;
    top: 120px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    border: 1px solid;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateX(100px);
    animation: alert-slide-in 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    min-width: 320px;
    background: var(--surface-card);
}

@keyframes alert-slide-in {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert.fade-out {
    animation: alert-slide-out 0.3s ease forwards;
}

@keyframes alert-slide-out {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-message {
    font-weight: 500;
    flex-grow: 1;
    line-height: 1.4;
}

.alert.alert-success {
    border-color: #22c55e;
    color: #15803d;
}

.alert.alert-success .alert-icon {
    color: #22c55e;
}

.alert.alert-error {
    border-color: #ef4444;
    color: #dc2626;
}

.alert.alert-error .alert-icon {
    color: #ef4444;
}

.alert.alert-info {
    border-color: #3b82f6;
    color: #2563eb;
}

.alert.alert-info .alert-icon {
    color: #3b82f6;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1200px) {
    .preview-content-area {
        grid-template-columns: 1fr 300px;
    }
    
    .mapping-area {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .preview-content-area {
        grid-template-columns: 1fr;
    }
    
    .preview-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: visible;
    }
    
    .sidebar-card {
        flex: 1;
        min-width: 280px;
    }
    
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .app-header .subtitle {
        padding-left: 0;
    }
}

@media (max-width: 768px) {
    .hamburger {
    display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 102px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 102px);
        background: var(--surface-card);
        flex-direction: column;
        padding: 2rem;
        transition: left 0.3s ease;
        gap: 1rem;
        border-right: 1px solid var(--form-border);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu li {
    width: 100%;
    }
    
    .nav-menu li a {
        display: block;
    padding: 1rem;
    border-radius: 8px;
        text-align: center;
        color: var(--text-primary);
        background: var(--bg-tertiary);
    }
    
    .nav-menu li a:hover {
        background: var(--form-focus);
        color: white;
    }
    
    main {
    padding: 1rem;
    }
    
    .app-header {
        margin: 0 0.5rem 1rem 0.5rem;
        padding: 1.5rem;
    }
    
    .step {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .upload-area {
        padding: 3rem 1.5rem;
    }
    
    .preview-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .tool-group {
        justify-content: center;
    }
    
    .preview-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .export-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group-inline {
    flex-direction: column;
        align-items: stretch;
    gap: 0.5rem;
}
    
    .preview-sidebar {
        flex-direction: column;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.5rem;
    }
    
    #statsWrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 86px;
    }
    
    .navbar-outer-container {
        top: 10px;
    }
    
    .navbar {
        width: 95vw;
        height: 60px;
        padding: 0 1rem;
        border-radius: 20px;
    }
    
    .nav-brand {
        margin-left: 0;
    }
    
    .nav-brand img {
        max-height: 32px;
    }
    
    .app-header {
        margin: 0 0.25rem 1rem 0.25rem;
        padding: 1rem;
    }
    
    .app-header .logo h1 {
        font-size: 1.5rem;
    }
    
    .step {
        padding: 1rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area i {
        font-size: 3rem;
    }
    
    .file-item {
        padding: 1rem;
    }
    
    .file-icon {
        font-size: 1.5rem;
        margin-right: 1rem;
    }
    
    .alert-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .alert {
        min-width: auto;
    }
}

/* === CUSTOM SCROLLBARS === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--form-border);
    border-radius: 3px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--form-focus);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--form-border) var(--bg-tertiary);
}

/* === SELECTION STYLING === */
::selection {
    background: rgba(59, 130, 246, 0.2);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(59, 130, 246, 0.2);
    color: var(--text-primary);
}

/* === FOCUS IMPROVEMENTS === */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--form-focus);
    outline-offset: 2px;
}

/* === WELCOME MESSAGE MATCHING INDEX.CSS === */
#welcome-message {
    background: var(--surface-glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    margin: 0 1rem 1rem 1rem;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

#welcome-message::before {
    display: none;
}

#welcome-message > * {
    position: relative;
    z-index: 1;
}

/* === UTILITY CLASSES === */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

/* === ACCESSIBILITY IMPROVEMENTS === */
@media (prefers-reduced-motion: reduce) {
    *, 
    *::before, 
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Ensure all interactive elements have proper contrast */
.btn, .tool-btn, .modal-close, .remove-btn {
    min-height: 44px;
    min-width: 44px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --form-border: #333333;
        --text-secondary: #333333;
    }
    
    .btn-primary {
        border: 2px solid var(--accent-blue);
    }
    
    .btn-secondary {
        border: 2px solid var(--text-secondary);
    }
}
