/* ตะกร้า + ชำระเงิน shopping UI ใหม่ — prefix .sco-
   shopping/cart_shopping/cart_page_v2.php + cart_items_v2.php (ตะกร้า) + cart_item_c_out_v2.php (รายการหน้าชำระเงิน)
   ฟอร์มข้อมูลการสั่งซื้อ (cart_purchase_info.php เดิม) ทับด้วย CSS ใต้ .sco-form · สีจาก configmlm ผ่าน --shd-* */

.sco {
    --sco-c1: var(--shd-c1, #2cabe3);
    --sco-c2: var(--shd-c2, #0a4069);
    --sco-text: var(--shd-text, #12263a);
    --sco-muted: #5b6b7b;
    --sco-line: #e3e8ef;
    --sco-soft: #f1f4f7;
    --sco-tint: color-mix(in srgb, var(--sco-c1) 12%, #fff);
    --sco-danger: var(--shd-cancel, #d92d20);
    background: #f4f6f9;
    color: var(--sco-text);
    padding: 20px 0 64px;
}
.sco *, .sco *::before, .sco *::after { box-sizing: border-box; }
.sco-wrap { width: 100%; padding: 0 32px; }
.sco h1, .sco h2 { color: var(--sco-text); margin: 0; }
.sco [hidden] { display: none !important; }

/* ---------- ขั้นตอน ---------- */
.sco-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; animation: sco-rise .4s cubic-bezier(.2, .7, .2, 1) both; }
.sco-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--sco-muted); flex-wrap: wrap; }
.sco-steps li { display: flex; align-items: center; gap: 8px; }
.sco-steps li a { display: flex; align-items: center; gap: 8px; color: inherit; }
.sco-steps li span {
    width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #e3e8ef; color: var(--sco-muted); font-size: 13px;
}
.sco-steps li i { display: block; width: 40px; height: 2px; background: #d5dde6; border-radius: 1px; }
.sco-steps li.is-done { color: var(--sco-c2); }
.sco-steps li.is-done span { background: var(--sco-c2); color: #fff; }
.sco-steps li.is-done i { background: var(--sco-c2); }

/* ---------- โครง ---------- */
.sco-grid { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.sco-col, .sco-lines-card { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.sco-card {
    background: #fff; border: 1px solid var(--sco-line); border-radius: 20px; padding: 22px 24px;
    animation: sco-rise .45s cubic-bezier(.2, .7, .2, 1) both;
}
.sco-col > .sco-card:nth-child(2) { animation-delay: .06s; }
.sco-col > .sco-card:nth-child(3) { animation-delay: .12s; }
.sco-lines-card { gap: 0; }
.sco-card h1 { font-size: 22px; font-weight: 700; }
.sco-card h1 small { font-size: 15px; font-weight: 500; color: var(--sco-muted); }
.sco-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 16px; }
.sco-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }

/* ---------- ปุ่ม ---------- */
.sco-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
    font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; transition: filter .15s, transform .15s;
}
.sco-btn--primary { background: var(--sco-c2); color: #fff !important; }
.sco-btn--primary:hover { filter: brightness(1.1); }
.sco-btn--primary:active { transform: scale(.98); }
.sco-btn--block { width: 100%; }
.sco-btn--lg { height: 54px; font-size: 17px; border-radius: 14px; }
.sco-btn.is-disabled { opacity: .5; pointer-events: none; }
.sco-text-btn { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; color: var(--sco-c2) !important; }
.sco-text-btn:hover { text-decoration: underline; }
.sco-danger { color: var(--sco-danger) !important; }

/* ---------- แถวสินค้า ---------- */
.sco-line {
    display: grid; grid-template-columns: 72px minmax(0, 1fr) auto auto 40px; align-items: center; gap: 16px;
    padding: 16px 0; border-top: 1px solid #eef1f5;
}
.sco-line--ro { grid-template-columns: 56px minmax(0, 1fr) auto; padding: 12px 0; }
.sco-thumb { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: #eef2f6; display: block; }
.sco-line--ro .sco-thumb { width: 56px; height: 56px; border-radius: 10px; }
.sco-line-name { display: block; font-weight: 600; color: var(--sco-text) !important; line-height: 1.4; }
a.sco-line-name:hover { color: var(--sco-c2) !important; }
.sco-line-meta { font-size: 13px; color: var(--sco-muted); margin-top: 2px; }
.sco-pack { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; color: var(--sco-muted); }
.sco-line-sum { text-align: right; min-width: 110px; }
.sco-line-sum strong { display: block; font-size: 17px; }
.sco-line-sum span { font-size: 12px; font-weight: 700; color: var(--sco-c2); }
.sco-qty { display: inline-flex; align-items: center; border: 1px solid var(--sco-line); border-radius: 10px; overflow: hidden; background: #fff; }
.sco-qty button { width: 40px; height: 40px; border: 0; background: #fff; font-size: 18px; color: #34495e; cursor: pointer; transition: background .15s; }
.sco-qty button:hover:not(:disabled) { background: var(--sco-soft); }
.sco-qty button:disabled { color: #b8c4d0; cursor: not-allowed; }
.sco-qty input { width: 46px; height: 40px; border: 0; text-align: center; font: inherit; font-weight: 700; color: var(--sco-text); background: transparent; }
.sco-del { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: #8a99a8; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.sco-del:hover { background: #fef3f2; color: var(--sco-danger); }
.sco-lines-foot { display: flex; justify-content: space-between; padding-top: 16px; border-top: 1px solid #eef1f5; }
.sco-empty { text-align: center; padding: 40px 0 24px; color: var(--sco-muted); }
.sco-empty-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--sco-soft); color: var(--sco-c1); display: inline-flex; align-items: center; justify-content: center; }
.sco-empty p { margin: 12px 0 16px; }
.sco-muted { color: var(--sco-muted); margin: 0; }
.sco-loading { height: 4px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--sco-c1), transparent); background-size: 200% 100%; animation: sco-load 1s linear infinite; margin: 12px 0; }
@keyframes sco-load { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- สรุปยอด ---------- */
.sco-summary { flex: 1 1 340px; position: sticky; top: 96px; animation-delay: .08s; }
.sco-summary dl { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 10px; font-size: 15px; }
.sco-summary dt { color: var(--sco-muted); font-weight: 500; }
.sco-summary dd { margin: 0; text-align: right; font-weight: 600; }
.sco-summary .sco-pv { color: var(--sco-c2); font-weight: 700; }
.sco-grand { margin: 14px 0 16px; padding-top: 14px; border-top: 1px dashed #d5dde6; display: flex; justify-content: space-between; align-items: baseline; }
.sco-grand span { font-weight: 700; }
.sco-grand strong { font-size: 28px; }
.sco-warn { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fef3f2; color: var(--sco-danger); font-size: 13px; }
.sco-note { margin: 10px 0 0; font-size: 12px; color: var(--sco-muted); text-align: center; }

/* ---------- ฟอร์มข้อมูลการสั่งซื้อ (markup เดิม cart_purchase_info.php) ---------- */
.sco-form .row { margin-left: -8px; margin-right: -8px; }
.sco-form .row > [class*="col-"] { padding-left: 8px; padding-right: 8px; }
.sco-form .form-group { margin-bottom: 16px; }
.sco-form .input-group { display: flex !important; flex-direction: column; align-items: stretch; width: 100%; }
.sco-form .input-group-addon {
    width: auto !important; min-width: 0 !important; padding: 0 0 6px !important;
    background: none !important; border: 0 !important; text-align: left !important;
    font-size: 14px; font-weight: 600; color: var(--sco-text); white-space: normal;
}
.sco-form .form-control,
.sco-form .custom_select select {
    width: 100% !important; height: 46px; border: 1px solid var(--sco-line) !important; border-radius: 12px !important;
    padding: 0 14px; font: inherit; font-size: 15px; color: var(--sco-text); background: #fff; box-shadow: none !important;
}
.sco-form .form-control[readonly] { background: #f6f9fb; color: #34495e; }
.sco-form .form-control:focus { border-color: var(--sco-c1) !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--sco-c1) 15%, transparent) !important; outline: none; }
.sco-form .custom_select { width: 100%; }
.sco-form .select2-container { width: 100% !important; }
.sco-form .select2-container .select2-selection--single { height: 46px !important; border: 1px solid var(--sco-line) !important; border-radius: 12px !important; display: flex; align-items: center; }
.sco-form .select2-container .select2-selection__rendered { line-height: 44px !important; padding-left: 14px !important; color: var(--sco-text) !important; }
.sco-form .select2-container .select2-selection__arrow { height: 44px !important; right: 8px !important; }
.sco-form h3, .sco-form h4 { font-size: 15px; font-weight: 700; margin: 8px 0 10px; }
.sco-form > h3.mb-30:first-of-type { display: none; } /* หัวข้อ buy_info เดิมซ้ำกับหัวการ์ด */
.sco-form .form-check-input { accent-color: var(--sco-c2); }
/* ประเภทบิล / การจัดส่ง เป็นการ์ด (select เดิมซ่อน) */
.sco-form .sco-has-choices .custom_select { display: none !important; }
.sco-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.sco-choice {
    min-height: 54px; padding: 10px 14px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--sco-line); background: #fff; color: var(--sco-text);
    font: inherit; font-size: 14px; font-weight: 700; text-align: left;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.sco-choice:hover:not(:disabled) { border-color: var(--sco-c1); }
.sco-choice.is-on { border-color: var(--sco-c2); background: #f2f8fc; box-shadow: inset 0 0 0 1px var(--sco-c2); color: var(--sco-c2); }
.sco-choice:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- วิธีชำระเงิน ---------- */
.sco-pay { display: flex; flex-direction: column; gap: 10px; }
.sco-pay-opt {
    position: relative; display: flex; align-items: center; gap: 14px; min-height: 60px; margin: 0;
    padding: 10px 16px; border: 1px solid var(--sco-line); border-radius: 12px; background: #fff; cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.sco-pay-opt:hover { border-color: var(--sco-c1); }
.sco-pay-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sco-pay-dot { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; border: 2px solid #b8c4d0; transition: border .15s; }
.sco-pay-name { flex: 1; font-weight: 700; }
.sco-pay-side { font-size: 13px; font-weight: 700; color: var(--sco-c2); }
.sco-pay-opt:has(input:checked) { border-color: var(--sco-c2); background: #f2f8fc; box-shadow: inset 0 0 0 1px var(--sco-c2); }
.sco-pay-opt:has(input:checked) .sco-pay-dot { border: 6px solid var(--sco-c2); }
.sco-pay-opt:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--sco-c1) 40%, transparent); outline-offset: 2px; }

@keyframes sco-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .sco *, .sco *::before, .sco *::after { animation: none !important; transition: none !important; }
}

/* ---------- จอเล็ก ---------- */
@media (max-width: 767px) {
    .sco-wrap { padding: 0 12px; }
    .sco-card { padding: 16px; border-radius: 16px; }
    .sco-steps li i { width: 18px; }
    .sco-line { grid-template-columns: 56px minmax(0, 1fr) 36px; grid-template-areas: "img info del" "img qty sum"; row-gap: 10px; column-gap: 12px; }
    .sco-line .sco-thumb { grid-area: img; width: 56px; height: 56px; align-self: start; }
    .sco-line .sco-line-info { grid-area: info; }
    .sco-line .sco-qty { grid-area: qty; justify-self: start; }
    .sco-line .sco-line-sum { grid-area: sum; min-width: 0; }
    .sco-line .sco-del, .sco-line > span:last-child { grid-area: del; align-self: start; }
    .sco-line--ro { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: none; }
    .sco-line--ro > * { grid-area: auto !important; }
    .sco-summary { position: static; }
    .sco-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
