/**
 * Custom Checkout Styles
 * Enhanced WooCommerce checkout styling
 */

/* Hide Billing Details Section on All Checkout Pages */
.woocommerce-billing-fields,
.woocommerce-billing-fields__field-wrapper,
#customer_details .col-1,
.checkout_coupon,
.woocommerce-form-coupon-toggle,
.woocommerce-additional-fields,
.woocommerce-additional-fields h3,
.woocommerce-additional-fields .form-row,
#order_comments_field,
#order_comments,
.additional-fields,
h3:contains("Billing details"),
h3:contains("Additional information"),
.woocommerce-form-login-toggle,
.woocommerce-info,
.showlogin,
#customer_details,
.woocommerce-checkout #customer_details,
.col2-set#customer_details {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide billing fields by ID and name attributes */
[id*="billing_"]:not([id="billing_method"]),
[name*="billing_"]:not([name="billing_method"]),
label[for*="billing"]:not([for="billing_method"]) {
    display: none !important;
}

/* Hide form rows containing billing fields */
.form-row:has([id*="billing_"]):not(:has([id="billing_method"])) {
    display: none !important;
}

/* Adjust layout for single column when billing is hidden */
#customer_details,
#customer_details .col-2 {
    width: 100% !important;
    float: none !important;
}

/* Ensure payment section stays visible and centered */
.woocommerce-checkout-payment {
    display: block !important;
    max-width: 600px;
    margin: 20px auto;
}

/* Ensure order review stays visible */
.woocommerce-checkout-review-order {
    display: block !important;
}

/* Checkout Container */
.woocommerce-checkout {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Youzify Checkout Header */
.studyhub-checkout-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #007cba 0%, #00a0d2 100%);
    color: white;
    border-radius: 8px;
}

.studyhub-checkout-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.studyhub-checkout-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

/* Form Styling */
.woocommerce-checkout .form-row {
    margin-bottom: 20px;
}

.woocommerce-checkout .form-row label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.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: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.woocommerce-checkout .form-row input:focus,
.woocommerce-checkout .form-row select:focus,
.woocommerce-checkout .form-row textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Required field indicator */
.woocommerce-checkout .form-row .required {
    color: #e74c3c;
}

/* Checkout columns */
.woocommerce-checkout .col2-set {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.woocommerce-checkout .col-1,
.woocommerce-checkout .col-2 {
    flex: 1;
}

/* Order review section */
.woocommerce-checkout-review-order {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.woocommerce-checkout-review-order h3 {
    margin-top: 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.woocommerce-checkout-review-order-table {
    width: 100%;
    margin-bottom: 20px;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e1e5e9;
}

.woocommerce-checkout-review-order-table .cart_item {
    background: white;
}

.woocommerce-checkout-review-order-table .order-total {
    background: #e8f4f8;
    font-weight: 600;
    font-size: 18px;
}

.woocommerce-checkout-review-order-table .order-total td {
    color: #007cba;
}

/* Payment methods */
.woocommerce-checkout #payment {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.woocommerce-checkout #payment .payment_methods {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-checkout #payment .payment_method {
    margin-bottom: 15px;
    padding: 15px;
    border: 2px solid #f1f3f4;
    border-radius: 6px;
    transition: border-color 0.3s ease;
}

.woocommerce-checkout #payment .payment_method:hover,
.woocommerce-checkout #payment .payment_method.selected {
    border-color: #007cba;
    background: #f8fcfe;
}

.woocommerce-checkout #payment .payment_method label {
    display: flex;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
}

.woocommerce-checkout #payment .payment_method input[type="radio"] {
    margin-right: 10px;
}

/* Place order button */
.woocommerce-checkout #place_order {
    background: linear-gradient(135deg, #007cba 0%, #00a0d2 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.woocommerce-checkout #place_order:hover {
    background: linear-gradient(135deg, #005a87 0%, #007cba 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.3);
}

.woocommerce-checkout #place_order:active {
    transform: translateY(0);
}

