:root {
    --tt-border: #cbd5e1;
    --tt-bg-card: var(--bs-surface-2-bg, #1b222b);
    --tt-main-light: #eff6ff;
    --tt-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tt-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.table-type-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);
}

.menu-create-page.setting-page:has(.table-type-config:not(.dis-none)) {
    grid-template-rows: min-content 1fr;
}

.table-type-config {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Toolbar Style */
.tt-toolbar {
    display: flex;
    flex-shrink: 0;
    justify-content: flex-end;
    align-items: center;
    /* background: var(--tt-bg-card); */
    padding: var(--px-16) var(--px-20);
    border-radius: var(--px-12);
    box-shadow: var(--tt-shadow);
    margin-bottom: var(--px-24);
    gap: var(--px-16);
    flex-wrap: wrap;
}

/* Buttons */
.tt-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;
}

.tt-btn-primary {
    background-color: var(--bs-main);
    color: white;
}

.tt-btn-primary:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.tt-btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.tt-btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* List layout styling */
.tt-main-layout {
    display: flex;
    gap: var(--px-24);
    align-items: stretch;
    flex: 1;
    min-height: 0;
    transition: all 0.3s ease-in-out;
}

.tt-list-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--tt-bg-card);
    border-radius: var(--px-12);
    box-shadow: var(--tt-shadow);
    overflow: hidden;
    border: 1px solid var(--tt-border);
    position: relative;
}

.tt-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.tt-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font: normal normal 500 var(--s-14);
}

.tt-table th {
    padding: var(--px-12) var(--px-16);
    background-color: #1e2632;
    color: var(--bs-text-muted);
    border-bottom: 1px solid var(--tt-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tt-table td {
    padding: var(--px-12) var(--px-16);
    border-bottom: 1px solid var(--tt-border);
    transition: background-color 0.15s;
    white-space: nowrap;
    vertical-align: middle;
    color: #ffffff;
}

.tt-table tbody tr {
    cursor: pointer;
}

.tt-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* Action buttons in table */
.tt-btn-edit-row,
.tt-btn-delete-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;
}

.tt-btn-edit-row:hover {
    background-color: var(--tt-main-light);
    color: var(--bs-main);
}

.tt-btn-delete-row:hover {
    background-color: #fef2f2;
    color: #ef4444;
}

/* Modal Backdrop Overlay */
.tt-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;
}

.tt-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container (centered) */
.tt-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: var(--px-500);
    background: var(--bs-surface-bg, #151a20);
    border-radius: var(--px-12);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
    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;
    color: #ffffff;
    border: 1px solid var(--tt-border);
}

.tt-modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Modal Layout Details */
.tt-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--px-16) var(--px-24);
    border-bottom: 1px solid var(--tt-border);
    background: var(--bs-surface-bg, #151a20);
}

.tt-modal-header h3 {
    margin: 0;
    font-size: var(--px-18);
    font-weight: 600;
    color: #ffffff;
}

.tt-modal-close {
    background: none;
    border: none;
    font-size: var(--px-28);
    font-weight: 300;
    cursor: pointer;
    color: #64748b;
    transition: 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;
}

.tt-modal-close:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.tt-modal-body {
    padding: var(--px-24);
}

.tt-field-item {
    margin-bottom: var(--px-16);
}

.tt-field-item:last-child {
    margin-bottom: 0;
}

.tt-field-label {
    display: block;
    margin-bottom: var(--px-6);
    font-weight: 600;
    font-size: var(--px-13);
    color: #94a3b8;
}

.tt-required {
    color: #ef4444;
}

.tt-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;
}

.tt-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);
}

.tt-form-control:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--bs-text-muted);
    cursor: not-allowed;
}

.tt-error-message {
    color: #ef4444;
    font-size: var(--px-12);
    margin-top: var(--px-4);
}

.tt-form-control.is-invalid {
    border-color: #ef4444;
}

.tt-form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.tt-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--px-12);
    padding: var(--px-16) var(--px-24);
    border-top: 1px solid var(--tt-border);
    background: var(--bs-surface-bg, #151a20);
}

.tt-modal-footer .tt-btn {
    min-width: var(--px-100);
    justify-content: center;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .table-type-container {
        padding: var(--px-16) var(--px-16) 0;
        overflow-y: auto;
    }

    .tt-main-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .tt-list-container {
        margin: 0 0 var(--px-12) 0;
    }

    .tt-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--px-12);
        padding: var(--px-12);
    }

    .tt-toolbar .tt-btn {
        width: 100%;
        min-height: var(--px-44);
        justify-content: center;
    }

    .tt-modal {
        width: 95%;
        border-radius: var(--px-8);
    }

    .tt-modal-body {
        padding: var(--px-16);
    }

    .tt-modal-footer {
        padding: var(--px-12) var(--px-16);
    }

    .tt-modal-footer .tt-btn {
        flex: 1;
    }

    .tt-form-control {
        min-height: var(--px-44);
        font-size: var(--px-15);
    }

    .tt-table td, .tt-table th {
        padding: var(--px-12) var(--px-10);
    }

    .tt-btn-edit-row, .tt-btn-delete-row {
        padding: var(--px-10) var(--px-12);
        font-size: var(--px-16);
    }
}
