/* styles/shipments.css - Стилі для сторінки відвантажень */

/* Контрольна панель */
.shipments-controls-card {
    margin-bottom: 1.5rem;
}

.shipments-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    padding-bottom: 0.5rem;
}

.controls-left {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    align-items: flex-start;
}

.controls-right {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-top: 1.75rem;
}

.controls-left .form-group {
    margin-bottom: 0;
    flex: 1;
    max-width: 200px;
}

.controls-left .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
    width: 100%;
}

.controls-left .form-group input,
.controls-left .form-group select {
    width: 100%;
}

/* Статистичні картки */
.shipments-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow);
}

.stat-ready {
    border-left-color: var(--success);
}

.stat-today {
    border-left-color: var(--primary);
}

.stat-pending {
    border-left-color: var(--warning);
}

.stat-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 50px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    flex: 1;
    text-align: left;
}

/* Таблиця готових замовлень */
.table-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
}

.ready-order {
    transition: all 0.3s ease;
}

.ready-order:hover {
    background: #f8f9fa;
}

/* Стилі для комірок таблиці */
.order-number {
    font-weight: bold;
    color: var(--primary);
    font-size: 1rem;
}

.order-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.client-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.client-contact {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.delivery-date {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.delivery-date.urgent {
    color: var(--danger);
    font-weight: bold;
}

.delivery-date.soon {
    color: var(--warning);
    font-weight: 600;
}

.delivery-date.normal {
    color: var(--text-primary);
}

.total-quantity {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Статусні значки */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-ready {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-in-progress {
    background: #fff3e0;
    color: #f57c00;
}
.status-shipped {
    background: #e1f5fe;
    color: #0288d1;
}
.status-completed {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Кнопки дій */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-width: auto;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    margin-top: 5px;
}

/* Порожній стан */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Анімації */
.ready-order {
    animation: orderSlideIn 0.3s ease;
}

@keyframes orderSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    animation: pulse 2s infinite;
}

/* Стилі для модального вікна деталей відвантаження */
.shipment-details {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.details-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.details-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

/* Сітка інформації про замовлення */
.order-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-item span {
    font-weight: 600;
    color: var(--text-primary);
}

.order-number-large {
    font-size: 1.2rem !important;
    color: var(--primary) !important;
}

.total-summary {
    font-size: 1.1rem !important;
    color: var(--success) !important;
}

/* Дати доставки з кольоровим кодуванням */
.delivery-date-urgent {
    color: var(--danger) !important;
    font-weight: bold !important;
}

.delivery-date-soon {
    color: var(--warning) !important;
    font-weight: 600 !important;
}

.delivery-date-normal {
    color: var(--text-primary) !important;
}

/* Інформація про доставку */
.delivery-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.delivery-address,
.delivery-notes,
.special-requirements {
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid var(--info);
}

.special-requirements {
    border-left-color: var(--warning);
    background: #fffbf0;
}

/* Список товарів */
.items-list {
    display: flex;
    flex-direction: column;  
    gap: 1.5rem;
}

.detail-item {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.item-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.item-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.item-code {
    font-family: monospace;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.item-quantity {
    font-weight: bold;
    color: var(--primary);
    font-size: 1rem;
}

/* Партії товарів */
.item-batches h5 {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}

.batch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.batch-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.batch-item.batch-urgent {
    background: #fdf2f2;
    border-left-color: var(--danger);
}

.batch-item.batch-warning {
    background: #fffbf0;
    border-left-color: var(--warning);
}

.batch-item.batch-ok {
    background: #f0f9f0;
    border-left-color: var(--success);
}

.batch-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.batch-id {
    font-family: monospace;
    font-weight: bold;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.batch-quantity {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.batch-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.batch-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.batch-info small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.batch-location {
    font-size: 0.875rem;
    color: var(--info);
    font-weight: 500;
}

/* Інструкції для складу */
.warehouse-summary {
    border-left-color: var(--warning) !important;
    background: #fffbf0 !important;
}

.warehouse-instructions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.instruction-item {
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid var(--info);
}

.instruction-item.urgent {
    border-left-color: var(--danger);
    background: #fdf2f2;
}

.instruction-item strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.instruction-item p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Анімації для сповіщень */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Стилі для діалогу підтвердження відвантаження */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.confirmation-dialog {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
}

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

.confirmation-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.confirmation-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    flex: 1;
}

.confirmation-icon {
    font-size: 2rem;
    color: var(--warning);
}

.order-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.order-summary h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-item label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-item span {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-total {
    font-size: 1.1rem !important;
    color: var(--success) !important;
}

.warning-note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.warning-note .warning-icon {
    color: var(--warning);
    font-size: 1.2rem;
    margin-top: 0.125rem;
}

.warning-text {
    flex: 1;
}

.warning-text strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.warning-text p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.4;
}

.confirmation-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.confirmation-actions .btn {
    min-width: 120px;
}

/* Індикатор обробки відвантаження */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(6px);
}

.processing-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: processingPulse 2s infinite;
}

@keyframes processingPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.processing-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e9ecef;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.processing-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.processing-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Анімації для успішного завершення */
.success-checkmark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
    margin: 0 auto 1rem;
    animation: checkmarkBounce 0.6s ease-in-out;
}

.success-checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

@keyframes checkmarkBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Мобільні картки за замовчуванням приховані */
.mobile-cards {
    display: none;
}

/* Адаптивність */
@media (max-width: 768px) {
    .shipments-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding-bottom: 0;
    }
    
    .controls-left {
        flex-direction: column;
        gap: 1rem;
    }
    
    .controls-left .form-group {
        max-width: none;
    }
    
    .controls-left .form-group label {
        text-align: left;
    }
    
    .controls-right {
        justify-content: center;
        margin-top: 0;
    }
    
    .shipments-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
    
    .stat-card {
        padding: 0.625rem 1rem;
        min-height: 50px;
    }
    
    .stat-number {
        font-size: 1.5rem;
        min-width: 40px;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Мобільна версія таблиці */
    .table-container {
        overflow-x: auto;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-small {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        min-height: 34px;
    }
    
    /* Компактний вигляд для мобільних */
    .order-number {
        font-size: 0.875rem;
    }
    
    .client-name {
        font-size: 0.875rem;
    }
    
    .total-quantity {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    /* Картковий вигляд для дуже маленьких екранів */
    .table-container {
        display: none;
    }
    
    .mobile-cards {
        display: block;
    }
    
    .order-card {
        background: var(--surface);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px var(--shadow);
    }
    
    .order-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }
    
    .order-card-body {
        margin-bottom: 1rem;
    }
    
    .order-card-footer {
        display: flex;
        gap: 0.5rem;
    }
    
    .info-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }
    
    .info-row strong {
        color: var(--text-secondary);
        font-size: 0.875rem;
        min-width: 80px;
    }
    
    .info-row span {
        color: var(--text-primary);
        font-weight: 500;
        text-align: right;
        flex: 1;
    }
    
    .info-row .order-date {
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: normal;
    }
    
    /* Мобільні стилі для модального вікна деталей */
    .shipment-details {
        max-height: 60vh;
        padding-right: 5px;
    }
    
    .details-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .order-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .item-summary {
        align-items: flex-start;
        width: 100%;
    }
    
    .batch-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .batch-details {
        align-items: flex-start;
        width: 100%;
    }
    
    .batch-info {
        align-items: flex-start;
    }
    
    .warehouse-instructions {
        gap: 0.75rem;
    }
    
    .instruction-item {
        padding: 0.75rem;
    }
    
    /* Мобільна адаптація діалогу підтвердження */
    .confirmation-dialog {
        padding: 1.5rem;
        width: 95%;
        max-height: 85vh;
    }
    
    .confirmation-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    
    .confirmation-header h3 {
        font-size: 1.1rem;
    }
    
    .confirmation-icon {
        font-size: 1.5rem;
    }
    
    .order-summary {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .warning-note {
        padding: 0.75rem;
        margin-bottom: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .warning-icon {
        align-self: center;
    }
    
    .confirmation-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
    
    .confirmation-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .processing-content {
        padding: 1.5rem;
        width: 90%;
        max-width: 300px;
    }
    
    .processing-spinner {
        width: 50px;
        height: 50px;
    }
    
    .processing-text {
        font-size: 1rem;
    }
    
    .processing-details {
        font-size: 0.85rem;
    }
}