/* ================================================
   computation.css  — Additive styles only
   Requires: index.css (reset + body) + app.css (tokens + components)
================================================ */

/* ── Layout Tokens ─────────────────────────────── */
:root {
    --header-height: 56px;
    --toolbar-height: 44px;
    --nav-height: 44px;
    --sticky-top-offset: calc(var(--header-height) + var(--toolbar-height));
}

/* ── Toolbar ───────────────────────────────────── */
.qd-toolbar {
    position: sticky;
    top: var(--header-height);
    z-index: 900;
    height: var(--toolbar-height);
    background: #fff;
    border-bottom: 1px solid var(--qd-border) !important;
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
    gap: 8px;
}

.qd-toolbar-nav {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
    /* pushes to right end on desktop */
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    /* allows shrinking without squashing breadcrumb */
    height: 100%;
}

/* ── Section Nav Bar ───────────────────────────── */
.nav-card {
    position: sticky;
    top: var(--sticky-top-offset);
    z-index: 910;
    background: #fff;
    border-bottom: 2px solid var(--qd-border);
    padding: 0;
    margin-bottom: 0;
    box-shadow: none !important;
}

.nav-card .container-fluid {
    padding: 0 20px;
}

.nav-scroll {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-scroll::-webkit-scrollbar {
    display: none;
}

/* Nav toggle buttons */
.section-toggle {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--qd-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    padding: 10px 16px !important;
    white-space: nowrap;
    background: transparent !important;
    transition: color 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.section-toggle:hover {
    color: var(--qd-primary) !important;
    background: var(--qd-primary-soft) !important;
}

.section-toggle.active {
    color: var(--qd-primary) !important;
    border-bottom: 2px solid var(--qd-primary) !important;
    background: var(--qd-primary-soft) !important;
}

/* ── Main Container ────────────────────────────── */
.container-fluid.px-4 {
    padding: 16px 20px !important;
}

/* ── Stat Cards (top row) ──────────────────────── */
.stat-card {
    background: #fff;
    border: 1px solid var(--qd-border);
    box-shadow: none;
    padding: 16px 18px;
    height: 100%;
    transition: border-color 0.18s;
}

.stat-card:hover {
    border-color: var(--qd-primary);
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--qd-muted);
    margin-bottom: 4px;
}

.stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--qd-text);
    margin-bottom: 0;
    line-height: 1.1;
}

.stat-card hr {
    border-color: var(--qd-border);
    opacity: 1;
    margin: 12px 0;
}

/* Type distribution inline text */
.stat-card .d-flex.flex-wrap.gap-3.small {
    font-size: 11px !important;
    font-weight: 600;
    color: var(--qd-muted);
}

.stat-card .d-flex.flex-wrap.gap-3.small .text-dark {
    color: var(--qd-text) !important;
    font-weight: 700;
}

/* Column list */
#columnList {
    font-size: 11px;
    color: var(--qd-muted);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Uploader ──────────────────────────────────── */
.uploader {
    min-height: 110px;
    border: 2px dashed var(--qd-border) !important;
    background: var(--qd-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
}

.uploader:hover,
.uploader.dragover {
    border-color: var(--qd-primary) !important;
    background: rgba(0, 113, 185, 0.06);
}

.uploader .fw-bold.small {
    font-size: 12px;
    color: var(--qd-text);
    margin-top: 4px;
}

#fileInfo {
    font-size: 11px;
    color: var(--qd-muted);
    font-style: italic;
    margin-top: 6px;
    background: var(--qd-bg);
    border: 1px solid var(--qd-border);
    padding: 3px 8px;
    text-align: center;
}

/* ── Section Cards ─────────────────────────────── */
main>section.card {
    background: #fff;
    border: 1px solid var(--qd-border) !important;
    box-shadow: none !important;
    padding: 16px 18px !important;
    margin-bottom: 12px !important;
    transition: border-color 0.18s;
}

main>section.card:hover {
    border-color: var(--qd-primary) !important;
}

main>section.card h5.fw-bold {
    font-size: 12px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--qd-text);
    margin-bottom: 0;
}

/* Section header divider line */
main>section.card .d-flex.justify-content-between,
main>section.card .d-flex.flex-column {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--qd-border);
    margin-bottom: 12px;
}

