/*
 * Project overrides on top of the Tabler theme's Atlas skin.
 *
 * The default Backpack look (glass + fuzzy mesh) was too busy for this panel.
 * Atlas already tones the palette down; this file gives the canvas a slightly
 * darker, quiet grey so the white cards read as the working surface.
 */

body {
    background-color: #e8edf3;
}

[data-bs-theme="dark"] body {
    background-color: #151c26;
}

/* Hairline instead of heavy shadows around the content cards. */
.card {
    border-color: rgba(26, 31, 54, 0.08);
    box-shadow: 0 1px 2px rgba(26, 31, 54, 0.04);
}

/* Dashboard shortcut cards: whole card clickable, no underline on hover. */
.dashboard-shortcut {
    text-decoration: none;
    color: inherit;
}

.dashboard-shortcut:hover {
    border-color: rgba(26, 31, 54, 0.22);
}

/*
 * Backpack forces a permanent body scrollbar to avoid flicker on AJAX pages.
 * Our pages are viewport-sized, so only show the scrollbar when it is needed.
 */
body {
    overflow-y: auto;
    scrollbar-gutter: auto;
}

/*
 * Scanning screens (wydanie / wydanie_exp): fill the viewport, keep the two
 * cards side by side, scroll each table independently, pin the footer buttons.
 */
body.scan-page,
body.scan-page .page,
body.scan-page .page-wrapper {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

body.scan-page .page-wrapper {
    display: flex;
    flex-direction: column;
}

body.scan-page .page-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.scan-page .page-body > main {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

body.scan-page .page-body > main > .container-fluid.animated {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.scan-page .flex-form {
    flex: 1 1 0;
    min-height: 0;
}

.flex-form .scan-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.flex-form .scan-toolbar .input-group {
    flex: 1 1 auto;
    max-width: 32rem;
}

.flex-form .scan-toolbar .scan-package {
    flex: 0 0 auto;
    max-width: 9rem;
}

.flex-form .scan-toolbar #message_object {
    flex: 1 1 auto;
    margin-bottom: 0;
    height: 2.5rem;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    overflow: hidden;
}

/*
 * The message box reserves its space but stays invisible until message() or
 * okMessage() adds alert-danger / alert-success.
 */
.flex-form .scan-toolbar #message_object:not(.alert-danger):not(.alert-success) {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.flex-form .scan-columns {
    display: flex;
    gap: 1rem;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.flex-form .scan-card {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden !important;
}

.flex-form .scan-card .card-header {
    flex: 0 0 auto;
}

.flex-form .scan-card .card-body,
#ctodo,
#cdone {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
}

.flex-form .scan-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0 !important;
    padding-top: 0.5rem;
}

/*
 * Export-order "Wczytane" table: each PACKAGE is its own <tbody class="tbdone">.
 * Draw a strong separator between packages so the grouping is obvious.
 */
#tdone tbody.tbdone:not(:first-of-type) > tr:first-child > td {
    border-top: 3px double var(--tblr-primary, #2563eb);
    padding-top: 0.75rem;
}

#tdone tbody.tbdone:not(:first-of-type) > tr:first-child > td:first-child {
    font-weight: 600;
}

/* Keep the scan-card counters readable on the danger/primary badges. */
.scan-card .card-header .badge {
    color: #ffffff !important;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .flex-form .scan-columns {
        flex-direction: column;
    }
}

/*
 * List pages: keep the heading and the DataTables search box on one line, with
 * the search pushed to the right. The search stack is moved into the header by
 * resources/views/admin/partials/header-search.blade.php.
 */
section[bp-section="page-header"] {
    flex-wrap: nowrap;
    gap: 0.75rem;
}

/* The stock-report heading is a sentence, not a title: keep its casing. */
section[bp-section="page-header"] h1[bp-section="page-heading"] {
    text-transform: none;
    white-space: nowrap;
}

section[bp-section="page-header"] .datatable_search_stack.header-search {
    width: 22rem;
    max-width: 45vw;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Filter controls live in the header line too. */
section[bp-section="page-header"] .admin-filters.header-filters {
    margin: 0;
    flex-wrap: nowrap;
}

section[bp-section="page-header"] .admin-filters.header-filters .form-select {
    width: 9.5rem;
    min-width: 8rem;
}

/* The DataTables info text duplicates the table footer; drop it from the header. */
section[bp-section="page-header"] p[bp-section="page-subheading"] {
    display: none;
}

@media (max-width: 991.98px) {
    section[bp-section="page-header"] {
        flex-wrap: wrap;
    }

    section[bp-section="page-header"] .admin-filters.header-filters {
        width: 100%;
    }

    section[bp-section="page-header"] .datatable_search_stack.header-search {
        width: 100%;
        max-width: none;
    }
}

/* Compact inline filters above list tables (replaces full-width columns). */
.admin-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-filter .form-label {
    margin: 0;
    white-space: nowrap;
    font-size: 0.875rem;
}

.admin-filter .form-select {
    width: 11rem;
    min-width: 9rem;
}