/* Loading state */
.woocommerce-checkout .blockUI.blockOverlay {
    background: rgba(255, 255, 255, 0.8) !important;
}

/* Checkout footer */
.studyhub-checkout-footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.studyhub-checkout-footer p {
    margin: 0;
    color: #666;
}

/* Error messages */
.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    border-left: 4px solid;
}

.woocommerce-error {
    background: #fef2f2;
    border-left-color: #e74c3c;
    color: #c53030;
}

.woocommerce-message {
    background: #f0fff4;
    border-left-color: #38a169;
    color: #2d7d32;
}

.woocommerce-info {
    background: #f7fafc;
    border-left-color: #3182ce;
    color: #2c5aa0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .woocommerce-checkout {
        padding: 15px;
    }
    
    .woocommerce-checkout .col2-set {
        flex-direction: column;
        gap: 20px;
    }
    
    .studyhub-checkout-header h1 {
        font-size: 24px;
    }
    
    .studyhub-checkout-header p {
        font-size: 14px;
    }
    
    .woocommerce-checkout #place_order {
        padding: 15px 30px;
        font-size: 16px;
    }
    
    .woocommerce-checkout-review-order {
        padding: 20px;
    }
}

/* Animation for smooth loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.woocommerce-checkout .col2-set,
.woocommerce-checkout-review-order {
    animation: fadeInUp 0.6s ease-out;
}

/* Youzify-specific enhancements */
body.youzify-checkout {
    background: #f8f9fa;
}

.youzify-checkout .woocommerce-checkout {
    max-width: 900px;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
}

/* Custom field styling for Youzify */
.youzify-checkout-field {
    position: relative;
}

.youzify-checkout-field input:focus + label,
.youzify-checkout-field select:focus + label {
    color: #007cba;
}

/* Youzify Checkout Billing Management */
.youzify-checkout .billing-info-summary {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
    animation: fadeIn 0.3s ease;
}

.youzify-checkout .billing-info-summary h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.youzify-checkout .billing-info-summary p {
    margin: 8px 0;
    color: #555;
}

.youzify-checkout .billing-info-summary small {
    color: #6c757d;
    font-size: 14px;
}

.youzify-checkout #change-billing-address {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.youzify-checkout #change-billing-address:hover {
    color: #005a87;
    text-decoration: underline;
}

.youzify-checkout .billing-edit-actions {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.youzify-checkout .billing-edit-actions .button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.youzify-checkout .billing-edit-actions .button:hover {
    background: #5a6268;
}

/* Hidden billing fields styling */
.youzify-checkout .hidden-billing-field {
    display: none !important;
}

/* When billing fields are shown for editing */
.youzify-checkout .woocommerce-billing-fields {
    animation: slideDown 0.4s ease;
}

.youzify-checkout .woocommerce-billing-fields h3 {
    color: #007cba;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Simplified checkout layout for Youzify */
.youzify-checkout .woocommerce-checkout .col2-set {
    width: 100%;
    margin-bottom: 30px;
}

.youzify-checkout .woocommerce-checkout .col-1,
.youzify-checkout .woocommerce-checkout .col-2 {
    width: 100%;
    float: none;
    margin-right: 0;
}

.youzify-checkout .woocommerce-checkout #order_review_heading,
.youzify-checkout .woocommerce-checkout #order_review {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Additional animations for billing management */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Inline layout for payment and order summary */
#payment.woocommerce-checkout-payment,
#order_review.woocommerce-checkout-review-order {
    display: inline-block;
    vertical-align: top;
    margin: 0;
}

#payment.woocommerce-checkout-payment {
    width: 70%;
    padding-right: 20px;
    box-sizing: border-box;
}

#order_review.woocommerce-checkout-review-order {
    width: 30%;
    padding-left: 20px;
    box-sizing: border-box;
}

/* Container for the inline layout */
.woocommerce-checkout form.checkout {
    display: block;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    #payment.woocommerce-checkout-payment,
    #order_review.woocommerce-checkout-review-order {
        display: block;
        width: 100%;
        padding: 0;
        margin-bottom: 20px;
    }
}
