/* ABAC Demo — giao diện trung tính */

/* ---------- CSS Variables ---------- */
:root {
    --primary: #1a56db;
    --primary-light: #e8effc;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* ---------- Header ---------- */
.header {
    background: #111827;
    color: #f9fafb;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid #1f2937;
}
.header-inner { max-width: 1400px; margin: 0 auto; }
.header h1 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
.header-meta {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin-top: 0.2rem;
    font-weight: 400;
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 0.75rem;
}
.tab {
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-700);
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--gray-900); }
.tab.active {
    color: var(--gray-900);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ---------- Layout ---------- */
.content { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- Card ---------- */
.card {
    background: white;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    box-shadow: none;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--gray-700); }
.card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; color: var(--gray-700); }

/* ---------- Grid System ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ---------- Form Elements ---------- */
label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}
select, input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
select:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

/* ---------- Buttons ---------- */
.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1448b8; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }

/* ---------- Table ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
th {
    background: var(--gray-100);
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.75rem;
}
td {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--gray-200);
}
tr:hover td { background: var(--gray-50); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-permit { background: var(--success-light); color: var(--success); }
.badge-deny { background: var(--danger-light); color: var(--danger); }
.badge-active { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--danger-light); color: var(--danger); }
.badge-suspended { background: var(--warning-light); color: var(--warning); }
.badge-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    vertical-align: middle;
}
.badge-suffix {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.15rem;
    padding-left: 0.35rem;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}
.badge-deny .badge-suffix { border-left-color: rgba(220, 38, 38, 0.2); }
.badge-permit .badge-suffix { border-left-color: rgba(22, 163, 74, 0.2); }
.badge-suffix-text {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.92;
}

/* ---------- Inline SVG icons ---------- */
.ui-icon {
    display: inline-block;
    vertical-align: -0.15em;
    flex-shrink: 0;
}
.ui-icon--sm { width: 14px; height: 14px; vertical-align: -0.1em; }

/* ---------- Result Box ---------- */
.result-box {
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 4px solid;
}
.result-permit { background: var(--success-light); border-color: var(--success); }
.result-deny { background: var(--danger-light); border-color: var(--danger); }
.result-box h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.result-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}
.result-permit .result-title .ui-icon { color: var(--success); }
.result-deny .result-title .ui-icon { color: var(--danger); }
.result-detail { font-size: 0.9rem; margin-top: 0.5rem; }
.result-detail span { font-weight: 600; }

/* ---------- Classification Level Colors ---------- */
.cl-1 { color: #16a34a; }
.cl-2 { color: #2563eb; }
.cl-3 { color: #d97706; }
.cl-4 { color: #dc2626; }
.cl-5 { color: #7c3aed; }

/* ---------- Stat Cards ---------- */
.stat-card {
    text-align: center;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    box-shadow: none;
}
.stat-card .value { font-size: 2rem; font-weight: 700; }
.stat-card .label { font-size: 0.8rem; color: var(--gray-500); }

.hint-security {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    line-height: 1.45;
}
.admin-token-bar { margin-bottom: 1rem; max-width: 32rem; }
.admin-token-bar label code { font-size: 0.75rem; }

/* ---------- Performance benchmark tab ---------- */
.perf-status {
    font-size: 0.85rem;
    color: var(--gray-700);
    line-height: 1.5;
    padding: 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}
.perf-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
}
.perf-preset-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    min-width: 12rem;
    cursor: pointer;
}
.perf-preset-meta { font-size: 0.75rem; color: var(--gray-500); }
.lt-config-forecast {
    cursor: default;
    font-style: italic;
    background: var(--gray-50);
    border-style: dashed;
}
.lt-config-forecast input { cursor: not-allowed; }
.perf-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.perf-progress {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.85rem;
}
.perf-progress-active { border-color: var(--primary); }
.perf-progress-done {
    border-color: var(--success);
    background: #f0fdf4;
}
.perf-progress-error {
    border-color: var(--danger);
    background: #fef2f2;
}
.perf-progress-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.perf-progress-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: perf-spin 0.8s linear infinite;
    flex-shrink: 0;
}
.perf-progress-done .perf-progress-spinner,
.perf-progress-error .perf-progress-spinner { display: none; }
@keyframes perf-spin { to { transform: rotate(360deg); } }
.perf-progress-track {
    height: 0.65rem;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}
.perf-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    background-size: 1.5rem 1.5rem;
    transition: width 0.4s ease;
    animation: perf-bar-stripe 1s linear infinite;
}
.perf-progress-done .perf-progress-fill {
    background: var(--success);
    animation: none;
}
.perf-progress-error .perf-progress-fill {
    background: var(--danger);
    animation: none;
}
@keyframes perf-bar-stripe {
    0% { background-position: 0 0; }
    100% { background-position: 1.5rem 0; }
}
.perf-progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--gray-600);
}
.perf-progress-step {
    margin: 0.6rem 0 0;
    color: var(--gray-800);
    font-weight: 500;
}
.perf-progress-hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--gray-500);
}
.perf-results-table td:nth-child(3) { font-variant-numeric: tabular-nums; }
.perf-compare-table th,
.perf-compare-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.perf-compare-ratio { font-size: 0.75rem; color: var(--gray-500); font-weight: normal; }
.lt-forecast-row td { color: var(--gray-600); font-style: italic; }
.perf-ok { color: var(--success); font-weight: 600; }
.perf-bad { color: var(--danger); font-weight: 600; font-size: 0.85rem; }

/* ---------- Pager (PIP tables) ---------- */
.pager-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}
.pager-per-label { font-size: 0.8rem; color: var(--gray-500); }
.pager-meta {
    font-size: 0.85rem;
    color: var(--gray-700);
    margin: 0.5rem 0 0.25rem;
}
.pager-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.pager-goto-label { font-size: 0.8rem; color: var(--gray-500); }

/* ---------- Misc ---------- */
#loading {
    display: none;
    color: var(--gray-500);
    font-style: italic;
    margin: 1rem 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .tabs { overflow-x: auto; }
}
