/* Inline BYOB Styles - Half Page Implementation */

:root {
    /* Colors */
    --byob-primary-color: #111;
    --byob-success-color: #4CAF50;
    --byob-error-color: #f44336;
    --byob-warning-color: #ffeb3b;
    --byob-text-color: #333;
    --byob-secondary-text-color: #6c757d;
    --byob-border-color: #e0e0e0;
    --byob-background-color: #f8f9fa;
    --byob-toast-success-color: #4CAF50;
    --byob-toast-error-color: #f44336;

    /* Typography */
    --byob-button-font-size: 14px;
    --byob-title-font-size: 18px;
    --byob-guide-font-size: 12px;
    --byob-product-title-font-size: 14px;
}

.inline-byob-container {
    max-width: 100%;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid var(--byob-border-color);
    border-radius: 8px;
    background: #fff;
}

.inline-byob-header {
    margin-bottom: 20px;
}

.inline-byob-header h3 {
    margin: 0 0 8px 0;
    font-size: var(--byob-title-font-size);
    font-weight: 600;
    color: var(--byob-text-color);
}

/* Top discount guidance */
.inline-byob-discount-info {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1.5px solid #1C1C1C;
    border-radius: 12px;
    padding: 10px;
    overflow: hidden;
}

/* .inline-byob-discount-wrapper {
    position: sticky;
    top: 60px;
    width: 100%;
    z-index: 9999999;
    background-color: #fff;
} */

.top-discount-guidance {
    background: transparent;
    color: #111;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
}

.top-discount-guidance.completed {
    background: #1C1C1C;
    color: #fff;
}

.best-offer-container {
    margin-bottom: 12px;
    display: none !important;
}

.best-offer-container .best-offer-message {
    background: #111;
    color: #fff;
    border: 1px solid transparent;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
}

/* Tier Progress Bar Container - positioned below discount info */
.tier-progress-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
}

.tier-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tier-progress-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.tier-progress-status {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.tier-progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.tier-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1C1C1C 0%, #1C1C1C 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.tier-progress-fill.next-tier {
    display: block;
    background: linear-gradient(90deg, #1C1C1C 0%, #1C1C1C 100%);
}

.tier-progress-fill.max-tier {
    display: block;
    background: linear-gradient(90deg, #1C1C1C 0%, #1C1C1C 100%);
}

.tier-progress-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tier-progress-marker {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    background: #fff;
    opacity: 0.8;
}

.tier-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
}

.tier-progress-current {
    font-weight: 600;
    color: #333;
}

.tier-progress-next {
    font-weight: 500;
}

.tier-progress-complete {
    color: #4CAF50;
    font-weight: 600;
}

.tier-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #6c757d;
}

.tier-label {
    text-align: center;
    flex: 1;
    position: relative;
}

.tier-label.active {
    color: #4CAF50;
    font-weight: 600;
}

.tier-label.completed {
    color: #4CAF50;
}

.guidance-text {
    font-size: var(--byob-button-font-size);
    font-weight: inherit;
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 105%;
    gap:4px;
}

/* .top-discount-guidance:not(:last-child) .guidance-text {
    border-right: 1.2px solid #1C1C1C;
} */

.best-offer-message {
    background: transparent;
    color: #111;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: var(--byob-button-font-size);
    font-weight: 600;
    text-align: center;
    width: 100%;
    border: 1px solid #111;
}

/* Box Selector Styles */
.box-selector-container {
padding: 12px;
}

.box-selector-title {
    margin: 0 0 12px 0;
    font-size: var(--byob-button-font-size);
    font-weight: 600;
    color: var(--byob-text-color);
}

.box-selector-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.box-option {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: 2px solid var(--byob-border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
}

.box-option:hover {
    border-color: var(--byob-primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.box-option.selected {
    border-color: var(--byob-primary-color);
    background: var(--byob-primary-color);
    color: white;
}

.box-quantity {
    font-size: var(--byob-button-font-size);
    font-weight: 600;
    margin-bottom: 4px;
}

.box-price {
    font-size: var(--byob-guide-font-size);
    opacity: 0.8;
}

.box-option.selected .box-price {
    opacity: 1;
}

.inline-byob-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.inline-byob-products-list {
    display: block;
    margin-bottom: 20px;
}

.inline-byob-product-card.list-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    margin-bottom: 12px !important;
    align-items: center !important;
}

.inline-byob-product-card.list-layout .product-image {
    flex-shrink: 0 !important;
    width: 120px !important;
}

.inline-byob-product-card.list-layout .product-image img {
    height: 80px !important;
    width: 100% !important;
    object-fit: cover !important;
    aspect-ratio: 1 / 1 !important;
}

.inline-byob-product-card.list-layout .product-details {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.inline-byob-product-card {
    transition: all 0.2s ease;
}

.inline-byob-cart-summary {
    border-top: 1px solid var(--byob-border-color);
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: start;
    flex-direction: column;
}

.inline-byob-total {
    font-weight: 600;
    font-size: var(--byob-button-font-size);
    color: var(--byob-text-color);
}

/* Bundle summary and messaging */

.bundle-items-count {
    font-size: var(--byob-button-font-size);
    margin-bottom: 8px;
    color: var(--byob-secondary-text-color);
}


.bundle-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: var(--byob-button-font-size);
    color: var(--byob-text-color);
}

.bundle-discount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: var(--byob-button-font-size);
    color: var(--byob-success-color);
}

.bundle-discount .discount-amount {
    font-weight: 600;
}

.discount-type {
    font-size: var(--byob-guide-font-size);
    color: var(--byob-secondary-text-color);
    font-weight: 400;
    margin-left: 4px;
}

.total-amount {
    font-weight: 600;
    color: var(--byob-primary-color);
}

.inline-byob-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-weight: 500;
    display: none;
}

