/**
 * NetGrid Tables 1.0 Styles
 */

.ng-table-wrapper {
    width: 100%;
}

.ng-table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.ng-table-search {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.ng-table-search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.ng-table-search-input:focus {
    outline: none;
    border-color: #fc5e10;
}

.ng-table-export {
    display: flex;
    gap: 0.5rem;
}

.ng-table-export-btn {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    color: #1e3e5d;
}

.ng-table-export-btn:hover {
    background: #fc5e10;
    color: #fff;
    border-color: #fc5e10;
}

.ng-table-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.ng-table-search {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    display: flex;
    align-items: flex-end;
}

.ng-table-search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.ng-table-search-input:focus {
    outline: none;
    border-color: #fc5e10;
}

.ng-table-export {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ng-table-export-btn {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    color: #1e3e5d;
    font-weight: 500;
}

.ng-table-export-btn:hover {
    background: #fc5e10;
    color: #fff;
    border-color: #fc5e10;
}

.ng-table-right-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    min-height: 80px; /* Maintain minimum height to prevent layout shift */
}

.ng-table-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
    min-height: 42px; /* Maintain minimum height even when empty */
}

.ng-table-info {
    font-size: 14px;
    color: #666;
    padding: 0;
    font-weight: 500;
    text-align: right;
}

.ng-table-page-btn {
    padding: 0.625rem 0.875rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #1e3e5d;
    min-width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ng-table-page-btn:hover:not(:disabled) {
    background: #fc5e10;
    color: #fff;
    border-color: #fc5e10;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(252, 94, 16, 0.2);
}

.ng-table-page-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(252, 94, 16, 0.2);
}

.ng-table-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f5f5;
}

.ng-table-page-btn.ng-table-page-active {
    background: #fc5e10;
    color: #fff;
    border-color: #fc5e10;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(252, 94, 16, 0.3);
}

.ng-table-page-btn.ng-table-page-prev,
.ng-table-page-btn.ng-table-page-next {
    font-weight: 600;
    padding: 0.625rem 1rem;
}

.ng-table-page-btn.ng-table-page-prev span,
.ng-table-page-btn.ng-table-page-next span {
    font-size: 18px;
    line-height: 1;
}

.ng-table-page-ellipsis {
    padding: 0.625rem 0.5rem;
    color: #999;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
}

/* Sortable headers */
.ng-table-sortable {
    position: relative;
    user-select: none;
}

.ng-table-sortable:hover {
    background-color: #f5f5f5;
}

.ng-table-sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 12px;
}

.ng-table-sortable.ng-table-sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #fc5e10;
}

.ng-table-sortable.ng-table-sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #fc5e10;
}

/* Table styling - Force visibility with !important */
table[ng-table] {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    display: table !important;
    visibility: visible !important;
    opacity: 1 !important;
}

table[ng-table] thead {
    display: table-header-group !important;
    visibility: visible !important;
}

table[ng-table] thead th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #1e3e5d;
    border-bottom: 2px solid #fc5e10;
    display: table-cell !important;
    visibility: visible !important;
}

table[ng-table] tbody {
    display: table-row-group !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 0 !important;
    filter: none !important;
    transform: none !important;
    clip: auto !important;
    clip-path: none !important;
}

table[ng-table] tbody tr {
    display: table-row !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    filter: none !important;
    transform: none !important;
    clip: auto !important;
    clip-path: none !important;
    position: static !important;
}

table[ng-table] tbody td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}

table[ng-table] tbody tr:hover {
    background-color: #f8f9fa;
}

table[ng-table] tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
    .ng-table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .ng-table-search {
        max-width: 100%;
    }

    .ng-table-export {
        justify-content: center;
    }

    .ng-table-info {
        text-align: center;
    }

    table[ng-table] {
        font-size: 14px;
    }

    table[ng-table] thead th,
    table[ng-table] tbody td {
        padding: 8px;
    }
}

