/* 
   LightImport Enterprise v18 - Premium Design System
   Theme: Midnight Slate & Indigo
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    /* Core Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.1);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    
    /* Neutral / Surfaces */
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --border: #334155;
    
    --text: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 10px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, .app-brand {
    font-family: 'Outfit', sans-serif;
}

/* --- Scrollbars --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Layout --- */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- Toolbar --- */
.app-toolbar {
    height: 72px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
}

.app-brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.app-brand span {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 0.8rem;
    margin-left: 4px;
    padding: 2px 6px;
    border-radius: 6px;
    background-color: var(--primary-light);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.batch-control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 72px; /* Matches toolbar height */
    margin-top: 10px;
}

.batch-control-group input {
    height: 32px !important;
}

#batchSuggestion {
    font-size: 0.6rem;
    color: var(--primary);
    font-weight: 700;
    height: 12px;
    margin-top: 2px;
}

/* --- Forms & Controls --- */
select, input:not([type="checkbox"]), .btn {
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    outline: none;
}

select:focus, input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover {
    background: var(--surface-light);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid var(--error);
}
.btn-danger:hover {
    background: var(--error);
    color: white;
}

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

.btn-xs {
    padding: 2px 8px;
    font-size: 0.65rem;
    border-radius: 4px;
}

/* --- Switch Toggle --- */
.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.switch-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.switch {
    position: relative;
    width: 36px;
    height: 20px;
}

.switch input { display: none; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface-light);
    border-radius: 34px;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* --- Tabs --- */
.app-tabs {
    padding: 0 32px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

/* --- Content Areas --- */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-panel.active {
    display: block;
}

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

/* --- Cards & Status --- */
.success-summary-card {
    background: linear-gradient(135deg, var(--surface), #1e293b);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.success-summary-card h2 {
    font-size: 2.5rem;
    margin-bottom: 32px;
    background: linear-gradient(to right, white, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.count-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.count-item {
    background: rgba(15, 23, 42, 0.3);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.count-item span {
    font-size: 3.5rem;
    font-weight: 800;
    display: block;
    line-height: 1;
    margin-bottom: 8px;
    font-family: 'Outfit';
}

.count-item.success span { color: var(--success); }
.count-item.error span { color: var(--error); }

.count-item p {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* --- History Table --- */
.panel-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.history-search-group {
    display: flex;
    gap: 12px;
    flex: 1;
}

.history-search-group input {
    flex: 1;
    max-width: 300px;
}

.table-scroll {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    background: var(--surface-light);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.status-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-tag.completed { background: var(--success-light); color: var(--success); }
.status-tag.failed { background: var(--error-light); color: var(--error); }
.status-tag.started { background: var(--primary-light); color: var(--primary); }
.status-tag.dry_run_done { background: var(--warning-light); color: var(--warning); }

.badge {
    background: var(--surface-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--surface);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 300px;
    animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

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

/* --- Empty States --- */
.empty-state {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--text-muted);
    border: 2px dashed var(--border);
    border-radius: 20px;
    margin-top: 40px;
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }

.hidden { display: none !important; }

/* --- Modal System --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--surface);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-box h3 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.modal-box p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 24px;
}

.modal-box input {
    width: 100%;
    margin-bottom: 24px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions .btn {
    flex: 1;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}