/* Core Table Layout */
.custom-table-wrapper {
    max-width: 100%;
}

.custom-table-container {
    overflow: hidden;
    width: 100%;
}

.premium-custom-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: left;
}

.table-cell {
    padding: 16px 20px;
    vertical-align: middle;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.cell-inner-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.cell-icon svg {
    display: inline-block;
    vertical-align: middle;
}

/* Default Preset: Premium Beige (Construction) */
.table-preset-premium-beige .custom-table-container {
    background-color: #FBF7F4;
    border: 1px solid #E7DFD7;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.table-preset-premium-beige th.table-cell {
    background-color: #E7DFD7;
    color: #050601;
    font-weight: 600;
    border-bottom: 2px solid #D6CBC0;
}

.table-preset-premium-beige td.table-cell {
    color: #3D3930;
    border-bottom: 1px solid #E7DFD7;
}

.table-preset-premium-beige tr:last-child td.table-cell {
    border-bottom: none;
}

.table-preset-premium-beige tr:nth-child(even) td.table-cell {
    background-color: rgba(231, 223, 215, 0.2);
}

.table-preset-premium-beige tr:hover td.table-cell {
    background-color: rgba(231, 223, 215, 0.45) !important;
}

/* Minimal Light Preset */
.table-preset-minimal .custom-table-container {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.table-preset-minimal th.table-cell {
    background-color: #f8fafc;
    color: #1e293b;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.table-preset-minimal td.table-cell {
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.table-preset-minimal tr:last-child td.table-cell {
    border-bottom: none;
}

.table-preset-minimal tr:nth-child(even) td.table-cell {
    background-color: #f8fafc;
}

.table-preset-minimal tr:hover td.table-cell {
    background-color: #f1f5f9 !important;
}

/* Dark Technical Preset */
.table-preset-dark .custom-table-container {
    background-color: #1a1e24;
    border: 1px solid #2d3748;
    border-radius: 8px;
}

.table-preset-dark th.table-cell {
    background-color: #111418;
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid #2d3748;
}

.table-preset-dark td.table-cell {
    color: #cbd5e0;
    border-bottom: 1px solid #2d3748;
}

.table-preset-dark tr:last-child td.table-cell {
    border-bottom: none;
}

.table-preset-dark tr:nth-child(even) td.table-cell {
    background-color: rgba(255, 255, 255, 0.02);
}

.table-preset-dark tr:hover td.table-cell {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Technical Blue Preset */
.table-preset-technical .custom-table-container {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.table-preset-technical th.table-cell {
    background-color: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.table-preset-technical td.table-cell {
    color: #334155;
    border-bottom: 1px solid #cbd5e1;
}

.table-preset-technical tr:last-child td.table-cell {
    border-bottom: none;
}

.table-preset-technical tr:nth-child(even) td.table-cell {
    background-color: #f8fafc;
}

.table-preset-technical tr:hover td.table-cell {
    background-color: #e2e8f0 !important;
}

/* Sticky Header feature */
.table-sticky-hdr-yes .custom-table-container {
    max-height: 500px;
    overflow-y: auto;
}

.table-sticky-hdr-yes th.table-cell {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Sticky Column feature */
.table-sticky-col-yes .custom-table-container {
    overflow-x: auto;
}

.table-sticky-col-yes th:first-child,
.table-sticky-col-yes td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-clip: padding-box;
}

.table-sticky-col-yes th:first-child {
    z-index: 11;
}

/* Mobile responsive modes */
@media (max-width: 767px) {
    /* Horizontal Scroll Mode */
    .table-mobile-scroll .custom-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-mobile-scroll .premium-custom-table {
        min-width: 600px;
    }

    /* Stacked Cards Mode */
    .table-mobile-stacked .premium-custom-table,
    .table-mobile-stacked thead,
    .table-mobile-stacked tbody,
    .table-mobile-stacked th,
    .table-mobile-stacked td,
    .table-mobile-stacked tr {
        display: block;
        width: 100% !important;
    }

    .table-mobile-stacked thead {
        display: none; /* Hide original headers for card layout */
    }

    .table-mobile-stacked tr {
        margin-bottom: 16px;
        border: 1px solid #E7DFD7;
        border-radius: 12px;
        background-color: #ffffff;
        padding: 8px;
    }

    .table-mobile-stacked td.table-cell {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f1f5f9;
        padding: 12px 8px;
        text-align: right !important;
    }

    .table-mobile-stacked td.table-cell:last-child {
        border-bottom: none;
    }

    /* Add cell labels dynamically or styled uniquely on mobile stacked */
    .table-mobile-stacked td.table-cell::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        margin-right: 16px;
    }
}
