/* ============================================================
   Sharetribe Importer — Premium Dark UI
   ============================================================ */

:root {
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --primary-dark: #4F46E5;
    --primary-glow: rgba(99, 102, 241, 0.25);

    --success: #34D399;
    --success-bg: rgba(52, 211, 153, 0.1);
    --warning: #FBBF24;
    --warning-bg: rgba(251, 191, 36, 0.1);
    --danger: #F87171;
    --danger-bg: rgba(248, 113, 113, 0.1);
    --info: #22D3EE;
    --info-bg: rgba(34, 211, 238, 0.1);

    /* OLED Black Dark Mode */
    --bg-body: #000000;
    --bg-sidebar: #000000;
    --bg-card: #0A0A0A;
    --bg-card-hover: #141414;
    --bg-input: #0A0A0A;
    --bg-surface: #1A1A1A;
    --bg-glass: rgba(10, 10, 10, 0.85);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --text-dim: #52525B;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.7);
    --shadow-glow: 0 0 20px var(--primary-glow);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
}

/* ============================================================
   Light Theme — Apple.com Inspired
   ============================================================ */
[data-theme="light"] {
    --bg-body: #F5F5F7;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFAFA;
    --bg-input: #FFFFFF;
    --bg-surface: #F5F5F7;
    --bg-glass: rgba(255, 255, 255, 0.72);

    --border-color: rgba(0, 0, 0, 0.06);
    --border-focus: rgba(99, 102, 241, 0.35);

    --text-primary: #1D1D1F;
    --text-secondary: #424245;
    --text-muted: #6E6E73;
    --text-dim: #86868B;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-glow: none;

    --primary-glow: rgba(99, 102, 241, 0.08);
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.06);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.06);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.06);
    --info: #06B6D4;
    --info-bg: rgba(6, 182, 212, 0.06);
}

[data-theme="light"] .login-page::before {
    background: radial-gradient(circle, rgba(99,102,241,0.06), transparent 70%);
}
[data-theme="light"] .login-page::after {
    background: radial-gradient(circle, rgba(139,92,246,0.04), transparent 70%);
}

/* Apple-style light mode refinements */
[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .card {
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
    border-color: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .card:hover {
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.06);
}
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    border-color: rgba(0, 0, 0, 0.1);
    background: #FFFFFF;
}
[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
[data-theme="light"] .btn-primary {
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
[data-theme="light"] .nav-item.active {
    background: rgba(99, 102, 241, 0.06);
}
[data-theme="light"] .content-header {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* OLED dark mode refinements */
:root .sidebar {
    border-right-color: rgba(255, 255, 255, 0.04);
}
:root .card {
    border-color: rgba(255, 255, 255, 0.06);
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    font-family: var(--font);
}
.theme-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.theme-toggle i { font-size: 14px; }

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

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ============================================================
   Layout
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--primary-hover);
    border-left: 3px solid var(--primary);
    padding-left: 11px;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.nav-item.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--border-color);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0;
    min-height: 100vh;
}

