/* ============================================================
   Maamuli Discount Manager — Checkout Bundle Widget
   Shopify-style quantity upsell on WooCommerce checkout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Widget Container (Inside Order Review Card) ──────── */
.mdm-bundle-widget {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.08);
    margin: 12px 0;
    border: 1.5px solid #e8e4ff;
}

.mdm-bundle-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #6c5ce7 0%, #8b7cf8 100%);
    color: #fff;
}
.mdm-bundle-header .mdm-header-icon {
    width: 30px; height: 30px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.mdm-bundle-header-text h4 {
    margin: 0 0 1px;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.mdm-bundle-header-text p {
    margin: 0;
    font-size: 11px;
    color: rgba(255,255,255,0.85);
    font-family: 'Inter', sans-serif;
    line-height: 1.2;
}

/* ── Product info row ──────────────────────────────────────── */
.mdm-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f9f7ff;
    border-bottom: 1px solid #ede9ff;
}
.mdm-product-img {
    width: 36px; height: 36px;
    border-radius: 8px;
    object-fit: cover;
    border: 1.5px solid #e8e4ff;
    flex-shrink: 0;
}
.mdm-product-name {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Options Grid ──────────────────────────────────────────── */
.mdm-options-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}

.mdm-option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    user-select: none;
    margin-top: 4px;
}
.mdm-option-card:hover {
    border-color: #a29bfe;
    background: #faf9ff;
}
.mdm-option-card.mdm-selected {
    border-color: #6c5ce7;
    background: linear-gradient(135deg, #faf9ff 0%, #ede9fe 100%);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

/* Popular badge on card */
.mdm-option-card.mdm-popular-card {
    border-color: #f59e0b;
}
.mdm-option-card.mdm-popular-card.mdm-selected {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Popular ribbon */
.mdm-popular-ribbon {
    position: absolute;
    top: -11px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
    z-index: 2;
    white-space: nowrap;
}

/* Radio indicator */
.mdm-radio {
    width: 18px; height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.mdm-option-card.mdm-selected .mdm-radio {
    border-color: #6c5ce7;
    background: #6c5ce7;
}
.mdm-option-card.mdm-popular-card.mdm-selected .mdm-radio {
    border-color: #f59e0b;
    background: #f59e0b;
}
.mdm-radio::after {
    content: '';
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}
.mdm-option-card.mdm-selected .mdm-radio::after {
    opacity: 1;
    transform: scale(1);
}

/* Qty pill */
.mdm-qty-pill {
    background: #f3f4f6;
    color: #374151;
    font-size: 12.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}
.mdm-option-card.mdm-selected .mdm-qty-pill {
    background: #6c5ce7;
    color: #fff;
}
.mdm-option-card.mdm-popular-card.mdm-selected .mdm-qty-pill {
    background: #f59e0b;
    color: #fff;
}

/* Price section */
.mdm-price-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.mdm-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.mdm-discounted-price {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.2;
}
.mdm-option-card.mdm-selected .mdm-discounted-price { color: #6c5ce7; }
.mdm-option-card.mdm-popular-card.mdm-selected .mdm-discounted-price { color: #d97706; }

.mdm-original-price {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
    line-height: 1.2;
}

.mdm-discount-badge {
    background: #dcfce7;
    color: #15803d;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.mdm-savings-text {
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    line-height: 1.2;
}

/* ── Update state ──────────────────────────────────────────── */
.mdm-bundle-widget.mdm-updating {
    opacity: 0.7;
    pointer-events: none;
}
.mdm-bundle-widget.mdm-updating::after {
    content: '';
    display: block;
    width: 20px; height: 20px;
    border: 2.5px solid #6c5ce7;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mdm-spin 0.6s linear infinite;
    margin: 10px auto;
}
@keyframes mdm-spin {
    to { transform: rotate(360deg); }
}

/* ── Mobile responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
    .mdm-bundle-widget { margin: 6px 0; border-radius: 10px; }
    .mdm-bundle-header { padding: 8px 10px; gap: 8px; }
    .mdm-bundle-header-text h4 { font-size: 12.5px; }
    .mdm-bundle-header-text p { font-size: 10.5px; font-weight: 600; }
    .mdm-product-row   { padding: 6px 8px; gap: 8px; }
    .mdm-product-img   { width: 32px; height: 32px; }
    .mdm-product-name  { font-size: 12px; }
    .mdm-options-grid  { padding: 6px 4px; gap: 6px; }
    .mdm-option-card   { padding: 8px 10px; gap: 8px; margin-top: 6px; }
    .mdm-qty-pill      { padding: 3px 8px; font-size: 12px; }
    .mdm-discounted-price { font-size: 14.5px; font-weight: 800; }
    .mdm-discount-badge { padding: 3px 7px; font-size: 10.5px; }
}
