@charset "utf-8";

/* ─────────────────────────────────────────────────────────────
 * discount.css — กล่อง "ใส่โค้ดส่วนลด" ในหน้า checkout
 *
 * ★ ลอกมาจาก examplecode/discount.css แต่ "ตัดออกไป 92 บรรทัด"
 *   ต้นฉบับบรรทัด 83–174 เป็นคลาส .dropdown-container กับ .custom-dropdown
 *   ซึ่ง "ไม่ใช่เรื่องโค้ดส่วนลด" และมีอยู่ใน content-all.css อยู่แล้ว
 *   (ใช้โดยฟีเจอร์เลือกขนส่งมาไทย ที่ขึ้น prod ไปตั้งแต่รอบ 12)
 *
 *   ถ้าลอกมาทั้งไฟล์ จะทับของเดิมและทำให้ dropdown ขนส่งเพี้ยน เพราะ
 *     .dropdown-container  margin  20px auto  →  ของเดิมคือ 10px auto
 *     .custom-dropdown     เพิ่ม overflow/white-space/word-break แบบ !important
 *   และ !important ชนะของเดิมเสมอ — ทั้งสองกล่องอยู่หน้า checkout หน้าเดียวกัน
 *
 *   ไฟล์นี้จึงมีเฉพาะคลาสที่ขึ้นต้นด้วย .discount- เท่านั้น
 * ───────────────────────────────────────────────────────────── */

.discount-container {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 99%;
	height: auto;
	box-sizing: border-box;
	margin-top: 0;
	margin-right: 0;
	margin-bottom: 1%;
	margin-left: 0;
}

/* กรอบปรับความสูงอัตโนมัติเพื่อไม่ให้ล้นบนจอมือถือ */
.discount-box {
	width: 100%;
	background: #ffffff;
	padding: 20px;
	box-sizing: border-box;
	border-radius: 12px;
	box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	border: 2px solid #E26DB4;
}

.discount-box h3 {
	margin: 0 0 15px 0;
	font-family: 'Noto Sans Thai';
	color: #333333;
	font-size: 18px;
	width: 100%;
	text-align: left;
}

/* ส่วนของช่องกรอกและปุ่ม */
.discount-input-group {
	display: flex;
	width: 100%;
	gap: 10px;
}

.discount-input-group input {
	flex: 1;
	min-width: 0; /* ป้องกัน input ดันจนเลยขอบบนมือถือจอเล็ก */
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 8px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.3s;
	font-family: "Noto Sans Thai";
}

.discount-input-group input:focus {
	border-color: #ff4757;
}

.discount-input-group button {
	padding: 10px 20px;
	background-color: #ff4757;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	transition: background-color 0.3s;
	white-space: nowrap;
	font-family: serithairegular;
}

.discount-input-group button:hover {
	background-color: #e84118;
}

/* ปุ่มตอนกำลังตรวจโค้ด — กันกดซ้ำ */
.discount-input-group button:disabled {
	background-color: #cccccc;
	cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────
 * ข้อความผลลัพธ์ใต้ช่องกรอก (ยังไม่มีในไฟล์ต้นฉบับ เพิ่มเผื่อไว้)
 * ───────────────────────────────────────────────────────────── */
.discount-msg {
	width: 100%;
	margin-top: 10px;
	font-size: 13px;
	font-family: "Noto Sans Thai";
	line-height: 1.6;
	word-break: break-word;
}

.discount-msg.is-ok {
	color: #1e7e34;
}

.discount-msg.is-error {
	color: #d63031;
}

@media (max-width: 480px) {
	.discount-input-group {
		/* จอแคบมาก ให้ช่องกรอกกับปุ่มเรียงบน-ล่าง */
		flex-direction: column;
	}

	.discount-input-group button {
		width: 100%;
	}

	.discount-container {
		display: flex;
		justify-content: center;
		align-items: center;
		width: 100%;
		height: auto;
		box-sizing: border-box;
		margin-top: 0;
		margin-right: 0;
		margin-bottom: 4%;
		margin-left: 0;
	}
}

/* ─────────────────────────────────────────────────────────────
 * แถวส่วนลดในกล่องสรุปราคา (box-sub-detail-00 / -01 / -02)
 * ใช้ทั้งหน้า checkout และหน้ารายการสั่งซื้อของลูกค้า
 *
 * .discount-row    แถวตัวเลข "ส่วนลดค่าจัดส่ง (CODE)   -50 ฿"
 * .discount-note   บรรทัดอธิบาย "เหลือส่วนลดอีก 5 บาท จะนำไปใช้ลดค่าขนส่งสินค้าพรีออเดอร์"
 * ───────────────────────────────────────────────────────────── */
.discount-row .name-show-list-item {
	color: #1e7e34;
}

.discount-amount {
	color: #1e7e34 !important;
	font-weight: bold;
	white-space: nowrap;
}

/* ★ clear: both — แถวราคาในกล่องเป็น float ทั้งหมด ถ้าไม่ clear กรอบหมายเหตุจะเริ่มตั้งแต่ใต้หัวกล่อง
 *   แล้วลากคลุมแถวราคาทั้งกล่อง (checkout เจอ 11-01 · หน้ารายการสั่งซื้อเจ้าของร้านเจอ 11-01 ออเดอร์ #1000753) */
.discount-note {
	clear: both;
	font-size: 12px;
	line-height: 1.6;
	color: #6B5470;
	background: #F6FBF7;
	border: 1px dashed #BEE3C8;
	border-radius: 8px;
	padding: 6px 10px;
	margin-top: 6px;
	font-family: "Noto Sans Thai";
	word-break: break-word;
}

@media (max-width: 480px) {
	.discount-note {
		font-size: 11px;
		padding: 6px 8px;
	}
}

/* ─────────────────────────────────────────────────────────────
 * กล่องโค้ดตอน "ล็อก" — ยังเลือกขนส่งไม่ครบ (เพิ่ม 2026-11-01)
 *
 * ส่วนลดค่าส่งต้องคิดจากค่าส่งตัวจริง จึงล็อกไว้จนกว่าค่าส่งจะนิ่ง
 * ไม่ซ่อนกล่อง — ลูกค้าต้องรู้ว่ามีช่องใส่โค้ด และรู้ว่าต้องเลือกอะไรก่อน
 * ───────────────────────────────────────────────────────────── */
.discount-box.is-locked {
	border-color: #d9d9d9;
	box-shadow: none;
}

.discount-input-group input:disabled {
	background-color: #f4f4f4;
	color: #9b9b9b;
	cursor: not-allowed;
}

.discount-lock {
	width: 100%;
	margin-top: 10px;
	padding: 10px 12px;
	box-sizing: border-box;
	background: #fafafa;
	border: 1px dashed #cfcfcf;
	border-radius: 8px;
	font-family: "Noto Sans Thai";
	font-size: 13px;
	line-height: 1.6;
	color: #555555;
}

.discount-lock-head {
	font-weight: bold;
	color: #333333;
}

.discount-goto {
	margin-top: 8px;
	padding: 6px 14px;
	background: #ffffff;
	color: #E26DB4;
	border: 1px solid #E26DB4;
	border-radius: 999px;
	font-size: 13px;
	font-family: serithairegular;
	cursor: pointer;
}

.discount-goto:hover {
	background: #fdf0f7;
}
