/* If you have a fixed navbar, set this to its height (e.g. 56px) */
:root {
    --sticky-top: 0px;
}

/* ===== Table look (consistent border color) ===== */
.custom-table,
.custom-table thead th,
.custom-table tbody td,
.custom-table tbody th {
    border-color: #111827 !important;
}

/* ===== Sticky header on page scroll ===== */
.sticky-header th {
    position: sticky;
    /* sticks to viewport while page scrolls */
    top: var(--sticky-top);
    z-index: 5;
    background-color: #111827 !important;
    color: #fff !important;
    border-top: 1px solid #111827 !important;
    border-bottom: 1px solid #111827 !important;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;

    /* keep header size stable */
    height: 56px;
    /* fixed header height */
    line-height: 1;
    /* avoid jump from line-height changes */
    vertical-align: middle;
}

/* ===== Body cells ===== */
.custom-table td {
    vertical-align: middle;
    font-size: 0.95rem;
}

.custom-table tbody tr:hover {
    background-color: #f8f9fa !important;
    transition: background-color 0.2s ease-in-out;
}

/* ===== Accordion header row ===== */
.accordion-header-row td {
    padding: 0;
    /* the button owns the padding */
    border-color: #111827 !important;
    /* same border color */
}

.accordion-header-row .accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: none;
    padding: 0 1rem;
    cursor: pointer;
    text-align: left;

    /* keep accordion header size stable (open/close) */
    min-height: 56px;
    /* match table header height */
    height: 56px;
    /* lock it so it never jumps */
}

.accordion-header-row .accordion-toggle:hover {
    background: #e9ecf1;
}

.accordion-header-row .toggle-icon {
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    /* fixed icon box to prevent width shift */
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background: #111827;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.18s ease, background 0.18s ease;
    flex-shrink: 0;
}

.accordion-header-row.active .toggle-icon {
    transform: rotate(90deg);
    background: #111827;
    /* accent when open */
}

/* ===== Smooth open/close (works with your current JS) ===== */
.accordion-body-row {
    display: none;
}

.accordion-body-row.open {
    display: table-row;
}

.accordion-body-row.anim-in {
    animation: dipFadeIn 0.18s ease forwards;
}

.accordion-body-row.anim-out {
    animation: dipFadeOut 0.14s ease forwards;
}

@keyframes dipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dipFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

/* ===== Mobile tweaks ===== */
@media (max-width: 576px) {
    .custom-table td {
        font-size: 0.875rem;
    }

    .sticky-header th {
        font-size: 0.78rem;
        height: 52px;
    }

    .accordion-header-row .accordion-toggle {
        height: 52px;
        min-height: 52px;
    }
}
