/* styles/operations.css - Стилі для сторінки операцій */



/* Фільтри операцій */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.filter-group input,
.filter-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    justify-content: center;
}

/* Статистика операцій */
.stats-section {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

/* Таблиця операцій */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
}

.records-count {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 800px;
}

.data-table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: bold;
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: all 0.2s ease;
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
}

/* Комірки з датою та часом */
.datetime-cell {
    min-width: 120px;
}

.datetime-cell .date {
    font-weight: 500;
    color: #2c3e50;
}

.datetime-cell .time {
    font-size: 0.85em;
    color: #7f8c8d;
}

/* Бейджі типів операцій */
.operation-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
    white-space: nowrap;
}

.operation-badge.create {
    background: #d4edda;
    color: #155724;
}

.operation-badge.update {
    background: #fff3cd;
    color: #856404;
}

.operation-badge.delete {
    background: #f8d7da;
    color: #721c24;
}

.operation-badge.production {
    background: #cce5ff;
    color: #004085;
}

.operation-badge.writeoff {
    background: #f5c6cb;
    color: #721c24;
}

.operation-badge.arrival {
    background: #d1ecf1;
    color: #0c5460;
}

.operation-badge.default {
    background: #e2e3e5;
    color: #383d41;
}

/* Бейджі сутностей */
.entity-badge {
    background: #f8f9fa;
    color: #495057;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    text-transform: uppercase;
}

/* Комірки з описом */
.description-cell {
    max-width: 300px;
    word-wrap: break-word;
    line-height: 1.4;
}

.description-cell small {
    color: #7f8c8d;
    font-size: 0.8em;
}

/* Комірки з користувачами */
.user-cell {
    min-width: 150px;
}

.user-cell strong {
    color: #2c3e50;
}

.user-cell small {
    color: #7f8c8d;
    font-size: 0.8em;
}

/* Стани завантаження та помилок */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

.no-data {
    text-align: center;
    padding: 3rem 1rem;
    color: #7f8c8d;
    font-style: italic;
}

.no-data::before {
    content: '📝';
    display: block;
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background: #f8d7da;
    border-radius: 4px;
    margin: 1rem 0;
    border: 1px solid #f5c6cb;
}

/* Модальні вікна для деталей */
.modal-large {
    max-width: 900px;
}

.detail-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    margin-bottom: 15px;
    color: #3498db;
    font-size: 1.2rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item strong {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.9rem;
}

.detail-item span,
.detail-item p {
    color: #2c3e50;
}

/* JSON дані */
.json-data {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* Статистика в модальному вікні */
.stats-overview {
    margin-bottom: 30px;
}

.stats-table {
    overflow-x: auto;
}

.stats-table .data-table {
    min-width: 600px;
}

/* Адаптивність */
@media (max-width: 1024px) {
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.6rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 2em;
    }
    
    .page-header p {
        font-size: 1em;
    }
    
    .filters-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .filter-actions {
        grid-column: 1;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .datetime-cell {
        min-width: 100px;
    }
    
    .description-cell {
        max-width: 200px;
    }
    
    .user-cell {
        min-width: 120px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.5em;
    }
    
    .filters-section {
        padding: 15px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .data-table {
        min-width: 500px;
        font-size: 0.75rem;
    }
    
    .operation-badge {
        font-size: 0.7em;
        padding: 3px 6px;
    }
    
    .entity-badge {
        font-size: 0.65em;
        padding: 1px 4px;
    }
    
    .modal-large {
        max-width: 95%;
    }
}