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

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

/* ── Widget Container (Inside Order Review Card) ──────── */
.mdm-bundle-widget {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.08);
    margin: 4px 0;
    border: 1px solid #ffedd5;
    font-family: 'Hind Siliguri', 'Inter', sans-serif;
}

.mdm-bundle-header {
    display: none !important;
}

/* ── Product info row ──────────────────────────────────────── */
.mdm-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.mdm-product-img {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    border: 1px solid #cbd5e1 !important;
    flex-shrink: 0 !important;
}
.mdm-product-name {
    font-family: 'Hind Siliguri', 'Inter', sans-serif;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    flex: 1;
    line-height: 1.3;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

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

.mdm-option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    user-select: none;
    margin-top: 3px;
    font-family: 'Hind Siliguri', 'Inter', sans-serif;
}
.mdm-option-card:hover {
    border-color: #fdba74;
    background: #fff7ed;
}
.mdm-option-card.mdm-selected {
    border-color: #f97316;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* Popular badge on card - neutral border when not selected */
.mdm-option-card.mdm-popular-card {
    border-color: #e5e7eb;
    margin-top: 8px;
}
.mdm-option-card.mdm-popular-card:hover {
    border-color: #fcd34d;
    background: #fffbeb;
}
.mdm-option-card.mdm-popular-card.mdm-selected {
    border-color: #f59e0b !important;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15) !important;
}

/* Popular ribbon - Top-Right alignment */
.mdm-popular-ribbon {
    position: absolute;
    top: -10px;
    right: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    font-family: 'Hind Siliguri', '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: #f97316;
    background: #f97316;
}
.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: 14px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Hind Siliguri', 'Inter', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}
.mdm-option-card.mdm-selected .mdm-qty-pill {
    background: #f97316;
    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: 'Hind Siliguri', 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.2;
}
.mdm-option-card.mdm-selected .mdm-discounted-price { color: #f97316; }
.mdm-option-card.mdm-popular-card.mdm-selected .mdm-discounted-price { color: #d97706; }

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

.mdm-discount-badge {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-family: 'Hind Siliguri', 'Inter', sans-serif;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
    letter-spacing: 0.2px;
}

.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 — multi-breakpoint ───────────────── */

/* Tablets & large phones */
@media (max-width: 768px) {
    .mdm-bundle-widget { margin: 6px 0; border-radius: 10px; }
    .mdm-bundle-header { display: none !important; }
    .mdm-product-row   { padding: 8px 10px; gap: 10px; }
    .mdm-product-img   { width: 52px !important; height: 52px !important; min-width: 52px !important; }
    .mdm-product-name  { font-size: 15px !important; font-weight: 700 !important; }
    .mdm-options-grid  { padding: 6px 3px; gap: 6px; }
    .mdm-option-card   { padding: 9px 10px; gap: 8px; margin-top: 5px; }
    .mdm-qty-pill      { padding: 4px 9px; font-size: 13.5px; }
    .mdm-discounted-price { font-size: 16px; font-weight: 800; }
    .mdm-discount-badge { padding: 3px 7px; font-size: 11px; }
    .mdm-price-row     { gap: 4px; }
}

/* Standard phones (480px and below) */
@media (max-width: 480px) {
    .mdm-bundle-widget { margin: 5px 0; border-radius: 8px; border-width: 1px; }
    .mdm-bundle-header { display: none !important; }
    .mdm-product-row   { padding: 8px 10px; gap: 10px; }
    .mdm-product-img   { width: 48px !important; height: 48px !important; min-width: 48px !important; border-radius: 8px !important; }
    .mdm-product-name  { font-size: 14.5px !important; font-weight: 700 !important; }
    .mdm-options-grid  { padding: 5px 2px; gap: 5px; }
    .mdm-option-card   { padding: 8px 8px; gap: 7px; margin-top: 4px; border-radius: 8px; }
    .mdm-radio         { width: 18px; height: 18px; }
    .mdm-radio::after  { width: 6px; height: 6px; }
    .mdm-qty-pill      { padding: 3px 8px; font-size: 13px; border-radius: 5px; }
    .mdm-discounted-price { font-size: 15.5px; }
    .mdm-original-price { font-size: 12px; }
    .mdm-discount-badge { padding: 2px 6px; font-size: 10.5px; border-radius: 4px; }
    .mdm-popular-ribbon { font-size: 9.5px; padding: 2px 7px; top: -9px; right: 6px; }
    .mdm-price-row     { gap: 4px; row-gap: 2px; }
    .mdm-savings-text  { font-size: 11px; }
}

/* Small phones (360px and below — like iPhone SE, Galaxy A series) */
@media (max-width: 360px) {
    .mdm-bundle-widget { margin: 4px 0; }
    .mdm-bundle-header { display: none !important; }
    .mdm-product-row   { padding: 6px 8px; gap: 8px; }
    .mdm-product-img   { width: 44px !important; height: 44px !important; min-width: 44px !important; }
    .mdm-product-name  { font-size: 14px !important; font-weight: 700 !important; }
    .mdm-options-grid  { padding: 4px 2px; gap: 4px; }
    .mdm-option-card   { padding: 7px 6px; gap: 6px; margin-top: 3px; }
    .mdm-radio         { width: 16px; height: 16px; border-width: 2px; }
    .mdm-radio::after  { width: 5px; height: 5px; }
    .mdm-qty-pill      { padding: 3px 7px; font-size: 12.5px; }
    .mdm-discounted-price { font-size: 15px; }
    .mdm-original-price { font-size: 11.5px; }
    .mdm-discount-badge { padding: 2px 5px; font-size: 10px; }
    .mdm-popular-ribbon { font-size: 9px; padding: 2px 6px; top: -8px; }
}
