/* Row action-icon column — adopted by GridView ActionColumn contentOptions (Phase 2+).
   See docs/css-refactoring.md §8. */
.w5-action-col a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    color: var(--gray-700);          /* was slate #64748b; reconciled to grey ramp per §6 */
    transition: background-color .15s ease, color .15s ease;
}

.w5-action-col a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.w5-action-col a svg {
    width: 15px;
    height: 15px;
}

/* ========================================
   GridView — W5 distinctive style
   (moved from app.css in Phase 2; the container default in config/web.php
   applies .w5-grid to every GridView. See docs/css-refactoring.md §5/§8.)
   ======================================== */

/* Card-like wrapper */
.w5-grid {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 1.5rem;
}

/* Summary text above table */
.w5-grid > .text-muted.small {
    padding: 0.625rem 1rem 0;
}

/* Responsive container inside the wrapper */
.w5-grid > .table-responsive {
    margin: 0;
}

/* Table base */
.w5-grid .table {
    margin-bottom: 0;
    font-size: var(--font-size-sm);
}

/* ---- Header row ---- */
.w5-grid .table > thead > tr > th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-color: var(--primary-dark);
    padding: 0.625rem 0.75rem;
    white-space: nowrap;
    vertical-align: middle;
}

/* Sort links in header */
.w5-grid .table > thead > tr > th a {
    color: var(--white);
    text-decoration: none;
}

.w5-grid .table > thead > tr > th a:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* Sort arrows — white on teal */
.w5-grid .table > thead a.asc:after,
.w5-grid .table > thead a.desc:after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 0 0 1px 5px;
    vertical-align: middle;
}

.w5-grid .table > thead a.asc:after {
    border-bottom: solid 6px var(--white);
    border-top-width: 0;
}

.w5-grid .table > thead a.desc:after {
    border-top: solid 6px var(--white);
    border-bottom-width: 0;
}

/* ---- Filter row ---- */
.w5-grid .table > thead > tr.filters > td {
    background: var(--gray-50);
    padding: 0.375rem 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.w5-grid .table > thead > tr.filters input,
.w5-grid .table > thead > tr.filters select {
    width: 100%;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-800);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.w5-grid .table > thead > tr.filters input:focus,
.w5-grid .table > thead > tr.filters select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 155, 144, 0.15);
}

.w5-grid .table > thead > tr.filters input::placeholder {
    color: var(--gray-700);
    font-style: italic;
}

/* ---- Body rows ---- */
.w5-grid .table > tbody > tr > td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    border-color: var(--gray-200);
}

/* Striped rows — subtle teal tint */
.w5-grid .table-striped > tbody > tr:nth-of-type(odd) > td {
    --bs-table-bg-type: rgba(0, 155, 144, 0.025);
}

/* Hover — teal accent */
.w5-grid .table-hover > tbody > tr:hover > td {
    --bs-table-bg-type: rgba(0, 155, 144, 0.06);
}

/* ---- Checkbox column ---- */
.w5-grid .table input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ---- Action column buttons ---- */
.w5-grid .table .btn-sm {
    padding: 0.2rem 0.45rem;
    font-size: 0.78rem;
    border-radius: 4px;
}

/* ---- Empty state ---- */
.w5-grid .empty {
    padding: 2.5rem 1rem;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
}

/* ---- Pagination area ---- */
.w5-grid > ul.pagination,
.w5-grid > nav > ul.pagination {
    padding: 0.75rem 1rem;
    margin: 0;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.w5-grid .pagination .page-link {
    color: var(--primary);
    border-color: var(--gray-300);
    font-size: var(--font-size-sm);
    padding: 0.35rem 0.65rem;
    transition: all 0.15s ease;
}

.w5-grid .pagination .page-link:hover {
    background: rgba(0, 155, 144, 0.08);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.w5-grid .pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.w5-grid .pagination .page-item.disabled .page-link {
    color: var(--gray-700);
    background: var(--white);
}

/* ---- Mobile adjustments ---- */
@media (max-width: 767.98px) {
    .w5-grid .table {
        font-size: 0.78rem;
    }

    .w5-grid .table > thead > tr > th {
        font-size: 0.72rem;
        padding: 0.5rem;
    }

    .w5-grid .table > tbody > tr > td {
        padding: 0.4rem 0.5rem;
    }

    .w5-grid .table > thead > tr.filters input,
    .w5-grid .table > thead > tr.filters select {
        font-size: 0.75rem;
        padding: 0.25rem 0.375rem;
    }
}
