/* =============================================
   1. DEFAULT STATE: HIDE THE POPUP COMPLETELY
   ============================================= */
#spark-purchase-popup {
    /* Position it to cover the screen */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; /* Make sure it's on top of everything */

    /* Hide it by default */
    display: none; /* This is the most important line! */
    visibility: hidden;
    opacity: 0;

    /* For a smooth transition when it appears */
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* The overlay (the dark background) */
.spark-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

/* The popup content box */
.spark-popup-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    /* Center it vertically and horizontally */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}


/* =============================================
   2. VISIBLE STATE: SHOW THE POPUP
   This class is added by JavaScript.
   ============================================= */
#spark-purchase-popup.spark-popup-visible {
    /* Show it! */
    display: flex; /* Use flex to easily center the content */
    visibility: visible;
    opacity: 1;
}

/* =============================================
   3. CLOSE BUTTON & OTHER ELEMENTS
   ============================================= */
.spark-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    text-decoration: none;
}

.spark-popup-close:hover {
    color: #000;
}

/* Add some basic styling to the form elements inside */
.spark-product-image img {
    max-width: 100px;
    height: auto;
    float: left;
    margin-right: 15px;
}

.spark-product-details {
    overflow: hidden; /* Prevent text from flowing under the image */
}

.spark-product-name {
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 0 5px 0;
}

.spark-product-price {
    font-size: 1.1em;
    color: #777;
}

.spark-choice-options {
    margin: 20px 0;
    clear: both; /* Clear the float from the image */
}

.spark-choice-options label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
}

#spark-add-to-cart, #spark-cancel {
    margin-right: 10px;
}