/* styles/batches.css - Сучасний дизайн для відображення партій */

/* Основна сітка товарів з партіями */
.pizzas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

/* Картка товару з партіями */
.pizza-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pizza-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 16px 16px 0 0;
}

.pizza-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.06);
}

.pizza-card.has-expiring {
    border-color: #f39c12;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.pizza-card.has-expiring::before {
    background: linear-gradient(90deg, #f39c12, #e74c3c);
}

.pizza-card.has-expired {
    border-color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Заголовок товару */
.pizza-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pizza-name::before {
    content: '🍕';
    font-size: 1.1em;
}

/* Основна інформація про запаси */
.pizza-all {
    font-size: 1.3rem;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 0.25rem;
    color: #4e783a;
}
.pizza-stock {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pizza-stock.stock-good {
    color: #27ae60;
}

.pizza-stock.stock-warning {
    color: #f39c12;
}

.pizza-stock.stock-low {
    color: #e74c3c;
}

.pizza-stock::before {
    content: '📦';
    font-size: 0.8em;
}

/* Деталі товару */
.pizza-details {
    background: rgba(52, 152, 219, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #34495e;
    border-left: 3px solid #3498db;
}

/* Контейнер партій */
.batches-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e9ecef;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Заголовок з кнопкою toggle */
.batches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.batches-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batches-title::before {
    content: '📋';
    font-size: 1em;
}

/* Кнопка toggle */
.batches-toggle {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.batches-toggle:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f4e79 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.batches-toggle:active {
    transform: translateY(0);
}

/* Список партій з анімацією */
.batches-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.batches-list.expanded {
    max-height: 500px;
    opacity: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease 0.1s;
}

.batches-list:not(.expanded) {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.2s ease;
}

/* Окрема партія */
.batch-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.batch-item:last-child {
    margin-bottom: 0;
}

.batch-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 10px 0 0 10px;
}

.batch-item.active::before {
    background: linear-gradient(180deg, #27ae60, #2ecc71);
}

.batch-item.expiring::before {
    background: linear-gradient(180deg, #f39c12, #e67e22);
}

.batch-item.expired::before {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
}

.batch-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

/* Інформація про партію */
.batch-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.batch-date {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.batch-date::before {
    content: '📅';
    font-size: 0.8em;
}

.batch-details {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.batch-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-status.active {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
}

.batch-status.expiring {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
}

.batch-status.expired {
    background: linear-gradient(135deg, #f8d7da, #f1aeb5);
    color: #721c24;
}

/* Кількість в партії */
.batch-quantity {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.batch-quantity-main {
    font-size: 1.1rem;
    font-weight: 700;
    color: #27ae60;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.batch-quantity-main::before {
    content: '📊';
    font-size: 0.8em;
}

.batch-quantity-sub {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Попередження про терміни */
.expiry-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0.75rem 0;
    border-left: 3px solid #f39c12;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expiry-warning.critical {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left-color: #e74c3c;
}

/* Стан відсутності партій */
.batches-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #7f8c8d;
    font-style: italic;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    font-size: 0.9rem;
}

.batches-empty::before {
    content: '📦';
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Завантаження партій */
.batches-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #7f8c8d;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.batches-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Скролбар для списку партій */
.batches-list::-webkit-scrollbar {
    width: 6px;
}

.batches-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.batches-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3498db, #2980b9);
    border-radius: 3px;
}

.batches-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2980b9, #1f4e79);
}

/* Підсумок партій */
.batches-summary {
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Адаптивність для планшетів */
@media (max-width: 1024px) {
    .pizzas-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 1.5rem;
    }
    
    .pizza-card {
        padding: 1.25rem;
    }
}

/* Адаптивність для мобільних */
@media (max-width: 768px) {
    .pizzas-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem 0;
    }
    
    .pizza-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .pizza-name {
        font-size: 1.1rem;
    }
    
    .pizza-stock {
        font-size: 1.3rem;
    }
    
    .batch-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .batch-quantity {
        text-align: left;
    }
    
    .batch-details {
        gap: 0.5rem;
    }
    
    .batches-list {
        max-height: 200px;
        padding-right: 0.25rem;
    }
}

/* Анімації */
@keyframes spin {
    to { 
        transform: rotate(360deg); 
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pizza-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.pizza-card:nth-child(odd) {
    animation-delay: 0.1s;
}

.pizza-card:nth-child(even) {
    animation-delay: 0.2s;
}

/* Спеціальні індикатори */
.stock-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

.stock-indicator.good {
    background: #27ae60;
}

.stock-indicator.warning {
    background: #f39c12;
    animation: pulse 2s infinite;
}

.stock-indicator.low {
    background: #e74c3c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 0 6px transparent;
    }
    50% {
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 0 6px rgba(231, 76, 60, 0.3);
    }
}

/* Стилі для header і toggle кнопки партій */
.batches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.batches-toggle {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.batches-toggle:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f618d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.batches-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.batches-summary {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

/* ============================================ */
/* АДАПТИВНІСТЬ ДЛЯ СЕКЦІЇ ІМПОРТУ XML */
/* ============================================ */

/* На десктопі показуємо блок автоматичного імпорту */
.desktop-only-section {
    display: block;
}

/* На мобільних пристроях ховаємо блок автоматичного імпорту */
@media (max-width: 768px) {
    .desktop-only-section {
        display: none !important;
    }
}

/* ===== АДАПТИВНІ КАРТКИ ВИРОБНИЦТВ ДЛЯ МОБІЛЬНИХ ===== */

/* Приховуємо картки на великих екранах */
.table-cards {
    display: none;
}

/* Картка виробництва для мобільних */
.production-card {
    background: white;
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.production-card .table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.production-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    flex: 1;
    margin-right: 0.5rem;
}

.production-card .status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.production-card .status-badge.posted {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
}

.production-card .status-badge.draft {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
}

.production-card .table-card-body {
    display: flex;
    flex-direction: column;
}

.production-card .table-card-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.9rem;
    line-height: 1.4;
}

.production-card .table-card-label {
    font-weight: 600;
    color: #495057;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.production-card .table-card-value {
    color: #2c3e50;
    text-align: right;
    flex: 1;
}

.production-card .table-card-value strong {
    color: #27ae60;
    font-size: 1.05em;
}

.production-card .table-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.production-card .table-card-actions .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    flex: 1;
    min-width: 80px;
    white-space: nowrap;
}

.production-card .batch-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.production-card .batch-status.active {
    background: #d4edda;
    color: #155724;
}

/* Медіа-запити для адаптивності */
@media (max-width: 768px) {
    /* Приховуємо таблицю на планшетах і менших екранах */
    .table-responsive-stack {
        display: none;
    }

    /* Показуємо картки */
    .table-cards {
        display: block;
    }

    .production-card {
        padding: 0.875rem;
    }

    .production-card-title {
        font-size: 1rem;
    }

    .production-card .table-card-row {
        font-size: 0.85rem;
    }

    .production-card .table-card-actions {
        gap: 0.4rem;
    }

    .production-card .table-card-actions .btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    /* Дуже маленькі екрани - ще більш компактні картки */
    .production-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .production-card-title {
        font-size: 0.95rem;
    }

    .production-card .table-card-row {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .production-card .table-card-label {
        margin-bottom: 0.1rem;
    }

    .production-card .table-card-value {
        text-align: right;
        padding-left: 0.5rem;
    }

    .production-card .table-card-actions {
        flex-direction: row;
        gap: 0.3rem;
    }

    .production-card .table-card-actions .btn {
        width: 100%;
        min-width: auto;
    }
}