/**
 * Accessible Tables Baseline Layout Stylesheet
 * * Focuses on structural integrity, responsive mechanics, and WCAG AA compliance features.
 */

/* Main Wrapper Configuration */
.accessible-table-wrapper {
    width: 100%;
}

/* 1. Symmetric Top Utility Header Bar */
.accessible-table-utility-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Action Buttons Container Zone - Prevents structural vertical stretching */
.accessible-table-download-zone {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

/* Integrated Institutional Action Buttons Styles - Height explicitly locked */
.btn-accessible-download,
.btn-accessible-fullscreen,
.btn-close-fullscreen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px; /* Explicit matching height constraints */
    padding: 0 16px; /* Horizontal layout padding only */
    box-sizing: border-box !important;
    line-height: 1 !important;
    margin: 0 !important;
    background-color: #f1f5f9;
    color: #1e293b !important;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-accessible-download:hover, .btn-accessible-download:focus,
.btn-accessible-fullscreen:hover, .btn-accessible-fullscreen:focus {
    background-color: #e2e8f0;
    border-color: #94a3b8;
}

/* Institutional Danger/Alert Color Mapping for Close Action Button */
.btn-close-fullscreen {
    display: none; /* Embedded hidden inside standard baseline rendering context views */
    background-color: #ef4444;
    color: #ffffff !important;
    border-color: #dc2626;
}

.btn-close-fullscreen:hover, .btn-close-fullscreen:focus {
    background-color: #dc2626;
    border-color: #b91c1c;
}

/* Utilities Search Box Zone - Aligned perfectly flush right */
.accessible-table-search-box {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.accessible-table-search-box label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.accessible-table-search-box input.search {
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    max-width: 240px;
    margin: 0;
    box-sizing: border-box;
}

/* 2. Responsive Horizontal Scroll Container Context */
.accessible-table-grid-wrapper {
    position: relative;
    width: 100%;
}

.accessible-table-scroll-container {
    overflow-x: auto !important; /* Preserves responsive horizontal column sliding */
    overflow-y: hidden !important; /* Absolute prohibition of internal vertical scrollbars */
    width: 100%;
    display: block;
    margin-bottom: 2rem;
    -webkit-overflow-scrolling: touch;
    position: relative;
    height: auto !important; /* Forces the box to expand to 100% of rows height */
    max-height: none !important;
}

.accessible-table-scroll-container:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* 3. Base Data Grid Structural Blueprint Matrix via Cells */
.accessible-data-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    text-align: left;
    font-size: 14px;
    border: none;
}

/* Floating Caption Typography */
.accessible-data-table caption {
    caption-side: top;
    text-align: left;
    font-size: 1.6rem;
    font-weight: bold;
    padding-bottom: 1.2rem;
    color: #111827;
}

.accessible-data-table th, 
.accessible-data-table td {
    padding: 14px 16px;
    white-space: nowrap;
}

/* Frame grid boundaries construction parameters */
.accessible-data-table tbody tr td { border-bottom: 1px solid #e2e8f0; }
.accessible-data-table th:first-child, .accessible-data-table td:first-child { border-left: 1px solid #cbd5e0; }
.accessible-data-table th:last-child, .accessible-data-table td:last-child { border-right: 1px solid #cbd5e0; }

.accessible-data-table th {
    background-color: #f8fafc;
    color: #1e293b;
    font-weight: bold;
    border-top: 1px solid #cbd5e0;
    border-bottom: 2px solid #cbd5e0;
}

.accessible-data-table tbody tr:last-child td { border-bottom: 1px solid #cbd5e0; }

/* Corner profiles border radii configurations */
.accessible-data-table th:first-child { border-top-left-radius: 6px; }
.accessible-data-table th:last-child { border-top-right-radius: 6px; }
.accessible-data-table tbody tr:last-child td:first-child { border-bottom-left-radius: 6px; }
.accessible-data-table tbody tr:last-child td:last-child { border-bottom-right-radius: 6px; }

.accessible-data-table tbody tr.zebra-even { background-color: #f8fafc; }

/* 4. High-Specificity Interactive Cross-Hair Highlighting Overrides */
.accessible-data-table tbody tr:hover td { 
    background-color: #bae6fd !important; /* Vivid row tracking hue tint */
}
.accessible-data-table th.hover-col, 
.accessible-data-table td.hover-col { 
    background-color: #e0f2fe !important; /* Distinct vertical column tracing spectrum */
}
.accessible-data-table tbody tr:hover td.hover-col {
    background-color: #38bdf8 !important; /* Deep target alignment intersection coordinate */
    color: #0f172a !important; 
}

/* 5. List.js Dynamic Pagination Control Nav Links */
.accessible-table-pagination-nav {
    margin-top: 1.5rem;
    text-align: right;
}

.accessible-table-pagination-nav ul.pagination {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
}

.accessible-table-pagination-nav ul.pagination li a {
    display: inline-block;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    line-height: 24px;
    text-align: center;
    background-color: #ffffff;
    color: #2d3748 !important;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.accessible-table-pagination-nav ul.pagination li a:hover,
.accessible-table-pagination-nav ul.pagination li a:focus {
    background-color: #edf2f7;
}

.accessible-table-pagination-nav ul.pagination li.active a {
    background-color: #005fcc !important;
    color: #ffffff !important;
    border-color: #005fcc;
    font-weight: bold;
    cursor: default;
}

/* 6. True Document-Root Teleported Fullscreen Lightbox Canvas */
.accessible-table-wrapper.is-lightbox-active {
    position: absolute !important; /* Allows organic document flow lengthening instead of viewport locking */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    min-height: 100vh !important;
    height: auto !important; /* Lightbox expands completely down to the final pagination rows natively */
    background-color: #ffffff !important;
    z-index: 999999 !important;
    padding: 40px !important;
    box-sizing: border-box !important;
    display: block !important; 
}

/* FIX: Absolute isolation shield rule. Shuts down and completely masks all background direct children elements */
body.accessible-table-lightbox-open > *:not(.accessible-table-wrapper.is-lightbox-active) {
    display: none !important;
}

/* Contextual swap of the triggers directly inline inside the matching slot location */
.is-lightbox-active .btn-accessible-fullscreen { 
    display: none !important; 
}
.is-lightbox-active .btn-close-fullscreen { 
    display: inline-flex !important; 
}

.accessible-table-wrapper .text-right { text-align: right !important; }