/* Product Sections Styles */
.product-sections {
    margin: 20px 0;
    font-family: 'Arial', sans-serif;
}

.sections-title {
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

/* Section Card Styles */
.section-card {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.section-card.section-incomplete {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.section-card.section-complete {
    border-color: #28a745;
    background-color: #f8fff9;
}

.section-card.section-exceeded {
    border-color: #ffc107;
    background-color: #fffbf0;
}

/* Section Header */
.section-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.section-title {
    margin: 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.section-limits {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.limit-text {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.section-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.section-status.incomplete {
    background-color: #dc3545;
    color: white;
}

.section-status.complete {
    background-color: #28a745;
    color: white;
}

.section-status.exceeded {
    background-color: #ffc107;
    color: #212529;
}

/* Section Products */
.section-products {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* Product Item */
.product-item {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
}

.product-item.selected {
    border-color: #007bff;
    background-color: #f0f8ff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.2);
}

.product-info {
    flex: 1;
}

.product-name {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.product-price {
    color: #007bff;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Product Controls */
.product-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-quantity {
    width: 32px;
    height: 32px;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.btn-quantity:hover {
    background: #007bff;
    color: white;
}

.btn-quantity:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
}

.product-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Sections Summary */
.sections-summary {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.selected-items h6 {
    color: #495057;
    margin-bottom: 10px;
    font-weight: 600;
}

.selected-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.selected-list li {
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
    color: #6c757d;
}

.selected-list li:last-child {
    border-bottom: none;
}

.total-amount {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #007bff;
    text-align: right;
}

.total-amount strong {
    color: #007bff;
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-limits {
        align-items: flex-start;
    }
    
    .section-products {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .product-controls {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .sections-title {
        font-size: 1.3rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .product-name {
        font-size: 0.9rem;
    }
    
    .btn-quantity {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* Animation for status changes */
.section-card {
    animation: statusChange 0.3s ease;
}

@keyframes statusChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Loading state */
.product-sections.loading {
    opacity: 0.6;
    pointer-events: none;
}

.product-sections.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.section-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
}

.section-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
}

/* Success message */
.section-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
}

/* Configure Sections Button */
.btn-configure-sections {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-configure-sections:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

/* Sections Summary */
#sections-summary {
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
}

#sections-selected-text {
    font-size: 0.9rem;
    color: #6c757d;
}

#sections-selected-text.has-selections {
    color: #28a745;
    font-weight: 500;
}

/* Sections Modal */
#sectionsModal .modal-header {
    background-color: #007bff;
    color: white;
    border-bottom: none;
}

#sectionsModal .modal-header .close {
    color: white;
    opacity: 0.8;
}

#sectionsModal .modal-header .close:hover {
    opacity: 1;
}

#sectionsModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

#sectionsModal .modal-footer {
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}