/*
 * cold-brew-pack.css
 * Custom styles for WooCommerce Cold Brew Custom Pack plugin
 */

/* General Styling for the builder wrapper */

.woocommerce-js div.product div.summary .woocommerce-product-details__short-description #pack-builder-modal {
    margin: 0 !important;
}
.woocommerce-js div.product div.summary .woocommerce-product-details__short-description #pack-builder-modal :last-child {
    margin: 0 !important;
}

.cold-brew-pack-builder-wrapper {
    max-width: 960px; /* Increased max-width to accommodate content */
    box-sizing: border-box;
    margin: 20px auto; /* Center the wrapper with some top/bottom margin */
}

.cold-brew-pack-builder {
    /* No specific styles needed here, wrapper handles general layout */
}

/* Headings */
.cold-brew-pack-builder h2, .sc-modal-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8em;
    line-height: 1.2;
}

/* Summary Box */
/* Leveraging WooCommerce .woocommerce-message classes */
.woocommerce-message.woocommerce-message--info {
    border-radius: 6px;
    padding: 1em 2em 1em 3.5em;
    margin-top: 20px;
    margin-bottom: 0;
    display: flex; /* Adjust for better alignment of summary title */
    flex-direction: column;
    align-items: flex-start;
    font-size: 20px;
    color: #471106;
}
.woocommerce-message.woocommerce-message--info p {
    margin-bottom: 0; /* Remove default paragraph margin */
    text-align: left;
}
.sc-summary-title {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.1em;
    padding: 0;
}
.sc-summary-list {
    list-style: disc;
    padding-left: 0;
    margin: 0;
    width: 100%; /* Ensure list takes full width */
}
.sc-summary-list li {
    margin-bottom: 5px;
}
.sc-summary-list li span {
    text-transform: uppercase;
}

/* Total Display */
.sc-total-display {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    padding: 10px;
}
.sc-modal-total {
    /*border-top: 1px solid var(--ast-global-color-2);*/
    padding: 15px 0; /* Slightly more padding in modal */
}

