/* Table with Filter Styling */

/* Base container positioning */
.position-relative {
    position: relative;
}

/* Table background container */

/* Background image styling */
.bg-image {
    width: 65%;
    height: 65%;
    object-fit: contain;
    transform: scaleX(-1);
}

/* Cards are white with one border, decided in style.css. This sheet used to
   paint them again — three-quarter white with a brown-tinted body inside a
   dark 2px frame — which is why a header never seemed to meet the table under
   it: the table's own white sat on a tinted body. */
.card-body {
    box-shadow: none;
    position: relative;
}

/* Make table transparent */
table.table {
    background-color: transparent;
}

/* Cell styling */
table.table tr td,
table.table tr th {
    background-color: transparent;
}

/* Remove any striping effects */
.table-striped > tbody > tr:nth-of-type(odd),
.table-striped > tbody > tr:nth-of-type(even) {
    background-color: transparent !important;
}

/* Remove hover background color but keep text color */
.table-hover > tbody > tr:hover {
    background-color: transparent !important;
}

.table-hover > tbody > tr:hover > * {
    background-color: transparent !important;
}

.table {
    --bs-table-hover-color: inherit !important;
    --bs-table-hover-bg: transparent !important;
}

/* Table rows styling */
table.table tbody tr {
    background-color: transparent !important;
    border: none !important;
}

/* Table header styling */
table.table thead {
    position: relative;
    z-index: 50;
}

table.table thead tr {
    height: auto;
}

/* Add this to your table_with_filter.css file */

/* One table style for the whole site: the head is a label, not a bar, and a
   row is told apart by a hairline rather than by zebra stripes. */
table.table thead tr th {
    background-color: transparent !important;
    color: var(--dark-light, #7a7c79) !important;
    font-size: var(--fs-micro);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.5rem;
    border-bottom: 2px solid var(--secondary, #e0a491);
}
table.table thead tr th a { color: inherit; }
table.table tbody tr {
    border-bottom: 1px solid var(--gray-200, #e9ecef) !important;
}
table.table tbody tr:last-child { border-bottom: none !important; }
table.table tbody tr:hover,
.table-hover > tbody > tr:hover {
    background-color: var(--gray-100, #f8f9fa) !important;
}
.table-hover > tbody > tr:hover > * { background-color: transparent !important; }

/* A sortable head is still a head: the link takes the column's colour rather
   than announcing itself in olive, which painted half a header row green and
   left the columns you cannot sort by grey. */
table.table thead tr th *,
table.table thead tr th a {
    color: inherit;
}
table.table thead tr th a:hover {
    color: var(--primary);
}

/* Filter section styling */
.filter-section {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid  #e0a491; /* Using --secondary var */
}

/* Filter controls */
.filter-controls .form-control {
    border: 1px solid #5f3f3b; /* Using --primary var */
}

.filter-controls .btn-primary {
    background-color: #5f3f3b; /* Using --primary var */
    border-color: #5f3f3b;
}

.filter-controls .btn-primary:hover {
    background-color: #422a27; /* Using --primary-dark var */
    border-color: #422a27;
}

.filter-controls .btn-secondary {
    background-color: #e0a491; /* Updated to use new --secondary color */
    border-color: #e0a491;
}

.filter-controls .btn-secondary:hover {
    background-color: #3a3c39; /* Using --secondary-dark var */
    border-color: #3a3c39;
}

/* ------------------------------------------------------------------ */
/* Collapsible filters (generic list pages)                            */
/* ------------------------------------------------------------------ */

/* Smooth horizontal scrolling inside the django-tables2 wrapper */
.table-container .table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ */
/* Mobile list/table layout (< 768px)                                  */
/* ------------------------------------------------------------------ */
@media (max-width: 767.98px) {

    /* Collapsed filter panel gets breathing room once expanded */
    .list-filter .list-filter-body {
        margin-top: 0.5rem;
    }
    /* Comfortable tap targets on the filter submit/clear buttons */
    .list-filter form .btn {
        min-height: 40px;
        min-width: 44px;
    }

    /* Compact cells and smaller text */
    .table-responsive > table.table {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    .table-responsive > table.table > :not(caption) > * > th,
    .table-responsive > table.table > :not(caption) > * > td {
        padding: 0.4rem 0.5rem;
    }
    .table-responsive > table.table thead tr {
        height: auto;
    }
    .table-responsive > table.table thead tr th {
        padding-top: 10px;
        padding-bottom: 10px;
        white-space: nowrap;
    }

    /* Sticky first column while scrolling horizontally.
       Backgrounds must be opaque so scrolled columns never bleed through,
       including on the hover state (which is forced transparent above). */
    .table-responsive > table.table > tbody > tr > td:first-child,
    .table-responsive > table.table > tbody > tr > th:first-child,
    .table-responsive > table.table > tfoot > tr > td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background-color: var(--white, #fff) !important; /* opaque: the columns
                                    scrolling under it must not bleed through */
        box-shadow: inset -2px 0 0 rgba(95, 63, 59, 0.15),
                    6px 0 8px -6px rgba(66, 42, 39, 0.25);
    }
    .table-hover > tbody > tr:hover > td:first-child,
    .table-hover > tbody > tr:hover > th:first-child {
        background-color: var(--gray-100, #f8f9fa) !important; /* opaque hover tint */
    }
    .table-responsive > table.table > thead > tr > th:first-child {
        position: sticky;
        left: 0;
        z-index: 3; /* above the body's sticky cells */
        /* The head is no longer a filled bar, so it needs its own opaque
           background for the same reason the body cells do. */
        background-color: var(--white, #fff) !important;
        box-shadow: 6px 0 8px -6px rgba(66, 42, 39, 0.35);
    }

    /* Icon action links in table cells: ~40px tap targets */
    .table-responsive > table.table td a:has(> i[class*="fa-"]),
    .table-responsive > table.table td a:has(> i.bi) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 40px;
        padding: 0.25rem;
    }
    .table-responsive > table.table td a.me-2:has(> i[class*="fa-"]) {
        margin-right: 0.25rem !important;
    }

    /* Pagination: centered, wrapping, large tap targets */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    .pagination .page-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