.content-header {
    padding: 24px 32px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.content-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.content-header .subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.content-body {
    padding: 28px 32px;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    border-color: rgba(148, 163, 184, 0.2);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3, .card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.card-body {
    padding: 22px;
}

/* ============================================================
   Stat Cards
   ============================================================ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #8B5CF6);
}

.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34D399); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #FBBF24); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #F87171); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), #22D3EE); }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    box-shadow: 0 4px 16px var(--primary-glow);
    transform: translateY(-1px);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-card);
    border-color: var(--text-dim);
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    border-color: var(--success);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: #fff;
    border-color: var(--danger);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #D97706);
    color: #fff;
    border-color: var(--warning);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ============================================================
   Forms
   ============================================================ */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 13px;
    font-family: var(--font);
    transition: var(--transition);
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
    background: var(--bg-card-hover);
}

.form-control::placeholder {
    color: var(--text-dim);
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
    letter-spacing: 0.01em;
}

.form-text {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-check-input {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================================
   Tables
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

.table thead th {
    background: var(--bg-surface);
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

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

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary-hover); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* ============================================================
   Wizard Steps
   ============================================================ */
.wizard-steps {
    display: flex;
    align-items: center;
    padding: 0 32px;
    margin: 20px 0;
    gap: 0;
    overflow-x: auto;
}

.wizard-step {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.wizard-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-surface);
    color: var(--text-dim);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.wizard-step.active .wizard-step-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 16px var(--primary-glow);
}

.wizard-step.completed .wizard-step-dot {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.wizard-step-label {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
}

.wizard-step.active .wizard-step-label {
    color: var(--text-primary);
    font-weight: 600;
}

.wizard-step.completed .wizard-step-label {
    color: var(--success);
}

.wizard-step-line {
    flex-shrink: 0;
    width: 32px;
    height: 2px;
    background: var(--border-color);
    margin: 0 4px;
}

.wizard-step.completed + .wizard-step-line,
.wizard-step.completed ~ .wizard-step-line {
    background: var(--success);
}

/* ============================================================
   Source Cards (Step 1)
   ============================================================ */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.source-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.source-card:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.source-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: var(--shadow-glow);
}

.source-card-icon {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--primary-hover);
}

.source-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.source-card-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================
   Drag & Drop Upload
   ============================================================ */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-zone-icon {
    font-size: 48px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.upload-zone-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-zone-hint {
    font-size: 12px;
    color: var(--text-dim);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ============================================================
   Mapping UI
   ============================================================ */
.mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.mapping-row:hover {
    background: var(--bg-card-hover);
}

.mapping-source {
    flex: 1;
    min-width: 0;
}

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

.mapping-source-sample {
    font-size: 11px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.mapping-arrow {
    color: var(--text-dim);
    font-size: 18px;
    flex-shrink: 0;
}

.mapping-target {
    flex: 1;
    min-width: 0;
}

.mapping-confidence {
    flex-shrink: 0;
    width: 80px;
    text-align: right;
}

.confidence-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-surface);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.confidence-high { background: var(--success); }
.confidence-medium { background: var(--warning); }
.confidence-low { background: var(--danger); }

/* ============================================================
   Progress Bar
   ============================================================ */
.progress-container {
    margin: 24px 0;
}

.progress-bar-track {
    height: 12px;
    background: var(--bg-surface);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8B5CF6, var(--primary-hover));
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
    animation: progressShimmer 2s ease infinite;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.progress-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.progress-stat-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.progress-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-success { background: var(--success-bg); border-color: rgba(16,185,129,0.2); color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: rgba(245,158,11,0.2); color: var(--warning); }
.alert-danger { background: var(--danger-bg); border-color: rgba(239,68,68,0.2); color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: rgba(6,182,212,0.2); color: var(--info); }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.12), transparent 70%);
    top: -200px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.08), transparent 70%);
    bottom: -100px;
    left: -50px;
    border-radius: 50%;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    margin-bottom: 16px;
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================================
   Utility classes
   ============================================================ */
.text-primary { color: var(--primary-hover) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-dim { color: var(--text-dim) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }
.me-2 { margin-right: 8px !important; }
.ms-2 { margin-left: 8px !important; }
.p-3 { padding: 16px !important; }
.p-4 { padding: 24px !important; }

.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 16px !important; }
.flex-wrap { flex-wrap: wrap !important; }

.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-12 { padding: 0 12px; margin-bottom: 24px; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.fw-600 { font-weight: 600 !important; }
.fs-sm { font-size: 12px !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 32px;
}

.empty-state-icon {
    font-size: 48px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   Toast
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--text-primary);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: var(--transition);
}

.pagination .page-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--text-primary);
}

.pagination .active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-backdrop.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================================
   Mobile sidebar toggle
   ============================================================ */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .col-md-3 { flex: 0 0 50%; max-width: 50%; }
    .col-md-4 { flex: 0 0 50%; max-width: 50%; }
    .source-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-header {
        padding: 16px;
        padding-left: 64px; /* space for hamburger */
    }
    .content-body { padding: 16px; }
    .col-md-3, .col-md-4, .col-md-6, .col-md-8 { flex: 0 0 100%; max-width: 100%; }
    .source-grid { grid-template-columns: repeat(2, 1fr); }
    .wizard-steps { padding: 0 16px; overflow-x: auto; }
    .wizard-step-label { display: none; }
    .d-flex { flex-wrap: wrap; }
    .progress-stats { grid-template-columns: repeat(2, 1fr); }
    .mapping-row { flex-wrap: wrap; }
    .mapping-source, .mapping-target { flex: 0 0 100%; }
    .mapping-arrow { transform: rotate(90deg); margin: 4px auto; }
}

@media (max-width: 480px) {
    .source-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }
    .btn-lg { padding: 12px 20px; font-size: 14px; }
}
