/* The Lokdhara Brand Table System
   Brand Palette: Red (#C82822), Black (#111111), White (#FFFFFF)
*/

.ld-table-system-wrapper {
    margin: 24px 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 4px solid #C82822;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    font-family: inherit;
}

/* Top Utility Bar (Search + Count) */
.ld-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.ld-table-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #111111;
}

.ld-table-badge::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #C82822;
    border-radius: 50%;
}

.ld-table-search {
    padding: 7px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    outline: none;
    width: 240px;
    max-width: 100%;
    color: #111111;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ld-table-search:focus {
    border-color: #C82822;
    box-shadow: 0 0 0 2px rgba(200, 40, 34, 0.15);
}

/* Horizontal Scroll Container for Mobile */
.ld-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Reset pasted inline widths/heights and Tailwind junk */
.ld-table-scroll table {
    width: 100% !important;
    height: auto !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
}

/* Table Header (Black with Red Bottom Border) */
.ld-table-scroll table thead th,
.ld-table-scroll table tr:first-child th {
    background-color: #111111 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-align: left !important;
    padding: 13px 16px !important;
    border-bottom: 3px solid #C82822 !important;
    border-right: 1px solid #2b2b2b !important;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.ld-table-scroll table thead th:last-child {
    border-right: none !important;
}

.ld-table-scroll table thead th:hover {
    background-color: #222222 !important;
}

/* Sort Indicator */
.ld-table-scroll table thead th::after {
    content: " ⇅";
    font-size: 11px;
    opacity: 0.55;
    margin-left: 4px;
}

.ld-table-scroll table thead th.ld-sort-asc::after {
    content: " ▲";
    opacity: 1;
    color: #C82822;
}

.ld-table-scroll table thead th.ld-sort-desc::after {
    content: " ▼";
    opacity: 1;
    color: #C82822;
}

/* Table Cells */
.ld-table-scroll table tbody td,
.ld-table-scroll table td {
    padding: 12px 16px !important;
    border-bottom: 1px solid #e5e7eb !important;
    border-right: 1px solid #f1f5f9 !important;
    color: #1a1a1a !important;
    vertical-align: middle !important;
}

.ld-table-scroll table tbody td:last-child {
    border-right: none !important;
}

/* Zebra Striping */
.ld-table-scroll table tbody tr:nth-child(even) {
    background-color: #f9fafb !important;
}

/* Hover Highlight in Subtle Lokdhara Red */
.ld-table-scroll table tbody tr:hover {
    background-color: #fff1f0 !important;
    transition: background-color 0.15s ease;
}

/* First column emphasis */
.ld-table-scroll table tbody td:first-child {
    font-weight: 600 !important;
    color: #111111 !important;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .ld-table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .ld-table-search {
        width: 100%;
    }
    .ld-table-scroll table {
        font-size: 14px !important;
    }
    .ld-table-scroll table thead th,
    .ld-table-scroll table tbody td {
        padding: 10px 12px !important;
    }
}