/* Materials Index - Baza Indeksów */

.materials-index-container {
    padding: 20px;
    max-width: 100%;
    overflow-x: auto;
}

.materials-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.materials-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: #1e293b;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Filters */
.materials-filters {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #1976D2;
}

.btn-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    line-height: 1;
}

.btn-icon:hover {
    color: #1e293b;
}

.filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: #1976D2;
}

/* Table */
.materials-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.table-wrapper {
    overflow-x: auto;
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

.materials-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.materials-table thead {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.materials-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.materials-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.materials-table th.sortable:hover {
    background-color: #e2e8f0;
}

.materials-table th.sorted {
    background-color: #dbeafe;
    color: #1976D2;
}

.materials-table th.sorted.asc::after {
    content: ' ↑';
}

.materials-table th.sorted.desc::after {
    content: ' ↓';
}

.materials-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
}

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

.materials-table tbody tr:hover {
    background-color: #f8fafc;
}

.materials-table tbody tr:last-child td {
    border-bottom: none;
}

.loading-cell,
.empty-cell,
.error-cell {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #1976D2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination */
.materials-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pagination-info {
    color: #64748b;
    font-size: 0.9rem;
}

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

.page-info {
    color: #475569;
    font-weight: 500;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-size label {
    color: #64748b;
    font-size: 0.9rem;
}

/* Column Selector Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 20px;
}

.columns-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.column-checkbox:hover {
    background-color: #f8fafc;
}

.column-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.column-checkbox span {
    color: #475569;
    font-size: 0.95rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Mobile message */
.mobile-message,
.error-message {
    padding: 40px 20px;
    text-align: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px;
}

.mobile-message p,
.error-message p {
    font-size: 1.1rem;
    color: #64748b;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .materials-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .materials-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
    }
}