.inline-byob-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.inline-byob-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.inline-byob-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.inline-byob-products-section {
    margin-bottom: 24px;
}

.condition-title {
    font-size: 14px;
    font-weight: 400;
    color: #1C1C1C;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error-message {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    font-style: italic;
}

/* Product grid improvements */
.inline-byob-product-card {
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid #EDEDED;
    border-radius: 6px;
}

.inline-byob-product-card.out-of-stock{
    opacity: .5;
    cursor: not-allowed;
}

.inline-byob-product-card .product-image {
    overflow: hidden;
}

.product-details {
    padding: 10px;
}

/* Product states - unified styling for both single and multi selection */
.inline-byob-product-card.product-added {
    border-color: #111;
    background: #f0f8ff;
}

.product-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    position: relative;
    border-radius: 6px;
}

.product-image a {
    position: absolute;
    top: 1%;
    right: 1%;
    opacity: 0;
    transition: all .5s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 99;
}

.product-image:hover a {
    opacity: 1;
}

.product-title {
    font-size: 12px;
    font-weight: 400;
    color: #1C1C1C;
    line-height: 110%;
    margin: 0;
}

.product-price {
    font-size: 14px;
    font-weight: 600;
    color: #1C1C1C;
    letter-spacing: .2px;
    margin: 12px 0;
}

.qty-btn.box-limit-reached {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Quantity controls */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quantity-controls {
    align-items: center;
    justify-content: center;
    border: 1px solid #8F8F8F;
    border-radius: 32px;

}

.qty-btn {
    background: transparent;
    color: #111;
    border: none;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.2s ease;
}

.qty-btn:hover:not(:disabled) {
    background: transparent;
}

.qty-btn:disabled {
    background: transparent;
    cursor: not-allowed;
    opacity: .5;
}


.qty-display {
    min-width: 60px;
    text-align: center;
    font-weight: bold;
    padding: 6px 10px;
    background: #f8f9fa;
    font-size: 12px;
    border: none;
}

.inline-byob-container .inline-byob-product-card[data-condition-id]:has(.single-selection-indicator):hover:not(:has(.single-selection-indicator.disabled)) {
    cursor: pointer;
    background-color: #ECECEC;
}

/* Remove button */
.remove-from-bundle-btn:hover:not(:disabled) {
    background: #111;
    transform: translateY(-1px);
}

.remove-from-bundle-btn:disabled {
    background: #111;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Product status */
.product-status {
    margin-top: 8px;
    text-align: center;
    font-size: 14px;
    display: none;
}

.product-status .status-text {
    color: #28a745;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
    display: none;
}

.variant-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 12px;
    background: white;
}

/* Dropdown variant styles (from byob-manager.js) */
.product-variant-dropdowns {
    margin: 12px 0;
}

.custom-variant-dropdown {
    position: relative;
    margin-bottom: 8px;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid #8F8F8F;
    border-radius: 32px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.dropdown-selected:hover {
    border-color: #111;
}

.dropdown-image-container {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}

.dropdown-variant-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.dropdown-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
}

.dropdown-arrow {
    width: 8px;
    height: 4px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height:93px;
    overflow-y: auto;
}

.dropdown-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-option:hover {
    background-color: #f5f5f5;
}

.dropdown-option[data-selected="true"] {
    background-color: #e3f2fd;
    color: #111;
}

.dropdown-option.option-disabled {
    color: #ccc;
    cursor: not-allowed;
}

.dropdown-option.option-disabled:hover {
    background-color: transparent;
}
 .inline-byob-product-card.activateZindex {
    z-index: 1001;
} 


/* Accordion functionality */
.accordion-section {
    border-radius: 8px;
    margin-bottom: 16px;
     overflow: hidden; 
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding: 18px 20px;
    background: #F0F0F0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 8px;
}

.accordion-header:hover {
    background: #F0F0F0;
}

.accordion-header .condition-title {
    margin: 0;
    flex: 1;
}

.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.accordion-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    color: #666;
}

