/**
 * Bundle Template Styles
 *
 * Static CSS for the product bundle add-to-cart template.
 * Dynamic CSS variables are added via PHP wp_add_inline_style().
 *
 * @package Swift Commerce
 */

/* ─── CSS Isolation Reset ───────────────────────────────────────
 * Prevents third-party theme styles from bleeding into bundle UI.
 * Targets only elements inside .swift-commerce-bundle-wrap so it
 * does not affect any other part of the page.
 * ──────────────────────────────────────────────────────────────── */
.swift-commerce-bundle-wrap,
.swift-commerce-bundle-wrap *,
.swift-commerce-bundle-wrap *::before,
.swift-commerce-bundle-wrap *::after {
    box-sizing: border-box;
    text-decoration: none;
    letter-spacing: normal;
    word-spacing: normal;
    text-transform: none;
    text-indent: 0;
    text-shadow: none;
    float: none;
}

.swift-commerce-bundle-wrap h4,
.swift-commerce-bundle-wrap p,
.swift-commerce-bundle-wrap ul,
.swift-commerce-bundle-wrap li,
.swift-commerce-bundle-wrap span,
.swift-commerce-bundle-wrap div,
.swift-commerce-bundle-wrap label {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    vertical-align: baseline;
    list-style: none;
}

.swift-commerce-bundle-wrap img {
    max-width: 100%;
    height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.swift-commerce-bundle-wrap button,
.swift-commerce-bundle-wrap input,
.swift-commerce-bundle-wrap select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    margin: 0;
    box-shadow: none;
    outline: none;
}

.swift-commerce-bundle-wrap button:focus,
.swift-commerce-bundle-wrap input:focus,
.swift-commerce-bundle-wrap select:focus {
    outline: 2px solid var(--synk-primary, #002269);
    outline-offset: 1px;
}

.swift-commerce-bundle-wrap a,
.swift-commerce-bundle-wrap a:hover,
.swift-commerce-bundle-wrap a:visited {
    text-decoration: none;
    color: inherit;
}

/* Grid Layout */
.swift-commerce-bundle-wrap .bundle-grid {
    display: grid;
    grid-template-columns: repeat(var(--synk-columns, 3), 1fr);
    gap: var(--synk-spacing);
    margin-bottom: 24px;
}

/* List Layout */
.swift-commerce-bundle-wrap .bundle-list {
    display: flex;
    flex-direction: column;
    gap: var(--synk-spacing);
    margin-bottom: 24px;
}

.swift-commerce-bundle-wrap .bundle-list .bundle-item {
    flex-direction: row;
    align-items: center;
}

.swift-commerce-bundle-wrap .bundle-list .bundle-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    aspect-ratio: auto;
}

.swift-commerce-bundle-wrap .bundle-list .bundle-item-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Compact Layout */
.swift-commerce-bundle-wrap .bundle-compact {
    display: flex;
    flex-direction: column;
    gap: calc(var(--synk-spacing) / 2);
    margin-bottom: 24px;
}

.swift-commerce-bundle-wrap .bundle-compact .bundle-item {
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    width: 100%;
}

.swift-commerce-bundle-wrap .bundle-compact .bundle-item-image {
    width: 48px;
    height: 48px;
    aspect-ratio: auto;
    flex-shrink: 0;
}

.swift-commerce-bundle-wrap .bundle-compact .bundle-item-name {
    font-size: 13px !important;
}

.swift-commerce-bundle-wrap .bundle-compact .bundle-item-price {
    font-size: 12px !important;
}

.swift-commerce-bundle-wrap .bundle-compact .bundle-item-details {
    flex: 1;
    min-width: 0;
    padding: 0 !important;
}

.swift-commerce-bundle-wrap .bundle-compact .bundle-item-qty {
    display: none;
}

