:root {
    --tc-border: rgba(255, 255, 255, 0.12);
    --tc-bg-card: var(--bs-surface-2-bg, #1b222b);
    --tc-main-light: rgba(238, 97, 25, 0.15);
    --tc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --tc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* Grid parent fix — khi tab taxClass active */
.menu-create-page.setting-page:has(.tax-class-config:not(.dis-none)) {
    grid-template-rows: min-content 1fr;
}

.tax-class-config {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Main Container */
.tax-class-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 var(--px-24) var(--px-12) var(--px-24);
    color: var(--text-color, #1e293b);
}

/* Toolbar */
.tc-toolbar {
    display: flex;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;
    /* background: var(--tc-bg-card); */
    padding: var(--px-16) var(--px-20);
    border-radius: var(--px-12);
    box-shadow: var(--tc-shadow);
    margin-bottom: var(--px-24);
    gap: var(--px-16);
    flex-wrap: wrap;
}

/* Search bar styling */
.tc-search-wrapper {
    position: relative;
    min-width: 280px;
}

.tc-search-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.tc-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-8);
    font-size: 14px;
    background-color: #1e2632;
    color: #ffffff;
    transition: all 0.2s;
    box-sizing: border-box;
}

.tc-search-input::placeholder {
    color: #94a3b8;
}

.tc-search-input:focus {
    outline: none;
    border-color: var(--bs-main, #ee6119);
    background-color: #243040;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(238, 97, 25, 0.25);
}

.tc-actions-left {
    display: flex;
    gap: var(--px-12);
}

/* Buttons */
.tc-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--px-8);
    padding: var(--px-12) var(--px-16);
    border-radius: var(--px-8);
    font: normal normal 500 var(--s-14);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
    min-width: auto;
    height: auto;
}

.tc-btn-primary {
    background-color: var(--bs-main, #ee6119);
    color: white;
}

.tc-btn-primary:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.tc-btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.tc-btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Flex layout chain */
.tc-main-layout {
    display: flex;
    gap: var(--px-24);
    align-items: stretch;
    flex: 1;
    min-height: 0;
    transition: all 0.3s ease-in-out;
}

.tc-list-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--tc-bg-card);
    border-radius: var(--px-12);
    box-shadow: var(--tc-shadow);
    overflow: hidden;
    border: 1px solid var(--tc-border);
    position: relative;
}

/* Table wrapper */
.tc-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Table */
.tc-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font: normal normal 500 var(--s-14);
}

.tc-table th {
    padding: var(--px-12) var(--px-16);
    background-color: #1e2632;
    color: var(--bs-text-muted);
    border-bottom: 1px solid var(--tc-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tc-table td {
    padding: var(--px-12) var(--px-16);
    border-bottom: 1px solid var(--tc-border);
    transition: background-color 0.15s;
    white-space: nowrap;
    vertical-align: middle;
    word-break: break-word;
    color: #ffffff;
}

.tc-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.tc-table-checkbox {
    display: block;
    position: relative;
    cursor: not-allowed;
    width: 18px;
    height: 18px;
    margin: 0 auto;
    visibility: visible;
}

.tc-table-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: not-allowed;
    height: 0;
    width: 0;
    visibility: visible;
}

.tc-table-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #1e2632;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}

.tc-table-checkbox input:checked~.tc-table-checkmark {
    background-color: var(--bs-main);
    border-color: var(--bs-main);
}

.tc-table-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.tc-table-checkbox input:checked~.tc-table-checkmark:after {
    display: block;
}

.tc-table-checkbox .tc-table-checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.tc-table tbody tr {
    cursor: pointer;
}

.tc-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* Action buttons in table */
.tc-btn-edit-row {
    background: none;
    border: none;
    padding: var(--px-6) var(--px-10);
    border-radius: var(--px-6);
    cursor: pointer;
    color: var(--bs-text-muted);
    transition: all 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: auto;
}

.tc-btn-edit-row:hover {
    background-color: var(--tc-main-light);
    color: var(--bs-main, #ee6119);
}

/* Modal Backdrop Overlay */
.tc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
}

.tc-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container (centered, flexible max-height with scrollable body) */
.tc-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: var(--px-700);
    /* Slightly wider to accommodate two-column grid */
    max-height: 90vh;
    background: #151a20;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-12);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tc-modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Modal Header */
.tc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--px-16) var(--px-24);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
}

