/* ===================================================================
   UNIVERSAL PRODUCT POPUP STYLES - v2.3 (Corrected for PHP/JS Structure)
   This file contains all styles for the popup functionality.
=================================================================== */

/* -- 1. Main Overlay and Modal Structure -- */
#product-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}
#product-popup-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 800px; /* Thoda chauda (wider) kiya gaya hai */
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    height: 600px; /* Fixed height for consistency */
}

/* -- 2. Open State -- */
body.popup-is-open #product-popup-overlay,
body.popup-is-open #product-popup-modal {
    opacity: 1;
    visibility: visible;
}
body.popup-is-open #product-popup-modal {
    transform: translate(-50%, -50%) scale(1);
}

/* -- 3. Close Button -- */
#product-popup-modal #product-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
	background-color: transparent !important;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}
#product-popup-modal #product-popup-close:hover {
    transform: rotate(90deg);
}

/* -- 4. Main Content Area (CORRECTED for JS structure) -- */
#product-popup-modal #product-popup-content {
    display: flex;
    flex-direction: column; /* <<< THIS IS THE MAIN FIX: Stacks content and footer vertically */
    overflow: hidden;
    flex-grow: 1;
    padding: 0;
}

/* YITH response se aaye content ko style karein */
#product-popup-modal .popup-content-area {
    padding: 20px 30px;
    overflow-y: auto; /* This area will scroll */
    flex-grow: 1;     /* This area will take up available space */
    display: flex;
    flex-direction: column;
}
#product-popup-modal .product_title {
    font-size: 24px !important;
    margin-bottom: 10px;
}
#product-popup-modal form.cart {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Form ko poori jagah lene dega */
    margin-top: 15px;
}
#product-popup-modal .variations,
#product-popup-modal .yith-wapo-block {
    margin-bottom: 20px;
}

/* This is no longer the main button container, but may be used by add-ons */
#product-popup-modal .single_variation_wrap {
    margin-top: auto; 
    padding-top: 20px;
    border-top: 1px solid #eee;
}
#product-popup-modal .single_add_to_cart_button {
    width: 100%;
    padding: 14px !important;
    font-size: 16px !important;
}

/* -- 5. Price, Quantity & Categories -- */
#product-popup-modal .price-quantity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
#product-popup-modal .popup-price {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a; /* <<< COLOR CHANGED TO BLACK */
    margin: 0;
}
#product-popup-modal .popup-quantity-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    height: 40px;
    overflow: hidden;
}
#product-popup-modal .popup-qty-btn {
    width: 36px;
    height: 40px;
    font-size: 20px;
    border: none;
    background: none;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
#product-popup-modal .popup-qty-input {
    width: 40px;
    height: 40px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    border: none;
    background: none;
    text-align: center;
    padding: 0;
    margin: 0;
    -moz-appearance: textfield;
}
#product-popup-modal .popup-qty-input::-webkit-outer-spin-button,
#product-popup-modal .popup-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#product-popup-modal .popup-terms-list {
    margin-bottom: 20px;
}
#product-popup-modal .popup-terms-list .term-item {
    display: inline-block;
    background-color: #f5f5f5;
    color: #555;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    margin: 0 6px 6px 0;
}

/* -- 6. Variations -- */
#product-popup-modal .popup-variations-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}
#product-popup-modal .popup-variations {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}
#product-popup-modal .popup-variation-item {
    flex-grow: 1;
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}
#product-popup-modal .popup-variation-item:hover {
    border-color: #eb424a; /* <<< COLOR CHANGED TO ORANGE */
    color: #eb424a;       /* <<< COLOR CHANGED TO ORANGE */
}
#product-popup-modal .popup-variation-item.selected {
    background-color: #eb424a; /* <<< COLOR CHANGED TO ORANGE */
    color: #fff;
    border-color: #eb424a;     /* <<< COLOR CHANGED TO ORANGE */
    font-weight: 600;
}

/* -- 7. YITH Add-ons Styles for Popup -- */
#product-popup-modal .popup-addons-container {
    margin-top: 16px;
    margin-bottom: 24px;
}
#product-popup-modal .yith-wapo-addon {
    margin-bottom: 15px !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
}
#product-popup-modal .yith-wapo-addon .addon-header {
    margin-bottom: 12px;
}
#product-popup-modal .yith-wapo-addon .wapo-addon-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
}
#product-popup-modal .yith-wapo-addon .wapo-addon-description {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
    margin-bottom: 12px;
}
#product-popup-modal .yith-wapo-option {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
#product-popup-modal .yith-wapo-option label.yith-wapo-addon-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-left: 10px;
    cursor: pointer;
}
#product-popup-modal .yith-wapo-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* -- 8. Add to Cart Button Footer (CORRECTED for JS Structure) -- */
#product-popup-modal .popup-actions {
    padding: 16px 24px;
    background-color: #ffffff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0; /* Prevents the footer from shrinking */
}
#product-popup-modal #popup-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px;
    background-color: #eb424a; /* <<< COLOR CHANGED TO ORANGE */
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
#product-popup-modal #popup-add-to-cart:hover {
    background-color: #eb424a; /* <<< COLOR CHANGED TO DARKER ORANGE */
}
#product-popup-modal #popup-add-to-cart:disabled {
    background-color: #a5a5a5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* -- 9. Loader -- */
#product-popup-modal .popup-loader::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 30px auto;
    border: 4px solid #f0f0f0;
    border-top-color: #eb424a; /* <<< COLOR CHANGED TO ORANGE */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* -- 10. Mobile Responsive Design -- */
@media (max-width: 600px) {
    #product-popup-modal {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        transform: translateY(100%);
        border-radius: 20px 20px 0 0;
        /* === MOBILE GAP FIX === */
        /* The height is now auto to fit the content, preventing blank space. */
        height: auto;
        max-height: 90vh; /* It can grow up to 90% of the screen height. */
    }
    body.popup-is-open #product-popup-modal {
        transform: translateY(0);
    }
    #product-popup-modal .popup-title {
        font-size: 20px;
    }
    #product-popup-modal .popup-variation-item {
        flex-grow: 0;
        flex-basis: calc(50% - 5px); /* Creates a two-column layout */
    }
}