/* Compact: discount badge sits inline right */
.swift-commerce-bundle-wrap .bundle-compact .bundle-badge {
    position: static;
    flex-shrink: 0;
    order: 3;
    margin-left: auto;
}

/* Bundle Item */
.swift-commerce-bundle-wrap .bundle-item {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    margin: 0;
    padding: 0;
    list-style: none;
}

.swift-commerce-bundle-wrap .bundle-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Item with borders (default) */
.swift-commerce-bundle-wrap .bundle-item--bordered {
    border: 1px solid var(--synk-border);
    border-radius: var(--synk-radius);
}

/* Item Image */
.swift-commerce-bundle-wrap .bundle-item-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9fafb;
}

.swift-commerce-bundle-wrap .bundle-item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none;
    opacity: 1;
}

.swift-commerce-bundle-wrap .bundle-item:hover .bundle-item-image img {
    transform: scale(1.05);
}

/* Discount Badge */
.swift-commerce-bundle-wrap .bundle-badge {
    position: absolute;
    background: var(--synk-badge-bg) !important;
    color: var(--synk-badge-text) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    z-index: 1;
    line-height: 1.3;
    margin: 0;
    border: 0;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
}

/* Badge positions */
.swift-commerce-bundle-wrap .bundle-badge--top-left {
    top: 8px;
    left: 8px;
}

.swift-commerce-bundle-wrap .bundle-badge--top-right {
    top: 8px;
    right: 8px;
}

.swift-commerce-bundle-wrap .bundle-badge--bottom-left {
    bottom: 8px;
    left: 8px;
}

.swift-commerce-bundle-wrap .bundle-badge--bottom-right {
    bottom: 8px;
    right: 8px;
}

/* Item Details */
.swift-commerce-bundle-wrap .bundle-item-details {
    padding: 12px !important;
    margin: 0;
    background: transparent;
    border: 0;
}

.swift-commerce-bundle-wrap .bundle-item-name {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1f2937;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
    text-transform: none;
    letter-spacing: normal;
    border: 0;
}

.swift-commerce-bundle-wrap .bundle-item-price {
    font-size: 14px !important;
    color: #4b5563;
    margin: 0 0 8px 0;
    padding: 0;
    line-height: 1.4;
}

.swift-commerce-bundle-wrap .bundle-item-price del {
    color: #9ca3af;
    margin-right: 8px;
    text-decoration: line-through;
    opacity: 1;
}

.swift-commerce-bundle-wrap .bundle-item-price ins {
    text-decoration: none !important;
    color: var(--synk-primary);
    font-weight: 600;
    background: none !important;
}

/* Quantity Controls */
.swift-commerce-bundle-wrap .bundle-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.swift-commerce-bundle-wrap .bundle-item-qty label {
    font-size: 12px;
    color: #6b7280;
}

.swift-commerce-bundle-wrap .qty-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.swift-commerce-bundle-wrap .qty-btn {
    width: 28px;
    height: 28px;
    border: none !important;
    background: #f3f4f6 !important;
    cursor: pointer;
    font-size: 14px;
    color: #374151 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0 !important;
    margin: 0;
    line-height: 1;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.swift-commerce-bundle-wrap .qty-btn:hover {
    background: #e5e7eb !important;
}

.swift-commerce-bundle-wrap .qty-input {
    width: 40px !important;
    height: 28px;
    border: none !important;
    border-left: 1px solid #d1d5db !important;
    border-right: 1px solid #d1d5db !important;
    text-align: center;
    font-size: 13px;
    -moz-appearance: textfield;
    padding: 0 !important;
    margin: 0;
    background: #fff;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.swift-commerce-bundle-wrap .qty-input::-webkit-outer-spin-button,
.swift-commerce-bundle-wrap .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.swift-commerce-bundle-wrap .qty-select {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
}

/* Savings Display */
.swift-commerce-bundle-wrap .bundle-savings {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(22, 163, 74, 0.1) !important;
    border-radius: var(--synk-radius);
    margin-bottom: 16px;
    border: 0 !important;
    box-shadow: none;
}

.swift-commerce-bundle-wrap .bundle-savings-label {
    font-size: 14px !important;
    color: var(--synk-savings);
    margin: 0;
    padding: 0;
}

.swift-commerce-bundle-wrap .bundle-savings-amount {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--synk-savings);
    margin: 0;
    padding: 0;
}

/* Total Price */
.swift-commerce-bundle-wrap .bundle-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f9fafb !important;
    border-radius: var(--synk-radius);
    margin-bottom: 16px;
    border: 0 !important;
    box-shadow: none;
}

