/* ============================================================
   ส่วนลดราคาซื้อ (mango-api 2.0) — หน้าต่างเลือกส่วนลดก่อนเริ่มแทง + แถบส่วนลดบนหน้าซื้อ
   ส่วนลดใช้กับ "ทั้งโพย" เลือกได้ 1 แบบ → เลือกก่อนเข้าหน้าซื้อ (หน้าแรก) และล็อกเมื่อมีเลขในโพย
   ใช้สีจาก mango-theme.css (--mango-*)
   ============================================================ */

/* ---------- หน้าต่างเลือกส่วนลด (bottom sheet) ---------- */
.modal.action-sheet.dsc-sheet .modal-dialog { min-width: 0; max-width: 560px; margin: 0 auto; left: 0; right: 0; }
.dsc-sheet .modal-content {
    max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
    border-radius: 24px 24px 0 0; overflow: hidden; background: #fffdf8;
}
.dsc-sheet .dsc-grabber { width: 44px; height: 5px; border-radius: 999px; background: #e7dcc6; margin: 9px auto 0; flex-shrink: 0; }
.dsc-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px 14px; flex-shrink: 0; }
.dsc-head .dsc-flag { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; box-shadow: 0 3px 8px #0002; flex-shrink: 0; }
.dsc-head-copy { min-width: 0; flex: 1; }
.dsc-kicker { display: block; font-size: 12.5px; font-weight: 700; color: #a2620a; letter-spacing: .2px; }
.dsc-title { margin: 1px 0 0; font-size: 19px; font-weight: 900; color: var(--mango-ink, #4A3500); line-height: 1.35; overflow-wrap: anywhere; }
.dsc-meta { display: block; font-size: 12.5px; color: #6d6150; margin-top: 1px; }
.dsc-close {
    width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 12px; background: #f4ecdc;
    color: #7a6a4f; font-size: 22px; display: inline-flex; align-items: center; justify-content: center;
}
.dsc-body { overflow: auto; padding: 0 18px 16px; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }

.dsc-rule {
    display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; margin-bottom: 14px;
    border-radius: 14px; background: #fff4df; border: 1px solid #f6dcaa; color: #6b4a07; font-size: 13.5px; line-height: 1.5;
}
.dsc-rule ion-icon { font-size: 19px; color: #e08a00; flex-shrink: 0; margin-top: 1px; }
.dsc-rule strong { color: #4a3500; }

.dsc-section-label { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; font-size: 14px; font-weight: 800; color: #4a3d25; }
.dsc-section-label small { font-size: 12px; font-weight: 600; color: #8a7a5d; }

/* การ์ดชั้นส่วนลด — เลือกได้ 1 แบบ (radio) */
.dsc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.dsc-tile {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
    min-height: 82px; padding: 12px 12px 11px; border-radius: 16px; border: 1.5px solid #eadfca; background: #fff;
    color: #4a3d25; box-shadow: 0 6px 14px -12px rgba(74, 53, 0, .55); transition: transform .12s, border-color .12s, box-shadow .12s;
}
.dsc-tile:active { transform: scale(.97); }
.dsc-tile:focus-visible { outline: 3px solid #ffb020; outline-offset: 2px; }
.dsc-tile-pct { padding-right: 24px; font-size: 21px; font-weight: 900; line-height: 1.15; color: #d16a00; letter-spacing: -.2px; }
.dsc-tile-pct small { font-size: 13px; font-weight: 800; }
.dsc-tile-pay { padding-right: 4px; font-size: 12.5px; font-weight: 600; color: #6d6150; line-height: 1.35; }
.dsc-tile.is-full .dsc-tile-pct { font-size: 17px; color: #146c6e; padding-top: 3px; }
.dsc-tile-check {
    position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
    border: 1.5px solid #dccdb0; background: #fff; display: inline-flex; align-items: center; justify-content: center;
    color: transparent; font-size: 14px;
}
.dsc-tile[aria-checked="true"] {
    border-color: transparent; background: var(--mango-grad, linear-gradient(135deg, #FF8A00, #FFC400));
    box-shadow: var(--mango-shadow, 0 12px 28px -8px rgba(255, 138, 0, .45));
}
.dsc-tile[aria-checked="true"] .dsc-tile-pct,
.dsc-tile[aria-checked="true"] .dsc-tile-pay { color: #fff; }
.dsc-tile[aria-checked="true"] .dsc-tile-pay { opacity: .95; }
.dsc-tile[aria-checked="true"] .dsc-tile-check { background: #fff; border-color: #fff; color: #e07800; }

/* ตารางอัตราจ่ายของชั้นที่เลือก */
.dsc-rates { border-radius: 18px; background: #fff; border: 1px solid #eee3cf; overflow: hidden; box-shadow: 0 10px 22px -20px rgba(74, 53, 0, .7); }
.dsc-rates-head {
    display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: #fff8ea; border-bottom: 1px solid #f1e5cc;
    font-size: 14px; font-weight: 800; color: #5a4310;
}
.dsc-rates-head ion-icon { font-size: 18px; color: #e08a00; }
.dsc-rates-head .dsc-chip { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: #ff9500; color: #fff; font-size: 12.5px; font-weight: 800; }
.dsc-rates-head .dsc-chip.is-full { background: #146c6e; }
.dsc-rate-cols, .dsc-rate-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .9fr); align-items: center; gap: 8px; padding: 0 14px; }
.dsc-rates.no-tote .dsc-rate-cols, .dsc-rates.no-tote .dsc-rate-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.dsc-rate-cols { padding-top: 8px; padding-bottom: 6px; font-size: 12px; font-weight: 700; color: #8a7a5d; }
.dsc-rate-cols span:not(:first-child), .dsc-rate-row > span:not(:first-child) { text-align: right; }
.dsc-rate-row { min-height: 50px; border-top: 1px solid #f5eddd; }
.dsc-rate-name { font-size: 15px; font-weight: 800; color: #3f3420; line-height: 1.3; }
.dsc-rate-name small { display: block; font-size: 11.5px; font-weight: 700; color: #a2620a; }
.dsc-rate-val { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.dsc-rate-val b { font-size: 17px; font-weight: 900; color: #1f6b3a; }
.dsc-rate-val s { font-size: 12px; color: #9a8f7c; text-decoration-thickness: 1.5px; }
.dsc-rate-val.is-same b { color: #3f3420; }
.dsc-nd { font-size: 11px; font-weight: 800; color: #a2620a; background: #fff1d6; border-radius: 6px; padding: 1px 6px; margin-bottom: 2px; }
.dsc-rate-val.na b { font-size: 14px; color: #b3a891; font-weight: 700; }
.dsc-rates-foot { padding: 10px 14px 12px; font-size: 12.5px; color: #6d6150; background: #fffcf5; border-top: 1px solid #f5eddd; line-height: 1.5; }

/* แถบล่าง: สรุป + ปุ่มเริ่มแทง */
.dsc-foot {
    flex-shrink: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: #fff;
    border-top: 1px solid #f1e7d4; box-shadow: 0 -10px 24px -20px rgba(74, 53, 0, .6);
}
.dsc-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13.5px; color: #6d6150; }
.dsc-summary strong { font-size: 16px; font-weight: 900; color: #3f3420; white-space: nowrap; }
.dsc-summary strong em { font-style: normal; color: #d16a00; }
.dsc-cta {
    width: 100%; min-height: 54px; border: 0; border-radius: 16px; background: var(--mango-grad-strong, linear-gradient(120deg, #FF7A00, #FFB000 55%, #FFC83D));
    color: #fff; font-size: 17px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: var(--mango-shadow, 0 12px 28px -8px rgba(255, 138, 0, .45)); text-shadow: 0 1px 2px rgba(120, 60, 0, .35);
}
.dsc-cta:active { transform: translateY(1px); }
.dsc-cta ion-icon { font-size: 21px; }

/* ---------- แถบ "ส่วนลดของโพยนี้" บนหน้าซื้อ ---------- */
.dsc-banner {
    display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 18px;
    background: linear-gradient(120deg, #fff3dc 0%, #fffaf0 70%); border: 1px solid #f6d79f;
    box-shadow: 0 10px 22px -18px rgba(255, 138, 0, .9);
}
.dsc-badge {
    width: 54px; height: 54px; border-radius: 16px; flex-shrink: 0; display: inline-flex; align-items: baseline; justify-content: center;
    padding-top: 12px; background: var(--mango-grad, linear-gradient(135deg, #FF8A00, #FFC400)); color: #fff;
    font-size: 22px; font-weight: 900; line-height: 1; box-shadow: 0 8px 16px -10px rgba(255, 122, 0, .9);
}
.dsc-badge small { font-size: 13px; font-weight: 800; margin-left: 1px; }
.dsc-badge.is-full { background: #e3f1ef; color: #146c6e; align-items: center; padding-top: 0; font-size: 26px; box-shadow: none; }
.dsc-banner-main { min-width: 0; flex: 1; }
.dsc-banner-main span { display: block; font-size: 12px; font-weight: 700; color: #a2620a; }
.dsc-banner-main strong { display: block; font-size: 16.5px; font-weight: 900; color: #4a3500; line-height: 1.3; }
.dsc-banner-main small { display: block; font-size: 12.5px; color: #6d5a35; line-height: 1.45; margin-top: 1px; }
.dsc-banner-btn {
    flex-shrink: 0; min-height: 40px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid #ffb020; background: #fff;
    color: #c25f00; font-size: 14px; font-weight: 900; display: inline-flex; align-items: center; gap: 4px;
}
.dsc-banner-btn.is-locked { border-color: #e6dccb; color: #8a7a5d; background: #f7f2e8; }
.dsc-banner-btn ion-icon { font-size: 16px; }
.dsc-banner.attn { border-color: #d94841; box-shadow: 0 0 0 3px rgba(217, 72, 65, .2); }

@media (max-width: 360px) {
    .dsc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dsc-banner { flex-wrap: wrap; }
    .dsc-banner-btn { width: 100%; justify-content: center; }
}
