/* AJS Load Tracker Table Styles */

#ajs-load-tracker-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Bulk Actions Bar */
.ajs-bulk-actions-bar {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ajs-selection-info {
    font-weight: 500;
    color: #1976d2;
}

.ajs-bulk-controls {
    display: flex;
    gap: 10px;
}

.ajs-bulk-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.ajs-bulk-delete {
    background: #f44336;
    color: white;
}

.ajs-bulk-delete:hover {
    background: #d32f2f;
}

.ajs-bulk-export {
    background: #0073aa;
    color: white;
}

.ajs-bulk-export:hover {
    background: #005a87;
}

.ajs-bulk-edit {
    background: #ff9800;
    color: white;
}

.ajs-bulk-edit:hover {
    background: #f57c00;
}

.ajs-clear-selection {
    background: #757575;
    color: white;
}

.ajs-clear-selection:hover {
    background: #616161;
}

/* Search Controls */
.ajs-search-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.ajs-basic-search {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.ajs-advanced-filters {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
}

.ajs-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ajs-filter-row h4 {
    margin: 0;
    color: #333;
}

.ajs-filter-condition {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ajs-filter-field,
.ajs-filter-operator {
    min-width: 150px;
}

.ajs-filter-value {
    flex: 1;
    min-width: 200px;
}

.ajs-remove-filter {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.ajs-remove-filter:hover {
    background: #d32f2f;
}

.ajs-filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

#ajs-add-filter {
    background: #2196f3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

#ajs-add-filter:hover {
    background: #1976d2;
}

#ajs-apply-filters {
    background: #0073aa;
    color: white;
}

#ajs-apply-filters:hover {
    background: #005a87;
}

#ajs-clear-filters {
    background: #757575;
    color: white;
}

#ajs-clear-filters:hover {
    background: #616161;
}

#ajs-toggle-filters {
    background: #673ab7;
    color: white;
}

#ajs-toggle-filters:hover {
    background: #512da8;
}

.ajs-search-controls input,
.ajs-search-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    height: 38px;
    box-sizing: border-box;
    line-height: normal;
    vertical-align: top;
}

.ajs-search-controls input[type="text"] {
    min-width: 200px;
    flex: 1;
}

.ajs-search-controls input[type="date"] {
    min-width: 140px;
    height: 38px !important;
    padding: 8px 12px;
    box-sizing: border-box;
    line-height: normal;
    vertical-align: top;
}

.ajs-search-controls select {
    min-width: 150px;
    height: 38px;
}

.ajs-search-controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

#ajs-search-btn {
    background: #0073aa;
    color: white;
}

#ajs-search-btn:hover {
    background: #005a87;
}

#ajs-clear-btn {
    background: #666;
    color: white;
}

#ajs-clear-btn:hover {
    background: #555;
}

/* Table Wrapper */
.ajs-table-wrapper {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

/* Table Styles */
.ajs-load-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}

.ajs-load-table th {
    background: #f1f1f1;
    border-bottom: 2px solid #ddd;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: relative;
    user-select: none;
}

.ajs-load-table th[data-sortable="true"] {
    cursor: pointer;
    padding-right: 24px;
}

.ajs-load-table th[data-sortable="true"]:hover {
    background: #e8e8e8;
}

.ajs-load-table th[data-sortable="true"]:after {
    content: "↕";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 12px;
}

.ajs-load-table th.sort-asc:after {
    content: "↑";
    opacity: 1;
    color: #0073aa;
}

.ajs-load-table th.sort-desc:after {
    content: "↓";
    opacity: 1;
    color: #0073aa;
}

.ajs-load-table td {
    border-bottom: 1px solid #eee;
    padding: 10px 8px;
    vertical-align: top;
    word-wrap: break-word;
    max-width: 200px;
}

.ajs-load-table tbody tr:hover {
    background: #f9f9f9;
}

.ajs-load-table tbody tr.editing {
    background: #fff3cd;
}

/* Cell-specific styles */
.ajs-select-column,
.ajs-select-cell {
    width: 40px;
    text-align: center;
    padding: 8px 4px;
}

.ajs-select-column input[type="checkbox"],
.ajs-select-cell input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

.date-cell {
    min-width: 90px;
    white-space: nowrap;
}

.driver-cell {
    min-width: 120px;
}

.quantity-cell {
    text-align: right;
    min-width: 80px;
}

.notes-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions-cell {
    white-space: nowrap;
    min-width: 80px;
}

/* Edit mode inputs */
.edit-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    background: white;
}

.edit-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Action buttons */
.ajs-edit-btn, .ajs-save-btn, .ajs-cancel-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
}

.ajs-edit-btn {
    background: #0073aa;
    color: white;
}

.ajs-edit-btn:hover {
    background: #005a87;
}

.ajs-save-btn {
    background: #0073aa;
    color: white;
}

.ajs-save-btn:hover {
    background: #399a40;
}

.ajs-cancel-btn {
    background: #dc3232;
    color: white;
}

.ajs-cancel-btn:hover {
    background: #c62d2d;
}

/* Pagination */
.ajs-pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-top: 20px;
    border-top: 1px solid #eee;
}

.ajs-pagination-info {
    color: #666;
    font-size: 14px;
}

.ajs-pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ajs-pagination-controls button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

.ajs-pagination-controls button:hover:not(:disabled) {
    background: #f5f5f5;
}

.ajs-pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ajs-page-number {
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    margin: 0 1px;
}

.ajs-page-number:hover {
    background: #f5f5f5;
}

.ajs-page-number.current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.ajs-page-ellipsis {
    padding: 6px 4px;
    color: #666;
}

/* State messages */
.loading, .error, .no-entries {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.error {
    color: #dc3232;
}

.saving {
    color: #666;
    font-style: italic;
}

/* Notification messages */
.ajs-message {
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-weight: 500;
}

.ajs-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ajs-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Responsive design */
@media (max-width: 768px) {
    .ajs-search-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ajs-search-controls input,
    .ajs-search-controls select,
    .ajs-search-controls button {
        width: 100%;
        margin: 2px 0;
    }
    
    .ajs-pagination-wrapper {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .ajs-load-table {
        font-size: 12px;
    }
    
    .ajs-load-table th,
    .ajs-load-table td {
        padding: 6px 4px;
    }
    
    .notes-cell {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .ajs-load-table th,
    .ajs-load-table td {
        padding: 4px 2px;
        font-size: 11px;
    }
    
    .ajs-page-number,
    .ajs-pagination-controls button {
        padding: 4px 6px;
        font-size: 12px;
    }
}