.swift-commerce-bundle-wrap .bundle-total-label {
    font-size: 16px !important;
    color: #374151;
    font-weight: 400;
    margin: 0;
    padding: 0;
}

.swift-commerce-bundle-wrap .bundle-total-amount {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #1f2937;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* Empty State */
.swift-commerce-bundle-wrap .bundle-empty {
    text-align: center;
    padding: 32px;
    background: #f9fafb;
    border-radius: var(--synk-radius);
    color: #6b7280;
}

/* Add to Cart Button — override theme styles */
.swift-commerce-bundle-wrap .bundle-add-btn.single_add_to_cart_button {
    display: inline-block;
    width: 100%;
    padding: 14px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-align: center;
    text-decoration: none !important;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    border: 0 !important;
    border-radius: var(--synk-radius, 8px) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    transition: opacity 0.2s, box-shadow 0.2s;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}

.swift-commerce-bundle-wrap .bundle-add-btn.single_add_to_cart_button:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Savings below button modifier */
.swift-commerce-bundle-wrap .bundle-savings--below {
    margin-top: 16px;
    margin-bottom: 0;
}

/* WooCommerce Price Amount — prevent theme overrides on price formatting */
.swift-commerce-bundle-wrap .woocommerce-Price-amount {
    font-size: inherit !important;
    color: inherit !important;
    font-weight: inherit !important;
    line-height: inherit;
    display: inline;
    margin: 0;
    padding: 0;
}

.swift-commerce-bundle-wrap .woocommerce-Price-currencySymbol {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
}

/* Pro: Optional item checkbox area */
.swift-commerce-bundle-wrap .bundle-item-optional {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f0f9ff !important;
    border-radius: 4px;
    border: 0 !important;
    box-shadow: none;
}

.swift-commerce-bundle-wrap .bundle-item-optional label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-size: 13px !important;
    cursor: pointer;
    color: #002269 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.swift-commerce-bundle-wrap .bundle-item-optional input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 3px !important;
    box-shadow: none !important;
    -webkit-appearance: checkbox;
    appearance: checkbox;
    cursor: pointer;
}

/* Pro: Variation selector area */
.swift-commerce-bundle-wrap .bundle-item-variation {
    margin-top: 8px;
}

.swift-commerce-bundle-wrap .bundle-item-variation label {
    font-size: 13px !important;
    font-weight: 600 !important;
    display: block;
    margin-bottom: 4px;
    padding: 0;
}

.swift-commerce-bundle-wrap .swift-commerce-bundle-variation-select {
    width: 100% !important;
    padding: 6px 8px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    background: #fff;
    box-shadow: none !important;
    -webkit-appearance: menulist;
    appearance: menulist;
    height: auto !important;
}

/* Wrapper isolation — ensure no theme collapse/margin issues */
.swift-commerce-bundle-wrap {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Responsive */
@media (max-width: 768px) {
    .swift-commerce-bundle-wrap .bundle-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .swift-commerce-bundle-wrap .bundle-list .bundle-item-details {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .swift-commerce-bundle-wrap .bundle-grid {
        grid-template-columns: 1fr;
    }
    
    .swift-commerce-bundle-wrap .bundle-list .bundle-item-image {
        width: 60px;
        height: 60px;
    }
}
