/* Version: 2.0.16 */

/* =========================================================
   Top Bar & Intro
   ========================================================= */
.bjbj-top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.bjbj-ordering {
    margin: 0;
}

/* =========================================================
   Mobile First: Stacked Card Layout
   ========================================================= */
.bjbj-product-table {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.bjbj-product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Header Row - Hidden on Mobile */
.bjbj-table-header {
    display: none;
    font-weight: 600;
    color: #4a5568;
    background: #f7fafc;
    padding: 12px 24px;
    border-radius: 6px;
}

.bjbj-product-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.bjbj-product-image a {
    display: block;
}

.bjbj-product-image img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

.bjbj-product-name {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bjbj-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bjbj-title-link {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.bjbj-title-link:hover {
    color: #2b6cb0;
}

/* Base style for list description. Colors and typography can now be overridden in Elementor */
.bjbj-list-description {
    margin-top: 8px;
    line-height: 1.5;
}

.bjbj-list-description p:first-child {
    margin-top: 0;
}

.bjbj-list-description p:last-child {
    margin-bottom: 0;
}

/* =========================================================
   Info Icon & Modal Overlay
   ========================================================= */
.bjbj-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    cursor: pointer;
    transition: color 0.2s;
}

.bjbj-info-icon:hover {
    color: #2b6cb0;
}

.bjbj-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bjbj-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bjbj-modal-content {
    background-color: #ffffff;
    color: #2d3748;
    border-radius: 8px;
    padding: 24px;
    width: calc(100vw - 20px); 
    max-width: 500px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    text-align: left;
}

.bjbj-modal-overlay.active .bjbj-modal-content {
    transform: translateY(0);
}

.bjbj-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.2s;
}

.bjbj-modal-close:hover {
    color: #e53e3e;
}

.bjbj-modal-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.3rem;
    padding-right: 20px;
    font-weight: 600;
}

.bjbj-modal-body {
    font-size: 0.95rem;
    line-height: 1.6;
}

body.bjbj-modal-open {
    overflow: hidden;
}

/* =========================================================
   Override Native WooCommerce Form Styles
   ========================================================= */
.bjbj-product-form form.variations_form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bjbj-product-form table.variations {
    width: 100%;
    margin: 0;
    border: none;
}

.bjbj-product-form table.variations tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bjbj-product-form table.variations tr {
    display: flex;
    flex-direction: column;
    border: none;
}

.bjbj-product-form table.variations td {
    padding: 0;
    border: none;
    display: block;
}

.bjbj-product-form table.variations td.label label {
    margin: 0;
    padding: 0;
    background: transparent !important;
    border: none !important;
    font-weight: inherit;
    color: inherit;
    font-size: inherit;
    display: inline-block;
}

.bjbj-product-form table.variations td.label {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #4a5568;
    background-color: transparent; 
}

.bjbj-product-form table.variations select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background-color: #f7fafc;
}

.bjbj-product-form .woocommerce-variation {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bjbj-product-form .woocommerce-variation-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2d3748;
}

.bjbj-product-form a.reset_variations {
    display: none !important;
}

/* Added to Cart Feedback Tally (With gentle fallback defaults) */
.bjbj-cart-tally {
    color: #38a169;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Action Button Layout */
.bjbj-product-form .woocommerce-variation-add-to-cart {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

.bjbj-product-form .quantity {
    flex: 0 0 80px;
}

.bjbj-product-form .quantity input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.bjbj-product-form button.single_add_to_cart_button,
.bjbj-product-form button.bjbj-buy-now-button {
    flex: 1; 
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
}

.bjbj-product-form button.single_add_to_cart_button.disabled,
.bjbj-product-form button.bjbj-buy-now-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================
   Desktop Layout: Horizontal Row
   ========================================================= */
@media (min-width: 768px) {
    
    .bjbj-table-header {
        display: flex;
        align-items: center;
    }

    .bjbj-product-card {
        flex-direction: row;
        align-items: center;
        padding: 12px 24px;
    }

    .bjbj-product-info, .bjbj-th-product {
        flex: 1 1 30%;
        margin-bottom: 0;
    }

    .bjbj-product-form, .bjbj-th-options {
        flex: 1 1 70%;
    }

    .bjbj-th-action {
        flex: 1 1 40%;
        text-align: right;
    }

    /* List Only Mode Adjustments */
    .bjbj-table-header.bjbj-list-only .bjbj-th-product,
    .bjbj-product-card.bjbj-list-only .bjbj-product-info {
        flex: 1 1 100%;
    }

    .bjbj-product-card.bjbj-list-only .bjbj-product-name {
        flex-direction: row;
        align-items: center;
        gap: 24px;
        width: 100%;
    }

    .bjbj-product-card.bjbj-list-only .bjbj-title {
        flex: 0 0 35%; /* Restricts title width so it doesn't take over */
    }

    .bjbj-product-card.bjbj-list-only .bjbj-list-description {
        flex: 1 1 65%;
        margin-top: 0;
    }

    .bjbj-product-form form.variations_form {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 24px;
        margin-bottom: 0;
    }

    .bjbj-product-form table.variations {
        flex: 1 1 auto;
    }

    .bjbj-product-form table.variations tbody {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    .bjbj-product-form table.variations tr {
        flex: 1;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .bjbj-product-form table.variations td.label {
        margin-bottom: 0;
        white-space: nowrap;
    }

    .bjbj-product-form .single_variation_wrap {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 24px;
    }

    .bjbj-product-form .woocommerce-variation {
        flex-direction: row;
        align-items: center;
    }

    .bjbj-product-form .woocommerce-variation-add-to-cart {
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-end;
    }
}