.tc-modal-header h3 {
    margin: 0;
    font-size: var(--px-18);
    font-weight: 600;
    color: #ffffff;
}

.tc-modal-close {
    background: none;
    border: none;
    font-size: var(--px-28);
    font-weight: 300;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.15s, background-color 0.15s;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--px-32);
    height: var(--px-32);
    border-radius: 50%;
    min-width: auto;
}

.tc-modal-close:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Modal Body (Scrollable and Grid Layout) */
.tc-modal-body {
    padding: var(--px-24);
    overflow-y: auto;
    flex: 1;
}

/* Form layout grid */
.tc-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--px-16);
}

.tc-field-item {
    margin-bottom: var(--px-4);
    position: relative;
}

.tc-field-label {
    display: block;
    margin-bottom: var(--px-6);
    font-weight: 600;
    font-size: var(--px-13);
    color: #94a3b8;
}

.tc-required {
    color: #ef4444;
}

.tc-form-control {
    width: 100%;
    padding: var(--px-10) var(--px-14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-8);
    font-size: var(--px-14);
    background-color: #1e2632;
    transition: all 0.2s;
    color: #ffffff;
    box-sizing: border-box;
    height: 40px;
}

.tc-form-control:focus {
    outline: none;
    border-color: var(--bs-main, #ee6119);
    background-color: #243040;
    box-shadow: 0 0 0 3px rgba(238, 97, 25, 0.25);
}

.tc-form-control:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    color: #64748b;
    cursor: not-allowed;
}

.tc-error-message {
    color: #ef4444;
    font-size: var(--px-12);
    margin-top: var(--px-4);
}

.tc-form-control.is-invalid {
    border-color: #ef4444;
}

.tc-form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Checkbox specific styling */
.tc-checkbox-container {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    font-size: 14px;
    color: #ffffff;
    gap: 8px;
    padding-top: var(--px-24);
    /* Alignment with other input fields */
}

.tc-checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.tc-checkbox-checkmark {
    height: 20px;
    width: 20px;
    background-color: #1e2632;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
}

.tc-checkbox-container:hover input~.tc-checkbox-checkmark {
    border-color: var(--bs-main, #ee6119);
}

.tc-checkbox-container input:checked~.tc-checkbox-checkmark {
    background-color: var(--bs-main, #ee6119);
    border-color: var(--bs-main, #ee6119);
}

.tc-checkbox-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.tc-checkbox-container input:checked~.tc-checkbox-checkmark:after {
    display: block;
}

.tc-checkbox-container .tc-checkbox-checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Modal Footer */
.tc-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--px-12);
    padding: var(--px-16) var(--px-24);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
}

.tc-modal-footer .tc-btn {
    min-width: var(--px-100);
    justify-content: center;
}

/* Loading Overlay */
.tc-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-color, #1e293b);
    z-index: 100;
    backdrop-filter: blur(2px);
}

/* Responsive */
@media (max-width: 768px) {
    .tax-class-container {
        padding: var(--px-16) var(--px-16) 0;
        overflow-y: auto;
    }

    .tc-main-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .tc-list-container {
        margin: 0 0 var(--px-12) 0;
    }

    .tc-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--px-12);
        padding: var(--px-12);
    }

    .tc-toolbar .tc-btn {
        width: 100%;
        min-height: var(--px-44);
        justify-content: center;
    }

    .tc-modal {
        width: 95%;
        border-radius: var(--px-8);
    }

    .tc-form-grid {
        grid-template-columns: 1fr;
        gap: var(--px-12);
    }

    .tc-checkbox-container {
        padding-top: var(--px-8);
    }

    .tc-modal-body {
        padding: var(--px-16);
    }

    .tc-modal-footer {
        padding: var(--px-12) var(--px-16);
    }

    .tc-modal-footer .tc-btn {
        flex: 1;
    }

    .tc-form-control {
        min-height: var(--px-44);
        font-size: var(--px-15);
    }

    .tc-table td,
    .tc-table th {
        padding: var(--px-12) var(--px-10);
    }

    .tc-btn-edit-row {
        padding: var(--px-10) var(--px-12);
        font-size: var(--px-16);
    }
}