.products-grid {
    width: 100%;
    /* overflow: hidden;
    overflow-x: auto; */
    padding: 8px;
}

.accordion-content {
    /* overflow: hidden; */
    transition: max-height 0.3s ease;
}

.accordion-content.expanded {
    max-height: none;
}

.accordion-content:not(.expanded) {
    max-height: 0;
}

/* Mobile styles */
@media (max-width: 768px) {
    .inline-byob-container {
        margin: 16px 0;
        padding: 16px;
    }

    .inline-byob-products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .inline-byob-product-card.list-layout {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .inline-byob-product-card.list-layout .product-image {
        width: 100% !important;
        flex-shrink: initial !important;
    }

    .inline-byob-product-card.list-layout .product-image img {
        height: 150px !important;
        aspect-ratio: initial !important;
    }

    .inline-byob-product-card.list-layout .product-details {
        flex-direction: column !important;
        justify-content: initial !important;
    }

    .inline-byob-cart-summary {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .inline-byob-add-btn {
        width: 100%;
    }

    .product-image img {
        height: 150px;
    }

    .quantity-controls {
        gap: 6px;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .qty-display {
        min-width: 32px;
        padding: 4px 8px;
        font-size: 14px;
    }

    .remove-from-bundle-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .dropdown-options {
        max-height: 77px;
    }

    .dropdown-image-container {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }

    .accordion-header {
        padding: 12px 16px;
    }

    .accordion-content.expanded {
        padding: 16px;
    }

    .top-discount-guidance {
        padding: 10px 12px;
        margin-bottom: 6px;
    }

    .guidance-text {
        font-size: 13px;
    }

    .best-offer-message {
        padding: 10px 12px;
        font-size: 13px;
    }

    .discount-type {
        font-size: 11px;
    }

    .box-selector-options {
        gap: 8px;
    }

    .box-option {
        min-width: 100px;
        padding: 10px 12px;
    }

    .box-selector-title {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .box-quantity {
        font-size: 13px;
    }

    .box-price {
        font-size: 11px;
    }

    /* Progress bar mobile styles */
    .tier-progress-container {
        padding: 12px;
        margin-top: 8px;
    }

    .tier-progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 8px;
    }

    .tier-progress-title {
        font-size: 13px;
    }

    .tier-progress-status {
        font-size: 11px;
    }

    .tier-progress-info {
        font-size: 11px;
    }

    .tier-labels {
        font-size: 10px;
        margin-top: 6px;
    }
}

.bundle-toast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    padding: 16px 24px;
    transition: all 0.3s ease;
    max-width: 400px;
    text-align: center;
}

.bundle-toast.show {
    top: 20px;
}

.bundle-toast.success {
    border-left: 4px solid #4CAF50;
}

.bundle-toast.error {
    border-left: 4px solid #f44336;
}

.bundle-toast-content {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .inline-byob-discount-wrapper {
   
    top: 53px;
   
}
    .bundle-toast {
        width: 90%;
        max-width: 300px;
    }
}

.condition-inline-guide {
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
    margin-left: 8px;
}

.condition-inline-guide:empty {
    display: none;
}

.condition-title-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.condition-selected-products {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 100%;
    justify-content: end;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.selected-product-circle {
    width: 34px;
    height: 34px;
    border-radius: 100%;
    border: 1px solid #e0e0e0;
    /* overflow: hidden; */
    position: relative;
    background: #f8f9fa;
    flex-shrink: 0;
    padding: 2px;
}

.selected-product-circle img {
    border-radius: 12px;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selected-product-circle.has-quantity::after {
    content: attr(data-quantity);
    position: absolute;
    bottom: 0%;
    right: -50%;
    transform: translate(-50%, 0%);
    background: transparent;
    color: #111;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 1px solid #111;
}

.condition-selected-products:empty {
    display: none;
}

/* Hide circles when accordion is expanded - controlled by JavaScript */
.accordion-section.expanded .condition-selected-products {
    display: none;
}

.summary-item {
    display: none !important;
}

.total-text-discount {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-total{
    font-size: 14px;
    color: #1C1C1C;
    font-weight: 500;
}

.summary-discount{
    font-size: 12px;
    color: #099501;
}

/* Single selection remove button */
.single-selection-remove-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.single-selection-remove-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.single-selection-remove-btn svg {
    width: 14px;
    height: 14px;
}

/* Ensure product card has relative positioning for absolute positioning of remove button */
.inline-byob-product-card {
    position: relative;
}