/* ── Buttons ───────────────────────────────────── */
.btn {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 5px 14px !important;
}

.btn-success {
    background: var(--qd-success) !important;
    border: none !important;
    color: #fff !important;
}

.btn-success:hover {
    background: #196b4a !important;
    color: #fff !important;
}

.btn-primary {
    background: var(--qd-primary) !important;
    border: none !important;
    color: #fff !important;
}

.btn-primary:hover {
    background: var(--qd-primary-dark) !important;
    color: #fff !important;
}

.btn-outline-secondary {
    border: 1px solid var(--qd-border) !important;
    color: var(--qd-muted) !important;
    background: #fff !important;
}

.btn-outline-secondary:hover {
    background: var(--qd-bg) !important;
    color: var(--qd-text) !important;
}

/* ── Form Controls ─────────────────────────────── */
.form-control,
.form-select {
    font-size: 12px !important;
    border: 1px solid var(--qd-border) !important;
    background: #fff !important;
    color: var(--qd-text) !important;
    box-shadow: none !important;
    padding: 5px 8px !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--qd-primary) !important;
    box-shadow: none !important;
}

/* Search input group */
.input-group-text {
    font-size: 12px;
    background: #fff !important;
    border: 1px solid var(--qd-border) !important;
    color: var(--qd-muted);
}

/* ── Tables ────────────────────────────────────── */
.table-responsive {
    max-height: 520px;
    overflow: auto;
    border: 1px solid var(--qd-border) !important;
}

.table {
    font-size: 12px;
    margin-bottom: 0;
}

.table thead th,
.table-preview thead th,
#fieldsSummaryTable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fafbfc !important;
    color: var(--qd-muted);
    font-size: 10px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 9px 12px !important;
    border-bottom: 2px solid var(--qd-border) !important;
    white-space: nowrap;
}

.table tbody td {
    font-size: 12px !important;
    padding: 7px 12px !important;
    vertical-align: middle;
    color: var(--qd-text);
    border-color: var(--qd-border);
    white-space: nowrap;
}

.table-hover tbody tr:hover td {
    background: var(--qd-primary-soft);
}

.table-striped>tbody>tr:nth-of-type(odd)>td {
    background: #fafbfc;
}

/* ── Pagination ────────────────────────────────── */
.pagination-sm .page-link {
    font-size: 11px !important;
    padding: 4px 9px !important;
    border: 1px solid var(--qd-border);
    color: var(--qd-primary);
    background: #fff;
}

.pagination-sm .page-item.active .page-link {
    background: var(--qd-primary) !important;
    border-color: var(--qd-primary) !important;
    color: #fff !important;
}

.pagination-sm .page-link:hover {
    background: var(--qd-primary-soft);
    color: var(--qd-primary);
}

#pageInfo,
#pageInfoValueCounts {
    font-size: 11px;
    color: var(--qd-muted);
    font-weight: 600;
}

/* ── Footer ────────────────────────────────────── */
.qd-footer {
    background: #fff;
    border-top: 1px solid var(--qd-border);
    padding: 10px 20px;
    text-align: center;
    margin-top: 20px;
}

.qd-footer p,
.qd-footer small {
    font-size: 11px;
    color: var(--qd-muted);
    margin: 0;
}

.qd-footer a {
    color: var(--qd-primary);
    font-weight: 600;
    text-decoration: none;
}

.qd-footer a:hover {
    color: var(--qd-primary-dark);
}

/* ── Scrollbars ────────────────────────────────── */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cccccc;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #aaaaaa;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 991px) {

    .qd-toolbar {
        position: relative;
        top: auto;
        flex-wrap: wrap;
        height: auto;
        padding: 8px 14px;
    }

    .qd-header,
    .nav-card {
        position: relative;
        top: auto;
    }

    .nav-card {
        overflow-x: auto;
    }

    .container-fluid.px-4 {
        padding: 12px !important;
    }
}

@media (max-width: 576px) {
    .stat-val {
        font-size: 18px;
    }

    .section-toggle {
        font-size: 10px !important;
        padding: 8px 10px !important;
    }

    main>section.card h5.fw-bold {
        font-size: 11px !important;
    }

    .table thead th {
        font-size: 9px !important;
        padding: 7px 8px !important;
    }

    .table tbody td {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }
}