/*
 * Autofixa Design System — tokens + component library.
 * Source of truth: this file and its sibling copy at
 * src/Autofixa.Identity/wwwroot/css/autofixa-theme.css (duplicated verbatim,
 * per the design-system spec's Q1 — no shared assets project yet).
 * Keep both copies in sync until a third app justifies extracting a shared
 * static-assets package.
 */

:root {
    /* Brand */
    --primary-color: #06192C;
    --teal: #00DBDA;
    --accent-color: #FF4B2E;
    --green: #005961;
    --yellow: #FFE536;

    /* Teal tints — use these, never invent new opacities */
    --teal-tint-60: rgba(0, 219, 218, 0.6);
    --teal-tint-20: rgba(0, 219, 218, 0.2);
    --teal-tint-10: rgba(0, 219, 218, 0.1);

    /* Dark surfaces */
    --surface-0: #06192C;
    --surface-1: #0a2236;
    --surface-2: #0e2d46;

    /* Semantic */
    --success-color: #38a169;
    --warning-color: #d69e2e;
    --danger-color: #e53e3e;
    --light-bg: #f1f4f8;

    /* Grey scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Shape & shadow */
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(6, 25, 44, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(6, 25, 44, 0.1), 0 2px 6px -1px rgba(6, 25, 44, 0.06);
    --shadow-lg: 0 12px 24px -4px rgba(6, 25, 44, 0.12), 0 4px 8px -2px rgba(6, 25, 44, 0.06);

    /* Typography scale */
    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Font stack — system fallback first so a CDN outage degrades typography, not layout */
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--gray-800);
}

/* ---------- Brand motif: subtle "//" diagonal stripe overlay on dark surfaces ---------- */
.brand-motif-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    background-image: repeating-linear-gradient(23deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 2px, transparent 2px, transparent 22px);
}

/*
 * The supplied logo asset renders its wordmark in the brand's own Dark Blue
 * (#06192C), designed for a light background — on a dark surface (sidebar,
 * auth brand panel) it's nearly invisible next to the teal "//" mark. Render
 * it all-white there instead of leaving it illegible.
 */
.logo-on-dark {
    filter: brightness(0) invert(1);
}

/* ---------- 5.1 Page Header ---------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.page-header-subtitle {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin: 0.25rem 0 0;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---------- 5.2 Stats Cards ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* §7 Responsive Breakpoints — explicit column counts rather than relying
   purely on auto-fit's implicit wrapping. */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.stats-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--teal);
    padding: 1.25rem;
}

.stats-card.stat-success { border-top-color: var(--green); }
.stats-card.stat-warning { border-top-color: var(--yellow); }
.stats-card.stat-accent { border-top-color: var(--accent-color); }

.stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stats-number {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stats-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.stats-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--teal-tint-10);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
}

.stat-success .stats-card-icon { background: rgba(0, 89, 97, 0.1); color: var(--green); }
.stat-warning .stats-card-icon { background: rgba(255, 229, 54, 0.15); color: #92720b; }
.stat-accent .stats-card-icon { background: rgba(255, 75, 46, 0.1); color: var(--accent-color); }

/* ---------- 5.3 Tables ---------- */
.table-container {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.table-container .table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.table thead th {
    background: var(--primary-color);
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    font-weight: 600;
    border: none;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    font-size: var(--text-sm);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

@keyframes row-flash-pulse {
    0% { background-color: var(--teal-tint-20); }
    100% { background-color: transparent; }
}

.row-flash {
    animation: row-flash-pulse 1.2s ease-out;
}

/* ---------- 5.4 Cards ---------- */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: none;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    color: var(--primary-color);
    padding: 0.875rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    color: var(--primary-color);
    font-weight: 700;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--gray-200);
    padding: 0.875rem 1.25rem;
}

/* ---------- 5.5 Buttons ---------- */
.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: #e04024;
    border-color: #e04024;
    color: #fff;
}

.btn-outline-primary {
    color: var(--accent-color);
    border-color: var(--accent-color);
}
.btn-outline-primary:hover {
    background-color: var(--accent-color);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-success {
    background-color: var(--green);
    border-color: var(--green);
    color: #fff;
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: #fff;
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}

.btn-info {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}

.btn:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(0, 219, 218, 0.15);
    border-color: var(--teal);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-500);
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.btn-icon-primary:hover {
    color: var(--teal);
    border-color: var(--teal);
}

.btn-icon-danger:hover {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* ---------- 5.6 Status Badges ---------- */
.badge {
    text-transform: uppercase;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.3em 0.65em;
    border-radius: 999px;
    border: 1px solid transparent;
}

.badge-status-new {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

.badge-status-queued {
    background: var(--teal-tint-10);
    color: #007a78;
    border-color: rgba(0, 219, 218, 0.3);
}

.badge-status-processing {
    background: rgba(214, 158, 46, 0.12);
    color: #7a5500;
    border-color: rgba(214, 158, 46, 0.3);
}

.badge-status-done {
    background: rgba(0, 89, 97, 0.1);
    color: var(--green);
    border-color: rgba(0, 89, 97, 0.25);
}

.badge-status-error {
    background: rgba(255, 75, 46, 0.08);
    color: var(--accent-color);
    border-color: rgba(255, 75, 46, 0.25);
}

/* ---------- 5.7 Forms ---------- */
.form-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
}

.form-control, .form-select {
    font-size: var(--text-base);
}

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

.text-danger, .invalid-feedback {
    font-size: var(--text-xs);
    color: var(--accent-color) !important;
}

/* ---------- 5.8 Step Progress ---------- */
.step-progress-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.step-progress .step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.step-progress .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 1px;
    background: var(--gray-300);
    z-index: 0;
}

.step-progress .step.completed:not(:last-child)::after {
    background: var(--teal);
}

.step-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gray-300);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.step.active .step-circle { background: var(--primary-color); }
.step.completed .step-circle { background: var(--teal); }

.step-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: 0.4rem;
}

/* ---------- 5.9 Progress Bars ---------- */
.progress {
    height: 4px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.progress .progress-bar {
    background: var(--teal);
    height: 100%;
}

.progress-upload {
    height: 8px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.progress-upload .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), #38bdf8);
}

/* ---------- 5.10 Alerts ---------- */
.alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    font-size: var(--text-sm);
}

.alert-success { background: rgba(56, 161, 105, 0.08); border-color: rgba(56, 161, 105, 0.25); color: #276749; }
.alert-info { background: var(--teal-tint-10); border-color: rgba(0, 219, 218, 0.25); color: #007a78; }
.alert-warning { background: rgba(214, 158, 46, 0.1); border-color: rgba(214, 158, 46, 0.25); color: #7a5500; }
.alert-danger { background: rgba(229, 62, 62, 0.08); border-color: rgba(229, 62, 62, 0.25); color: #9b2c2c; }

/* ---------- 5.11 Skeleton Loading ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
    background-size: 400% 100%;
    animation: skeleton-wave 1.4s ease infinite;
    border-radius: 4px;
    display: inline-block;
}

@keyframes skeleton-wave {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- 5.12 Animations ---------- */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.4s ease-out; }

@keyframes slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
.slide-up { animation: slide-up 0.5s ease-out; }
