/* styles/main.css - Основні стилі для всього сайту */

/* Базові скидання та загальні стилі */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f6fa;
    line-height: 1.6;
    min-height: 100vh;
}

/* Заголовок сторінки */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.page-header h1 {
    font-size: 2.5em;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Контейнер */
.container {
    max-width: 1300px;
    margin: 2rem auto;
    padding: 0 2rem;
}
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
}
/* Карточки */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.card-header {
    background: #3498db;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 2rem;
}

/* Статистичні карточки */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    margin-top: 20px;
}

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

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

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #7f8c8d;
    font-weight: 500;
}

/* Заголовки секцій */
.section-title {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.section-header {
    background: #3498db;
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

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

.error {
    background: #e74c3c;
    color: white;
    padding: 20px;
    text-align: center;
    margin: 20px;
    border-radius: 10px;
}

/* Повідомлення (алерти) */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    font-weight: 500;
}

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

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

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* Індикатори статусу запасів */
.stock-good { 
    color: #27ae60; 
    font-weight: bold;
}

.stock-warning { 
    color: #f39c12; 
    font-weight: bold;
}

.stock-low { 
    color: #e74c3c; 
    font-weight: bold;
}

/* Адаптивність */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* Приховування стрілочок у number input полях */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Для Firefox */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield; /* Стандартна властивість для сумісності */
}

/* ===== СТИЛІ ДЛЯ РЕДАГУВАННЯ ВИРОБНИЦТВА ===== */

/* Кнопки дій в таблиці */
.action-buttons {
    text-align: center;
    white-space: nowrap;
    min-width: 200px;
}

.action-buttons .btn {
    margin: 0 2px;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

/* Малі кнопки */
.btn-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    min-height: 32px;
    border-radius: 4px;
}

.btn-sm:hover {
    transform: translateY(-1px);
}

/* Стилі модальних вікон */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: auto;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    position: relative;
}

.modal-large {
    max-width: 900px;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    color: #7f8c8d;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

/* Менші відступи для елементів форми в модальному вікні */
.modal .form-grid {
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal .form-group {
    margin-bottom: 0.75rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Спеціальний стиль для модального вікна скасування - має бути поверх інших модальних вікон */
#cancel-order-modal {
    z-index: 1100 !important;
}

/* Секції форми */
.form-section {
    margin: 1.5rem 0 1rem 0;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.form-section h3 {
    margin: 0 0 0.75rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Інформація про партію */
.batch-info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #495057;
}

.info-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Попередження */
.quantity-warning {
    display: block;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.delete-warning {
    text-align: center;
    padding: 1rem 0;
}

.production-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.warnings-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    color: #856404;
}

/* Адаптивність для малих екранів */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5%;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-buttons {
        min-width: auto;
    }
    
    .action-buttons .btn {
        margin: 2px 0;
        display: block;
        width: 100%;
    }
    
    .batch-info-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .card-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* ===== Статуси проведення документів ===== */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.status-badge.posted {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.status-badge.posted::before {
    content: '✓ ';
    font-weight: bold;
}

.status-badge.draft {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(148, 163, 184, 0.3);
}

.status-badge.draft::before {
    content: '○ ';
}

.status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}