/* ═══════════════════════════════════════════════════
   B24 Migration Orchestrator — Admin Panel Styles
   ═══════════════════════════════════════════════════ */

:root {
    --bg: #0b0e14;
    --bg-card: #141821;
    --bg-hover: #1a1f2e;
    --bg-input: #0f1219;
    --border: #1e2535;
    --border-active: #4f8cff;
    --text: #e2e6f0;
    --text-muted: #7a829a;
    --text-label: #5a6178;
    --accent: #4f8cff;
    --accent-hover: #6fa0ff;
    --accent-glow: rgba(79, 140, 255, 0.12);
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --gradient: linear-gradient(135deg, #4f8cff 0%, #845ef7 100%);
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, sans-serif;
    --transition: 0.2s ease;
    --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

/* ─── Sidebar ─────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 240px;
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.2s ease;
}

/* ─── Sidebar Toggle Row ─────────────────────────── */
.sidebar-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.logo-texts { overflow: hidden; min-width: 0; }
.logo-icon  { font-size: 26px; flex-shrink: 0; }
.logo-title { font-size: 14px; font-weight: 700; white-space: nowrap; }
.logo-sub   { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ─── Sidebar Toggle Button ──────────────────────── */
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all var(--transition);
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}
.sidebar-toggle:hover { color: var(--text); background: var(--bg-hover); }

/* Collapsed sidebar */
.sidebar.collapsed { width: 56px; overflow: hidden; }

.sidebar.collapsed .sidebar-toggle-row {
    justify-content: center;
    padding: 14px 8px;
}
.sidebar.collapsed .sidebar-brand { display: none; }
.sidebar.collapsed .nav-label      { display: none; }
.sidebar.collapsed .nav-item       { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-icon       { width: auto; }
.sidebar.collapsed .version-current { display: none; }
.sidebar.collapsed .update-badge    { display: none !important; }

/* ─── Sidebar Nav + Footer ───────────────────────── */
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item:hover  { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--accent); background: var(--accent-glow); font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 10px 8px 12px;
    border-top: 1px solid var(--border);
}

.sidebar-version-block {
    padding: 8px 12px 4px;
    font-size: 11px;
    color: var(--text-label);
}
.version-current { font-size: 11px; color: var(--text-label); }

.update-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--warning);
    margin-top: 4px;
    cursor: pointer;
    padding: 3px 6px;
    background: rgba(245,158,11,0.1);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245,158,11,0.25);
}

/* ─── Main Content ────────────────────────────────── */
.main {
    margin-left: 240px;
    margin-left: var(--sidebar-w);
    padding: 24px 32px 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 22px; font-weight: 800; }
.header-actions { display: flex; gap: 8px; }

/* ─── Cards ───────────────────────────────────────── */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition);
}
.status-card:hover { border-color: var(--border-active); transform: translateY(-2px); }

.sc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sc-icon { font-size: 18px; }
.sc-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; flex: 1; }
.sc-status { font-size: 14px; }
.sc-value { font-size: 13px; color: var(--text); word-break: break-all; }

/* ─── Alerts ──────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}
.alert a { color: inherit; font-weight: 600; }
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: var(--success); }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); color: var(--warning); }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: var(--error); }

/* ─── Section ─────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section h2 { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.subsection { margin-top: 20px; }
.subsection h4 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; }

/* ─── Migration Status Card ──────────────────────── */
.migration-status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.ms-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ms-id { font-weight: 700; font-size: 15px; }
.ms-date { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.ms-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.ms-pending { background: rgba(122,130,154,.15); color: var(--text-muted); }
.ms-preflight { background: rgba(59,130,246,.15); color: var(--info); }
.ms-running { background: rgba(245,158,11,.15); color: var(--warning); }
.ms-paused { background: rgba(168,85,247,.15); color: #a855f7; }
.ms-done { background: rgba(34,197,94,.15); color: var(--success); }
.ms-error { background: rgba(239,68,68,.15); color: var(--error); }

.ms-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ms-pct { font-weight: 700; font-size: 18px; min-width: 50px; }
.ms-stats { display: flex; gap: 20px; font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.ms-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ─── Progress Bar ────────────────────────────────── */
.progress-bar, .cp-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    flex: 1;
}
.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ─── Checkpoint List ─────────────────────────────── */
.checkpoint-list { margin-top: 10px; }
.cp-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}
.cp-icon { width: 20px; text-align: center; }
.cp-entity { min-width: 100px; font-weight: 500; }
.cp-count { min-width: 80px; color: var(--text-muted); font-size: 12px; }
.cp-pct { min-width: 40px; text-align: right; font-weight: 600; font-size: 12px; }

/* ─── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(79,140,255,.4); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-glow); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Forms ───────────────────────────────────────── */
.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    transition: border-color var(--transition);
    outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder { color: var(--text-label); }
.input-sm { padding: 6px 10px; font-size: 12px; width: auto; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-group-sm { max-width: 100px; }
.form-hint { font-size: 11px; color: var(--text-label); margin-top: 4px; }
.form-hint code { background: var(--bg-hover); padding: 2px 6px; border-radius: 3px; font-size: 11px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.settings-section h3 { margin-bottom: 6px; }
.section-desc { color: var(--text-muted); font-size: 12px; margin-bottom: 14px; }

.test-result { font-size: 13px; margin-left: 10px; }

/* ─── Data Table ──────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--bg-card); }

/* ─── Logs Table ──────────────────────────────────── */
.filters-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.logs-container { max-height: 600px; overflow-y: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.log-badge { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.log-info { background: rgba(59,130,246,.15); color: var(--info); }
.log-warn { background: rgba(245,158,11,.15); color: var(--warning); }
.log-error { background: rgba(239,68,68,.15); color: var(--error); }
.log-debug { background: rgba(122,130,154,.15); color: var(--text-muted); }
.log-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.log-msg { word-break: break-word; }

/* ─── Entity Grid ─────────────────────────────────── */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.entity-check {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.entity-check:hover { border-color: var(--accent); }
.entity-check input { accent-color: var(--accent); }

/* ─── Checks Grid ─────────────────────────────────── */
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.check-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.check-ok { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2); }
.check-fail { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); }
.check-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); }

/* ─── Empty State ─────────────────────────────────── */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state .btn { margin-top: 12px; }

/* ─── Login ───────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 380px;
    text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-card h1 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-form { text-align: left; margin-bottom: 16px; }
.login-hint { font-size: 11px; color: var(--text-label); }

/* ─── Toast ───────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    z-index: 9999;
    animation: slideUp 0.3s ease;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

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

/* ─── Code Block ──────────────────────────────────── */
.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-muted);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    tab-size: 2;
}

.alert ul { list-style: disc; }
.alert strong { font-weight: 700; }
.alert code { background: rgba(0,0,0,.2); padding: 1px 5px; border-radius: 3px; font-size: 11px; }

/* ─── Page Footer ─────────────────────────────────── */
.page-footer {
    margin-top: auto;
    padding: 24px 0 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-label);
}

.footer-legal { flex: 1; min-width: 200px; }
.footer-legal a { color: var(--text-muted); text-decoration: none; }
.footer-legal a:hover { color: var(--accent); }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
}
.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }
.footer-ver { color: var(--text-label); }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 56px; }
    .sidebar .sidebar-brand,
    .sidebar .nav-label,
    .sidebar .version-current { display: none; }
    .sidebar .sidebar-toggle-row { justify-content: center; padding: 14px 8px; }
    .sidebar .nav-item { justify-content: center; padding: 10px; }
    .main { margin-left: 56px; padding: 16px; }
    .cards-row { grid-template-columns: 1fr; }
}

