/**
 * Porto Stock Ordering Styles
 * 
 * @package Porto_Stock_Ordering
 * @since 1.0.0
 */

/* Loading indicator */
.porto-stock-ordering-loading {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #666;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 20px 0;
}

.porto-stock-ordering-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: porto-stock-ordering-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes porto-stock-ordering-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Out of stock product styling */
.porto-stock-ordering-active .product.outofstock {
    opacity: 0.7;
    position: relative;
}

.porto-stock-ordering-active .product.outofstock:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 1;
}

/* Stock status indicator */
.porto-stock-ordering-active .product .stock-status {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 3px;
    margin-top: 5px;
}

.porto-stock-ordering-active .product .stock-status.instock {
    background: #4CAF50;
    color: white;
}

.porto-stock-ordering-active .product .stock-status.outofstock {
    background: #f44336;
    color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .porto-stock-ordering-loading {
        padding: 15px;
        font-size: 14px;
    }
    
    .porto-stock-ordering-active .product .stock-status {
        font-size: 10px;
        padding: 1px 6px;
    }
}

/* Integration with Porto theme */
.porto-stock-ordering-active .archive-products .products {
    transition: opacity 0.3s ease;
}

.porto-stock-ordering-active .archive-products .products.loading {
    opacity: 0.5;
}

/* Custom ordering dropdown styling */
.woocommerce-ordering select.orderby option[value="stock_status"] {
    font-weight: bold;
}

/* Stock ordering section separator */
.porto-stock-ordering-active .products:after {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin: 20px 0;
    opacity: 0.5;
}

/* Enhanced out of stock section */
.porto-stock-ordering-active .products .out-of-stock-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.porto-stock-ordering-active .products .out-of-stock-section:before {
    content: 'Out of Stock Products';
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    margin-bottom: 15px;
    text-align: center;
}

/* Animation for product appearance */
.porto-stock-ordering-active .product {
    animation: porto-stock-ordering-fadeIn 0.5s ease-in;
}

@keyframes porto-stock-ordering-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for product grid */
.porto-stock-ordering-active .product:nth-child(1) { animation-delay: 0.1s; }
.porto-stock-ordering-active .product:nth-child(2) { animation-delay: 0.2s; }
.porto-stock-ordering-active .product:nth-child(3) { animation-delay: 0.3s; }
.porto-stock-ordering-active .product:nth-child(4) { animation-delay: 0.4s; }
.porto-stock-ordering-active .product:nth-child(5) { animation-delay: 0.5s; }
.porto-stock-ordering-active .product:nth-child(6) { animation-delay: 0.6s; }

/* Pagination improvements */
.porto-stock-ordering-active .woocommerce-pagination {
    margin-top: 30px;
    text-align: center;
}

.porto-stock-ordering-active .woocommerce-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
}

.porto-stock-ordering-active .woocommerce-pagination .page-numbers:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.porto-stock-ordering-active .woocommerce-pagination .page-numbers.current {
    background: #007cba;
    border-color: #007cba;
    color: white;
    font-weight: bold;
}

.porto-stock-ordering-active .woocommerce-pagination .page-numbers.prev,
.porto-stock-ordering-active .woocommerce-pagination .page-numbers.next {
    font-weight: bold;
}

/* Pagination loading state */
.porto-stock-ordering-active .woocommerce-pagination.loading {
    opacity: 0.6;
    pointer-events: none;
}

.porto-stock-ordering-active .woocommerce-pagination.loading .page-numbers {
    background: #f8f9fa;
    color: #6c757d;
}

/* Smooth pagination transitions */
.porto-stock-ordering-active .archive-products {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.porto-stock-ordering-active .archive-products.loading {
    opacity: 0.7;
    transform: translateY(10px);
}
