/**
 * AlanOps One Page Checkout - CSS Styles
 * Comprehensive styling for the checkout interface
 */

/* Loading States */
.cart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2a2a3e;
    border-top: 3px solid #64ffda;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-spinner + p {
    color: #64ffda;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Button Loading States */
.qty-btn.loading,
.remove-btn.loading {
    opacity: 0.8;
    cursor: wait;
    /* Removed pointer-events: none to allow interaction */
}

.qty-btn.loading::after,
.remove-btn.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 5px;
}

/* Message Notifications */
.cart-message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 600;
    animation: slideInFromTop 0.3s ease-out;
}

.cart-message-success {
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid #64ffda;
    color: #64ffda;
}

.cart-message-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

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

/* Enhanced Button Interactions */
.qty-btn {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(100, 255, 218, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.qty-btn:hover::before {
    width: 100%;
    height: 100%;
}

.remove-btn {
    transition: all 0.2s ease;
    position: relative;
}

.remove-btn:active {
    transform: scale(0.9);
}

.remove-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.remove-btn:hover::before {
    opacity: 1;
}

/* Quantity Input Enhancements */
.qty-input {
    transition: all 0.2s ease;
}

.qty-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.3);
}

.qty-input:invalid {
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

/* Cart Item Hover Effects */
.cart-item {
    transition: all 0.3s ease;
    position: relative;
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(100, 255, 218, 0.1);
}

.cart-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.05), rgba(77, 201, 176, 0.05));
    opacity: 0;
    border-radius: 10px;
    transition: opacity 0.3s ease;
}

.cart-item:hover::before {
    opacity: 1;
}

/* Checkout Form Enhancements */
.checkout-form-section {
    position: relative;
}

.checkout-form-section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #64ffda, #4dc9b0);
    opacity: 0;
    border-radius: 22px;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.checkout-form-section:hover::before {
    opacity: 0.1;
}

/* Form Field Styling */
.woocommerce-checkout .form-row {
    margin-bottom: 20px;
}

.woocommerce-checkout .form-row input[type="text"],
.woocommerce-checkout .form-row input[type="email"],
.woocommerce-checkout .form-row input[type="tel"],
.woocommerce-checkout .form-row select,
.woocommerce-checkout .form-row textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #2a2a3e;
    border-radius: 8px;
    background: #0a0a0f;
    color: #ccd6f6;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.woocommerce-checkout .form-row input:focus,
.woocommerce-checkout .form-row select:focus,
.woocommerce-checkout .form-row textarea:focus {
    border-color: #64ffda;
    outline: none;
    box-shadow: 0 0 0 3px rgba(100, 255, 218, 0.1);
}

.woocommerce-checkout .form-row label {
    display: block;
    margin-bottom: 8px;
    color: #8892b0;
    font-weight: 600;
    font-size: 0.9rem;
}

.woocommerce-checkout .form-row .required {
    color: #e74c3c;
}

/* Payment Method Styling */
.woocommerce-checkout .payment_methods {
    background: #1a1a2e;
    border: 2px solid #2a2a3e;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.woocommerce-checkout .payment_methods li {
    background: #0a0a0f;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.woocommerce-checkout .payment_methods li:hover {
    border-color: #64ffda;
    background: rgba(100, 255, 218, 0.05);
}

.woocommerce-checkout .payment_methods li label {
    color: #ccd6f6;
    cursor: pointer;
}

.woocommerce-checkout .payment_methods li input[type="radio"]:checked + label {
    color: #64ffda;
}

/* Place Order Button */
#place_order {
    width: 100%;
    padding: 18px 40px;
    background: linear-gradient(135deg, #64ffda, #4dc9b0);
    color: #0a0a0f;
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#place_order:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(100, 255, 218, 0.4);
}

#place_order:active {
    transform: translateY(0);
}

#place_order:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#place_order::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

#place_order:hover::before {
    width: 120%;
    height: 120%;
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-block;
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    80%, 100% { opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .alanops-one-page-checkout {
        padding: 20px 10px;
    }
    
    .checkout-cart-section,
    .checkout-form-section {
        padding: 20px;
    }
    
    .cart-item {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .item-details {
        width: 100%;
    }
    
    .item-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .quantity-controls {
        flex: 1;
        max-width: 150px;
    }
    
    .cart-totals {
        font-size: 0.9rem;
    }
    
    .cart-totals .total {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .alanops-one-page-checkout h2 {
        font-size: 1.4rem;
    }
    
    .item-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .quantity-controls {
        max-width: none;
        align-self: stretch;
    }
    
    .qty-input {
        width: 80px;
    }
}

/* Accessibility Improvements */
.qty-btn:focus,
.remove-btn:focus {
    outline: 2px solid #64ffda;
    outline-offset: 2px;
}

.qty-input:focus {
    outline: 2px solid #64ffda;
    outline-offset: 1px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .cart-item {
        border-color: #64ffda;
    }
    
    .qty-btn,
    .remove-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Print Styles */
@media print {
    .qty-btn,
    .remove-btn,
    .cart-loading-overlay {
        display: none !important;
    }
    
    .cart-item {
        break-inside: avoid;
    }
}