/**
 * Secure Table Styles
 * Replacement for jQuery DataTables CSS
 */

/* ============================================
   TABLE STYLING
   ============================================ */

.secure-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.secure-table thead {
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.secure-table thead th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #333;
    border-right: 1px solid #ddd;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.secure-table thead th.sortable {
    cursor: pointer;
}

.secure-table thead th.sortable:hover {
    background-color: #e8e8e8;
}

.secure-table thead th.sortable::after {
    content: ' ↕';
    font-size: 12px;
    color: #ccc;
    margin-left: 5px;
    display: inline-block;
    transition: color 0.2s ease;
}

.secure-table thead th:last-child {
    border-right: none;
}

.secure-table thead th.sort-asc::after {
    content: ' ▲';
    font-size: 14px;
    color: #007bff;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
}

.secure-table thead th.sort-desc::after {
    content: ' ▼';
    font-size: 14px;
    color: #007bff;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
}

.secure-table tbody tr {
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s ease;
}

.secure-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.secure-table tbody tr:hover {
    background-color: #f0f0f0;
}

.secure-table tbody td {
    padding: 8px 10px;
    color: #555;
    border-right: 1px solid #f0f0f0;
}

.secure-table tbody td:last-child {
    border-right: none;
}

/* ============================================
   TOP CONTROLS (Show, Export, Search)
   ============================================ */

.table-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
    gap: 15px;
}

/* Show entries (left) */
.row-count-label {
    margin: 0;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.row-count-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-width: 70px;
}

.row-count-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Spacer */
.controls-spacer {
    flex: 1;
}

/* Export and Search (right) */
.table-export-wrapper-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    flex-shrink: 0;
}

.table-export-wrapper-inline .btn {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 4px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.table-export-wrapper-inline .btn:hover {
    background-color: #0056b3;
    box-shadow: 0 2px 6px rgba(0, 86, 179, 0.3);
}

.table-export-wrapper-inline .btn:active {
    background-color: #004085;
}

.export-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 150px;
    margin-top: 5px;
    display: none;
}

.export-dropdown.show {
    display: block;
}

.export-dropdown a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.export-dropdown a:last-child {
    border-bottom: none;
}

.export-dropdown a:hover {
    background-color: #f0f0f0;
    color: #007bff;
}

.table-search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
    transition: border-color 0.2s ease;
    flex-shrink: 0;
}

.table-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ============================================
   BOTTOM CONTROLS (Pagination & Entry Info)
   ============================================ */

.table-bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    gap: 20px;
}

.pagination-info-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.entry-info {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.pagination-controls-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-pagination {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-block;
}

.btn-pagination:hover:not(:disabled) {
    background-color: #f0f0f0;
    border-color: #999;
    color: #000;
}

.btn-pagination:active:not(:disabled) {
    background-color: #e0e0e0;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
}

.page-info-highlight {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    background-color: #f0f0f0;
    padding: 4px 12px;
    border-radius: 4px;
    min-width: 80px;
    text-align: center;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .secure-table {
        font-size: 13px;
    }

    .secure-table thead th,
    .secure-table tbody td {
        padding: 10px 10px;
    }

    .table-top-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .controls-spacer {
        display: none;
    }

    .table-export-wrapper-inline,
    .table-search-input {
        width: 100%;
    }

    .table-bottom-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination-controls-section {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .secure-table {
        font-size: 12px;
    }

    .secure-table thead th,
    .secure-table tbody td {
        padding: 8px 5px;
    }

    .secure-table thead th.sort-asc::after,
    .secure-table thead th.sort-desc::after {
        font-size: 10px;
        margin-left: 2px;
    }

    .table-top-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .row-count-label,
    .table-export-wrapper-inline,
    .table-search-input {
        width: 100%;
    }

    .table-export-wrapper-inline {
        flex-direction: column;
    }

    .pagination-controls-section {
        flex-direction: column;
        width: 100%;
    }

    .btn-pagination {
        width: 100%;
    }

    .page-info-highlight {
        width: 100%;
        margin: 10px 0;
    }
}
