/* Modern Priority Records Table Component */
/* ======================================== */

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.table-controls-left {
    display: flex;
    align-items: center;
}

.table-controls-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-controls-right {
    display: flex;
    align-items: center;
}

/* Export Button Styling */
.btn-export {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-export:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-export:active {
    transform: translateY(0);
}

.btn-export i {
    font-size: 1rem;
}

.page-size-control {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-control {
    position: relative;
    display: flex;
    align-items: center;
}

.search-control .search-icon {
    position: absolute;
    right: 0.75rem;
    color: #94a3b8;
    pointer-events: none;
}

.form-select-sm, .form-control-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
}

.form-control-sm {
    width: 250px;
    padding-right: 2.5rem;
}

.form-select-sm:focus, .form-control-sm:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Table Responsive Container */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin: 1rem 0;
}

/* Modern Table Styles */
.modern-priority-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Table Header */
.modern-priority-table thead th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    position: relative;
    user-select: none;
}

.modern-priority-table thead th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.modern-priority-table thead th.sortable:hover {
    background: #e2e8f0;
}

/* Sort Indicators */
.sort-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.sortable:hover .sort-indicator {
    opacity: 1;
}

.sort-indicator i {
    font-size: 0.75rem;
}

/* Adaptive Column Widths */
.priority-score-col { width: 120px; min-width: 120px; }
.machine-col { width: 200px; min-width: 180px; }
.status-col { width: 100px; min-width: 100px; }
.source-col { width: 150px; min-width: 130px; }
.input-col { width: 120px; min-width: 100px; }
.point-col { width: 250px; min-width: 200px; }
.value-col { width: 90px; min-width: 80px; }
.unit-col { width: 80px; min-width: 70px; }
.lubrication-col { width: 100px; min-width: 90px; }
.date-col { width: 110px; min-width: 100px; }
.notes-col { width: 300px; min-width: 250px; }

/* Table Body */
.modern-priority-table tbody td {
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #475569;
}

.modern-priority-table tbody tr {
    transition: background-color 0.2s;
}

.modern-priority-table tbody tr:hover {
    background: #f8fafc;
}

.modern-priority-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.modern-priority-table tbody tr:nth-child(even):hover {
    background: #f1f5f9;
}

/* Cell-Specific Styling */
.priority-score {
    font-weight: 600;
    color: #1e293b;
    text-align: right;
}

.machine {
    font-weight: 500;
    color: #1e293b;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.ok {
    background: #dcfce7;
    color: #166534;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.value {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.unit {
    font-size: 0.8rem;
    color: #64748b;
}

.lubrication {
    text-align: center;
}

.date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #64748b;
}

.notes {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0.75rem;
    background: #f8fafc;
    border-radius: 0 0 8px 8px;
    border: 1px solid #e2e8f0;
    border-top: none;
}

.table-info {
    font-size: 0.875rem;
    color: #64748b;
}

/* Pagination Styles */
.pagination {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

.page-item {
    margin: 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    text-decoration: none;
    color: #64748b;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s;
    min-width: 40px;
    height: 36px;
}

.page-link:hover {
    background: #f1f5f9;
    color: #334155;
    text-decoration: none;
}

.page-item.active .page-link {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.page-item.disabled .page-link {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: not-allowed;
}

.page-item.disabled .page-link:hover {
    background: #f8fafc;
    color: #cbd5e1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .table-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .table-controls-left,
    .table-controls-center,
    .table-controls-right {
        justify-content: center;
    }
    
    .form-control-sm {
        width: 100%;
        max-width: 300px;
    }
    
    .btn-export {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .table-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .pagination {
        justify-content: center;
    }
    
    /* Hide less important columns on mobile */
    .source-col, .input-col, .unit-col, .date-col {
        display: none;
    }
    
    .notes-col {
        min-width: 200px;
    }
}

@media (max-width: 576px) {
    .modern-priority-table {
        font-size: 0.8rem;
    }
    
    .modern-priority-table thead th,
    .modern-priority-table tbody td {
        padding: 0.5rem 0.375rem;
    }
    
    .table-controls {
        padding: 0.5rem;
    }
    
    .btn-export {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
        gap: 0.375rem;
    }
    
    .btn-export i {
        font-size: 0.875rem;
    }
    
    .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
        min-width: 32px;
        height: 32px;
    }
}

/* Loading State */
.table-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.table-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Empty State */
.table-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.table-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Print Styles */
@media print {
    .table-controls,
    .table-footer {
        display: none;
    }
    
    .table-responsive {
        overflow: visible;
        border: none;
    }
    
    .modern-priority-table {
        font-size: 0.7rem;
    }
    
    .modern-priority-table thead th,
    .modern-priority-table tbody td {
        padding: 0.25rem;
        border: 1px solid #000;
    }
} 