/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f1117; color: #e2e8f0; font-size: 14px; line-height: 1.5; }

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

/* ─── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar { width: 220px; background: #161b26; border-right: 1px solid #1e2736; display: flex; flex-direction: column; padding: 0; position: fixed; height: 100vh; top: 0; left: 0; z-index: 100; }
.logo { display: flex; align-items: center; gap: 10px; padding: 20px 16px; border-bottom: 1px solid #1e2736; font-weight: 700; font-size: 15px; color: #7c93f5; }
.logo svg { flex-shrink: 0; }
nav { padding: 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #94a3b8; text-decoration: none; transition: all 0.15s; font-size: 13.5px; }
.nav-item:hover { background: #1e2736; color: #e2e8f0; }
.nav-item.active { background: #1e3a5f; color: #60a5fa; font-weight: 600; }
.sidebar-footer { padding: 16px; border-top: 1px solid #1e2736; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn-logout { font-size: 12px; color: #ef4444; text-decoration: none; padding: 4px 8px; border-radius: 6px; border: 1px solid #ef444440; }
.btn-logout:hover { background: #ef444420; }

/* ─── Main Content ─────────────────────────────────────────────────────── */
.main-content { margin-left: 220px; flex: 1; padding: 0 24px 32px; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 16px; gap: 16px; }
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-badge { font-size: 12px; background: #1e2736; padding: 4px 10px; border-radius: 20px; color: #94a3b8; }

/* ─── Stats Grid ───────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #161b26; border: 1px solid #1e2736; border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.blue  { background: #1e3a5f; color: #60a5fa; }
.stat-icon.green { background: #14532d; color: #4ade80; }
.stat-icon.teal  { background: #0d3a3a; color: #2dd4bf; }
.stat-icon.red   { background: #4c0519; color: #f87171; }
.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 12px; color: #64748b; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; }

/* ─── Cards ────────────────────────────────────────────────────────────── */
.card { background: #161b26; border: 1px solid #1e2736; border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #1e2736; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── Forms ────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: #94a3b8; }
.form-control { background: #0f1117; border: 1px solid #2d3748; border-radius: 8px; padding: 8px 12px; color: #e2e8f0; font-size: 13.5px; width: 100%; transition: border 0.15s; }
.form-control:focus { outline: none; border-color: #3b82f6; }
.form-control::placeholder { color: #475569; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; font-family: 'Courier New', monospace; }
.hint { font-size: 11px; color: #64748b; }
.hint-inline { font-size: 11px; color: #64748b; font-weight: 400; }
.duration-hint { font-size: 11px; color: #3b82f6; margin-top: 2px; }
.form-actions { padding: 0 20px 20px; display: flex; gap: 10px; }
.inline-form { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.inline-form label { color: #94a3b8; white-space: nowrap; }
.inline-form .form-control { width: auto; min-width: 280px; }

/* ─── Radio Cards ──────────────────────────────────────────────────────── */
.radio-group { display: flex; gap: 10px; }
.radio-card { display: flex; align-items: center; gap: 10px; background: #0f1117; border: 1px solid #2d3748; border-radius: 8px; padding: 10px 14px; cursor: pointer; flex: 1; transition: border 0.15s; }
.radio-card:has(input:checked) { border-color: #3b82f6; background: #1e3a5f20; }
.radio-card input { accent-color: #3b82f6; }
.radio-content { display: flex; flex-direction: column; }
.radio-content strong { font-size: 13px; }
.radio-content span { font-size: 11px; color: #64748b; }

/* ─── File Drop ────────────────────────────────────────────────────────── */
.file-drop-area { background: #0f1117; border: 2px dashed #2d3748; border-radius: 8px; padding: 24px; text-align: center; cursor: pointer; transition: border 0.15s; }
.file-drop-area.dragover { border-color: #3b82f6; background: #1e3a5f20; }
.file-drop-area svg { color: #475569; margin-bottom: 8px; }
.file-drop-area p { font-size: 13px; color: #64748b; margin-bottom: 4px; }
.link-btn { color: #3b82f6; cursor: pointer; text-decoration: underline; }
.csv-preview { margin-top: 10px; background: #0f1117; border: 1px solid #2d3748; border-radius: 8px; padding: 10px; font-size: 12px; font-family: monospace; max-height: 120px; overflow-y: auto; }

/* ─── Buttons ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 13.5px; font-weight: 500; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger  { background: #dc2626; color: white; }
.btn-danger:hover  { background: #b91c1c; }
.btn-outline { background: transparent; color: #94a3b8; border: 1px solid #2d3748; }
.btn-outline:hover { background: #1e2736; color: #e2e8f0; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Badges ───────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-blue   { background: #1e3a5f; color: #60a5fa; }
.badge-green  { background: #14532d; color: #4ade80; }
.badge-red    { background: #4c0519; color: #f87171; }
.badge-orange { background: #431407; color: #fb923c; }
.badge-gray   { background: #1e2736; color: #64748b; }

/* ─── Tables ───────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid #1e2736; font-size: 13px; }
.data-table th { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; background: #0f1117; }
.data-table tr:hover td { background: #1e273620; }
.empty-row { text-align: center; color: #475569; padding: 32px !important; }
.domain-cell { font-size: 12px; font-family: monospace; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-cell { font-size: 12px; font-family: monospace; color: #94a3b8; }
.mono { font-family: monospace; font-size: 12px; }

/* ─── Log Output ───────────────────────────────────────────────────────── */
.log-output { background: #0a0e16; padding: 12px; max-height: 500px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.6; }
.log-line { padding: 2px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.log-time  { color: #475569; flex-shrink: 0; }
.log-row   { color: #7c93f5; flex-shrink: 0; }
.log-level { flex-shrink: 0; font-weight: 700; }
.log-msg   { flex: 1; word-break: break-all; }
.log-info  .log-level { color: #94a3b8; }
.log-step  .log-level { color: #60a5fa; }
.log-warn  .log-level { color: #fbbf24; }
.log-error .log-level { color: #f87171; }
.log-ip    .log-level { color: #4ade80; }
.log-ip    .log-msg   { color: #4ade80; font-weight: 600; }

/* Log table in dashboard */
.log-container { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.log-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.log-table th { padding: 8px 12px; background: #0f1117; color: #64748b; text-align: left; font-size: 11px; text-transform: uppercase; position: sticky; top: 0; border-bottom: 1px solid #1e2736; }
.log-table td { padding: 6px 12px; border-bottom: 1px solid #1e273640; vertical-align: top; }
.log-table tr:hover td { background: #1e273630; }
.log-cell { max-height: 80px; overflow-y: auto; font-family: monospace; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.status-pending   { background: #1e2736; color: #94a3b8; }
.status-running   { background: #1e3a5f; color: #60a5fa; }
.status-completed { background: #14532d; color: #4ade80; }
.status-failed    { background: #4c0519; color: #f87171; }
.log-controls { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #94a3b8; }

/* ─── Switch ───────────────────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #2d3748; border-radius: 34px; transition: 0.2s; }
.slider::before { content: ''; position: absolute; height: 12px; width: 12px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .slider { background: #3b82f6; }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ─── Progress Bar ─────────────────────────────────────────────────────── */
.progress-bar-wrap { height: 4px; background: #1e2736; border-radius: 2px; margin: 12px 0 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6); border-radius: 2px; transition: width 0.5s; }

/* ─── Job Meta ─────────────────────────────────────────────────────────── */
.job-meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px 20px 0; }
.job-meta-grid > div { display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-size: 11px; color: #64748b; text-transform: uppercase; font-weight: 600; }
.back-link { display: block; font-size: 12px; color: #64748b; text-decoration: none; margin-bottom: 2px; }
.back-link:hover { color: #3b82f6; }

/* ─── Alerts ───────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #14532d40; border: 1px solid #16a34a60; color: #4ade80; }
.alert-error   { background: #4c051940; border: 1px solid #dc262660; color: #f87171; }

/* ─── Login ────────────────────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(ellipse at 60% 40%, #1e3a5f40 0%, #0f1117 70%); }
.login-box { background: #161b26; border: 1px solid #1e2736; border-radius: 16px; padding: 36px; width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo svg { color: #3b82f6; margin-bottom: 10px; }
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p { font-size: 13px; color: #64748b; margin-top: 4px; }
.login-hint { text-align: center; font-size: 12px; color: #475569; margin-top: 14px; }

/* ─── Hidden ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f1117; }
::-webkit-scrollbar-thumb { background: #2d3748; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4f6a; }

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .job-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
}
