/* Customize T-shirt Modal Styles */

/* Prevent body scroll when modal is open */
body.customize-modal-open {
    overflow: hidden;
}

/* Modal overlay - full screen background */
.customize-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 999999 !important;
    display: none !important;
}

/* Show modal when it has the 'show' class */
.customize-modal-overlay.show {
    display: block !important;
}

/* Modal container - full screen */
.customize-modal-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: #fff !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Floating close button */
.customize-modal-overlay.show .customize-modal-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 1000000 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid #333 !important;
    color: #333 !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

.customize-modal-overlay.show .customize-modal-close:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

/* Hide close button when modal is not shown */
.customize-modal-close {
    display: none !important;
}

/* Modal header - Hidden since iframe has its own header */
.customize-modal-header {
    display: none;
}

/* Modal content - contains the iframe */
.customize-modal-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Iframe styling */
#customize-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Design now button styling - custom colors */
#design-now-button {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    background-color: #1F3328 !important;
    color: #67d127 !important;
    border-color: #1F3328 !important;
}

#design-now-button:hover {
    background-color: #2a4a35 !important;
    color: #67d127 !important;
    border-color: #2a4a35 !important;
}

/* Make all product page button containers full width */
.single-product .variable_add_to_quote,
.single-product .button_add_to_quote {
    width: 100% !important;
    display: block !important;
}

/* Make all product page buttons full width and center text */
.single-product .single_add_to_cart_button,
.single-product .add_to_cart_button,
.single-product button[name="add-to-cart"],
.single-product .cart button[type="submit"],
.single-product #order-sample-button,
.single-product .single_adq_button,
.single-product #add_to_quote,
.single-product .btn {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin-bottom: 10px !important;
}

/* "Gestalten" and "Muster bestellen" split one row as wide as the add-to-quote
   button; they wrap onto two rows when the column is too narrow for both labels.
   The parent .variations_button is inline-flex, so the row needs an explicit width.
   row-gap equals the space above the row (the add-to-quote button's 10px margin plus
   the parent's two 15px flex gaps), so stacked buttons sit evenly spaced. */
.single-product .product-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 40px;
    width: 100%;
    margin-bottom: 10px;
}

/* Same height as the add-to-quote button: its vertical padding, one line of text.
   The narrower horizontal padding is what keeps each label on a single line. */
.single-product .product-secondary-actions #design-now-button,
.single-product .product-secondary-actions #order-sample-button {
    flex: 1 1 160px;
    width: auto !important;
    margin: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    white-space: nowrap;
}

/* Loading spinner for design now button */
#design-now-button .lds-dual-ring {
    display: none;
}

#design-now-button.loading .lds-dual-ring {
    display: inline-block;
}

/* Loading state for iframe */
.customize-modal-content::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #666;
    z-index: 1;
}

#customize-iframe[src]:not([src=""]) + .customize-modal-content::before {
    display: none;
}

/* Error message styling */
#iframe-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#iframe-error h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 20px;
}

#iframe-error p {
    margin-bottom: 10px;
    line-height: 1.5;
}

#iframe-error .btn {
    transition: all 0.3s ease;
}

#iframe-error .btn:hover {
    background: #0056b3 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .customize-modal-header {
        padding: 15px;
    }
    
    .customize-modal-header h3 {
        font-size: 20px;
    }
    
    .customize-modal-close {
        right: 15px;
        font-size: 28px;
        width: 35px;
        height: 35px;
    }
}

/* Remove conflicting animations */
.customize-modal-overlay {
    opacity: 1 !important;
}

.customize-modal-container {
    transform: none !important;
}

/* Responsive iframe styling with different heights for different devices */
#customize-iframe-container {
    position: relative !important;
    width: 100% !important;
    height: 100vh;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Tablet - screens between 768px and 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    #customize-iframe-container {
        /*height: 125vh !important;*/
    }
}

/* Mobile - screens <= 767px */
@media (max-width: 767px) {
    #customize-iframe-container {
        /*height: 150vh !important;*/
    }
}

#customize-iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    overflow: hidden !important;
}

/* Allow natural page scrolling */
body.iframe-active {
    overflow: auto !important;
}
