/* Tables - Universal Modern Design */

/* Table Responsive Wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Base Table Styles */
.table,
.zebra-striped {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
    font-family: metropolisregular, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.table thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table thead th a {
    color: #374151;
    text-decoration: none;
}

.table thead th a:hover {
    color: #67a552;
}

.table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: #f9fafb;
}

.table tbody td {
    padding: 16px;
    color: #4b5563;
}

.table tbody td a {
    color: #67a552;
    text-decoration: none;
    font-weight: 500;
}

.table tbody td a:hover {
    text-decoration: underline;
}

/* Table Modifiers */

/* Striped Tables */
.table-striped tbody tr:nth-child(odd) {
    background: #ffffff;
}

.table-striped tbody tr:nth-child(even) {
    background: #f9fafb;
}

.table-striped tbody tr:hover {
    background: #f3f4f6;
}

/* Bordered Tables */
.table-bordered,
.table-bordered th,
.table-bordered td {
    border: 1px solid #e5e7eb;
}

.table-bordered thead th {
    border-bottom-width: 2px;
}

/* Framed Tables */
.table-framed {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 8px 40px rgba(0, 0, 0, 0.08);
}

.table-framed thead th:first-child {
    border-top-left-radius: 8px;
}

.table-framed thead th:last-child {
    border-top-right-radius: 8px;
}

/* Centered Table */
.table-centered tbody td {
    text-align: center;
}

.table-centered thead th {
    text-align: center;
}

/* Text center utility for table cells */
.table .text-center,
.table .textcenter {
    text-align: center;
}

/* Checkbox alignment in tables */
.table thead th input[type="checkbox"],
.table tbody td input[type="checkbox"] {
    vertical-align: middle;
    margin: 0;
}

/* Horizontal Table (label-value pairs) */
.table-horizontal tbody tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-horizontal tbody td:first-child {
    font-weight: 600;
    color: #374151;
}

.table-horizontal tbody td:last-child {
    text-align: right;
}

/* Table Title */
.table_title {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 8px 40px rgba(0, 0, 0, 0.08);
}

.table_title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table_title h3 i {
    color: #67a552;
}

.table_title .searchbox2 {
    margin: 0;
    margin-left: auto;
}

.table_title .btn {
    margin: 0;
}

/* Empty State */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* Text Helpers */
.text-center,
.textcenter {
    text-align: center;
}

.numeric {
    text-align: right;
}

/* Sorting Indicators */
.headerSort,
.headerSortasc,
.headerSortdesc {
    cursor: pointer;
    position: relative;
}

.headerSort:after,
.headerSortasc:after,
.headerSortdesc:after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.headerSort:after {
    border-top: 5px solid #9ca3af;
    opacity: 0.3;
}

.headerSortasc:after {
    border-bottom: 5px solid #67a552;
}

.headerSortdesc:after {
    border-top: 5px solid #67a552;
}

/* No More Tables - Mobile Responsive */
@media (max-width: 767px) {
    .no-more-tables table,
    .no-more-tables thead,
    .no-more-tables tbody,
    .no-more-tables th,
    .no-more-tables td,
    .no-more-tables tr {
        display: block;
    }

    .no-more-tables thead {
        display: none;
    }

    .no-more-tables tbody tr {
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        overflow: hidden;
    }

    .no-more-tables tbody td {
        display: flex;
        justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid #f3f4f6;
        text-align: right;
    }

    .no-more-tables tbody td:last-child {
        border-bottom: none;
    }

    .no-more-tables tbody td:before {
        content: attr(data-title);
        font-weight: 600;
        color: #374151;
        text-align: left;
        flex: 1;
        padding-right: 12px;
    }

    .table_title {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table_title .searchbox2,
    .table_title .btn {
        width: 100%;
    }
}

/* Zebra Striped (legacy support) */
.zebra-striped tbody tr:nth-child(odd) {
    background: #ffffff;
}

.zebra-striped tbody tr:nth-child(even) {
    background: #f9fafb;
}

/* Print Styles */
@media print {
    .table {
        border: 1px solid #000;
    }

    .table thead {
        background: #f0f0f0;
    }

    .table tbody tr:hover {
        background: transparent;
    }

    .table_title .btn,
    .table_title .searchbox2 {
        display: none;
    }
}

/* ========================================
   TABLE HEADER & SEARCH
   ======================================== */

/* Search Box in Table Title - Form input styles moved to forms.css */
.searchbox2 {
    display: flex;
    gap: 8px;
    align-items: center;
}

.searchbox2 form {
    display: flex;
    gap: 0;
}

/* Center alignment helper */
td[style*="text-align:center"],
th[style*="text-align:center"] {
    text-align: center !important;
}

/* No border helper */
.noborder {
    border: none !important;
}