/* Message Box (WooCommerce-style) */
.woocommerce-message {
    margin-top: 15px;
    padding: 1em 2em 1em 3.5em; /* Standard WC padding */
    border-radius: 5px;
    position: relative;
    background-color: #f7f6f7; /* Default light background */
    color: #515151; /* Default text color */
    border-top: 3px solid #f7f6f7; /* Default border color */
    list-style: none outside;
    text-align: left;
}
.woocommerce-message.woocommerce-message--warning {
    background-color: #fff3cd;
    color: #856404;
    border-top-color: #ffeeba;
}
.woocommerce-message.woocommerce-message--success {
    background-color: #d4edda;
    color: #155724;
    border-top-color: #c3e6cb;
}
.woocommerce-message.woocommerce-message--error {
    background-color: #f8d7da;
    color: #721c24;
    border-top-color: #f5c6cb;
}
/* Icon for WC messages - you might need to add this manually or let WC handle it */
/* Note: For these icons to render, the 'WooCommerce' font-family (from WooCommerce plugin) must be loaded on the page. */
.woocommerce-message:before {
    font-family: 'WooCommerce' !important; /* Forces WooCommerce font to be used */
    content: "\e017"; /* Icon for info/warning - can be changed */
    position: absolute;
    top: 1em;
    left: 1.5em;
    color: #515151;
}
.woocommerce-message.woocommerce-message--success:before { content: "\e015"; color: #155724; } /* Checkmark */
.woocommerce-message.woocommerce-message--error:before { content: "\e016"; color: #721c24; } /* Cross */


/* Modal Specific Styles */
.sc-modal {
    position: fixed;
    inset: 0; /* top:0, right:0, bottom:0, left:0 */
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: start;
    justify-content: center;
    z-index: 9999; /* Ensure it's on top */
    overflow-y: auto; /* Enable scrolling for modal itself if content is too tall */
    color: var(--ast-global-color-2);
}

.sc-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px; /* Keep a max-width for the modal content */
    position: relative;
    /*max-height: 90vh;*/
    display: flex;
    flex-direction: column;
    margin: 0;
    height: calc(100% - 4em);
    top: 2em;
}
@media (max-width: 580px) { /* Adjust breakpoint as needed */
    .sc-modal-content {
        top: 4em;
        height: calc(100% - 6em)
    }
}

.sc-modal-content .modal-close.button { /* Targeting the specific class */
    position: absolute;
    top: 15px;
    right: 20px;
    border: none;
    font-size: 2.2em;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
    box-shadow: none; /* Remove default button shadow */
}
.modal-close.button:hover {
    color: #555;
}

.sc-modal-scrollable {
    flex-grow: 1; /* Allow content to grow and take available space */
    max-height: calc(90vh - 200px); 
    overflow-y: auto;
    /*padding-right: 15px;*/
    /*margin-bottom: 20px;*/
}

/*.sc-modal-scrollable.selected-12 {*/
/*    max-height: calc(90vh - 200px);*/
/*    overflow-y: auto;*/
/*}*/

/* Flavor List: Now stacks individual flavor items vertically */
.sc-flavor-list {
    display: flex;
    flex-direction: column; /* Stack items vertically */
    gap: 15px; /* Space between each full-width flavor item */
}

/* Flavor Item: Each item is now a row with specific alignment */
.sc-flavor-item {
    display: flex; /* Make each item a flex container */
    flex-direction: row; /* Layout content horizontally (image, name, quantity) */
    align-items: center; /* Vertically align items in the middle */
    justify-content: space-between; /* Pushes quantity to the far right */
    width: 100%; /* Ensure each item takes full width of its parent */
    border: 1px solid #ddd;
    padding: 0 20px; /* Adjusted padding for horizontal layout */
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    background-color: var(--flavor-background-color, #FFFFFF);
}
.sc-flavor-item:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Flavor Image Styling */
.sc-flavor-image {
    width: 70px; /* Adjust size if needed */
    height: 70px;
    object-fit: contain; /* Use contain to ensure full image is visible */
    margin-right: 20px; /* Space between image and name */
    margin-bottom: 0; /* Override previous margin-bottom */
    /*border: 2px solid #eee;*/
    /*background-color: #f9f9f9;*/
    flex-shrink: 0; /* Prevent image from shrinking */
    box-shadow: 0 0 0 0 !important;
}

/* Flavor Name Styling */
.sc-flavor-name {
    flex-grow: 1; /* Allows name to take up available space in the middle */
    text-align: left; /* Align text to the left */
    margin-bottom: 0; /* Override previous margin-bottom */
    font-size: 1.3em; /* Slightly adjusted font size */
    font-weight: 700;
    line-height: 1.3;
}

/* Quantity Selector Styling */
.sc-quantity-selector {
    flex-shrink: 0; /* Prevent selector from shrinking */
    margin-left: 20px; /* Space between name and selector */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Gap between quantity buttons and display */
    width: auto; /* Let content define width */
    max-width: none; /* Remove previous max-width restriction */
}
.woocommerce-js .sc-quantity-selector button.button {
    margin-bottom: 0 !important;
    font-size: 30px !important;
    height: 40px;
    width: 40px;
    padding: 0 !important;
    line-height: 0px !important;
    padding-bottom: 3px !important;
}

/* Media query for smaller screens (e.g., mobile) to stack items */
@media (max-width: 580px) { /* Adjust breakpoint as needed */
    .sc-flavor-item {
        flex-direction: column; /* Stack image, name, qty on small screens */
        align-items: center;
        text-align: center;
        padding: 15px; /* Adjust padding for stacked layout */
    }
    .sc-flavor-image {
        margin-right: 0; /* Remove horizontal margin */
        margin-bottom: 10px; /* Add some space below image when stacked */
    }
    .sc-flavor-name {
        margin-bottom: 10px; /* Add some space below name when stacked */
        text-align: center;
    }
    .sc-quantity-selector {
        margin-left: 0; /* Remove horizontal margin */
        width: 100%; /* Take full width for better touch targets */
        max-width: 180px; /* Limit width of selector on small screens if desired */
    }
}

/* Standard WooCommerce button classes are applied to the buttons now */
.button.quantity-button { /* Custom class for +/- buttons */
    background-color: #0073aa; /* WordPress blue */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 20px;
    transition: background-color 0.2s ease;
    min-width: 35px; /* Ensure buttons are not too small */
    text-align: center;
    box-shadow: none; /* Remove default button shadow */
}
.button.quantity-button:hover {
    background-color: #005177;
}
.button.quantity-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.sc-qty-display {
    font-size: 1.2em;
    font-weight: bold;
    min-width: 40px; /* Increased min-width for better display */
    text-align: center;
    padding: 5px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f5f5f5;
    color: #333;
}

/* Loading message */
.sc-loading-message {
    text-align: center;
    font-style: italic;
    color: #666;
    padding: 20px;
}


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.sc-modal {
    animation: fadeIn 0.3s ease-out;
}
.sc-modal-content {
    animation: fadeInUp 0.3s ease-out;
}
.hidden {
    display: none !important;
}

#close-pack-builder-modal-btn {
    position: absolute;
    width: 50px;
    height: 50px;
    font-size: 25px;
    padding: 0 !important;
    line-height: 50px;
    right: 2%;
}
.single-product button.button {
    width: 100%;
    font-size: 30px;
    padding: 10px !important;
}
@media (max-width: 580px) { /* Adjust breakpoint as needed */
    #close-pack-builder-modal-btn {
        top: auto;
        bottom: 100%;
    }
    .single-product button.button {
        font-size: 22px;
        padding: 10px 0 !important;
    }
    #open-pack-builder-modal-btn {
        /*font-size: 30px;*/
    }
}
