/* --- CSS Variables --- */
:root {
    --primary-color: #ff6132;
    --dark-color: #333;
    --light-gray-color: #f4f4f4;
    --white-color: #ffffff;
    --border-color: #ddd;
    --font-family: 'IBM Plex Sans Thai', sans-serif;
}

/* --- Basic Reset & Body --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--dark-color);
    line-height: 1.6;
    background-color: var(--light-gray-color); 
}

.container {
    max-width: 1000px;
    margin: auto;
    padding: 0 20px;
}

/* --- Navigation Bar --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--white-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.navbar .nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
}

.navbar .nav-menu li a {
    padding: 0 1rem;
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar .nav-menu li a:hover {
    color: var(--primary-color);
}

/* (เพิ่ม) สไตล์สำหรับเมนูที่ Active */
.navbar .nav-menu li a.active {
    color: var(--primary-color);
    font-weight: 700;
}

/* --- Hamburger Menu --- */
.hamburger {
    display: none;
    cursor: pointer;
}

.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    -webkit-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
    background-color: var(--dark-color);
}

.nav-actions {
    display: flex;
    align-items: center;
}

/* --- Base Button Styles --- */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-family: 'IBM Plex Sans Thai', sans-serif;
    cursor: pointer;
    font-size: 1rem;
    display: inline-block;
    text-align: center;
}

.nav-actions .btn {
    margin-left: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #e66e00;
    border-color: #e66e00;
}

.btn-secondary {
     background-color: transparent;
     color: var(--dark-color);
     border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--light-gray-color);
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
}

/* --- Profile Icon Button (from profile.html) --- */
#profile-modal-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

/* --- Language Switcher Styles --- */
.language-switcher { 
    position: relative; 
    margin-left: 1rem; 
}
.lang-button { 
    background-color: var(--light-gray-color); 
    border: 1px solid var(--border-color); 
    padding: 0.5rem 1rem; 
    border-radius: 5px; 
    cursor: pointer; 
    font-family: var(--font-family); 
    font-size: 0.9rem; 
    font-weight: 500; 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
}
.lang-button .fa-chevron-down { 
    transition: transform 0.2s ease; 
}
.lang-dropdown { 
    display: none; 
    position: absolute; 
    top: 100%; 
    right: 0; 
    margin-top: 8px; 
    background-color: var(--white-color); 
    border: 1px solid var(--border-color); 
    border-radius: 5px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    z-index: 110; 
    width: 150px; 
    overflow: hidden; 
}
.lang-dropdown.show { 
    display: block; 
}
.lang-option { 
    display: block; 
    padding: 0.75rem 1rem; 
    text-decoration: none; 
    color: var(--dark-color); 
    font-size: 0.95rem; 
}
.lang-option:hover { 
    background-color: var(--light-gray-color); 
}

/* --- Hero Banner (from index.html) --- */
.hero {
    height: 30vh;
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://www.wwafair2025.com/wwa2025_merch/images/prod1big.jpg') no-repeat center center/cover;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--white-color);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* --- Products Section (from index.html) --- */
.products-section {
    padding: 4rem 0;
    background-color: transparent; 
}

.products-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.product-card {
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    padding: 1rem;
    transition: box-shadow 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-card img {
    max-width: 100%;
	width: 100%;          /* <-- 1. เพิ่มบรรทัดนี้ */
    /* height: 200px; */  /* <-- 2. ลบ หรือ comment บรรทัดนี้ */
    aspect-ratio: 1 / 1;  /* <-- 3. เพิ่มบรรทัดนี้ */
    object-fit: cover;
    margin-bottom: 1rem;
    cursor: zoom-in;
}

.product-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.product-card .price {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.quantity-selector {
    display: flex;
    justify-content: center;
    align-items: center;
}

.quantity-selector button {
    background: var(--light-gray-color);
    border: 1px solid var(--border-color);
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    touch-action: manipulation;
}

.quantity-selector input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    -moz-appearance: textfield;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Checkout Section (from index.html) --- */
.checkout-section {
    padding: 4rem 0;
    background-color: transparent;
}

.checkout-container {
    max-width: 1000px;
    margin: auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--white-color);
}

.total-price-display {
    text-align: right;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
}

.total-price-display span {
    color: var(--primary-color);
}

/* (Updated) Universal h3 style for checkout/forms */
.checkout-container h3,
.form-container h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray-color);
    padding-bottom: 0.5rem;
}

.options-buttons {
    display: flex;
    gap: 1rem;
}

.options-buttons .option-btn {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    font-family: var(--font-family);
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--white-color);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.options-buttons .option-btn.active {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

#ems-form {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--light-gray-color);
    border-radius: 5px;
}

/* ===== (เพิ่ม) CSS ใหม่สำหรับปุ่ม "ลบที่อยู่" ===== */
#ems-form h4 {
    position: relative; /* 1. ตั้งเป็น Anchor */
    margin-bottom: 1.5rem; /* 2. เพิ่มช่องว่างข้างล่าง */
}
.btn-clear-address {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%); /* 3. จัดให้อยู่กลางแนวตั้ง */
    
    padding: 0.1rem 0.5rem; /* 4. ปรับขนาดให้เล็ก */
    font-size: 0.8rem;
    font-weight: 500;
    
    /* 5. (เพิ่ม) ใช้สีโทนแดง/เตือน */
    background-color: #fcebeb;
    border-color: #e6a9a7;
    color: #c0392b;
}
.btn-clear-address:hover {
    background-color: #c0392b;
    color: var(--white-color);
    border-color: #c0392b;
}
.btn-clear-address i {
    margin-right: 4px;
}
/* ===== จบส่วน CSS ใหม่ ===== */


/* --- Base Form Styles (from index, payment, edit) --- */
.form-group {
    margin-bottom: 1rem; /* Base style from index */
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500; /* (Merged) */
    color: #555; /* (Merged) */
}
.form-group label i { /* (from payment) */
    color: var(--primary-color);
    margin-right: 8px;
    width: 20px;
    text-align: center;
}
.form-group input, .form-group textarea, .form-group select,
.form-group input[type="text"], .form-group input[type="number"] { /* (Merged) */
    width: 100%;
    padding: 0.7rem; /* Base style from index */
    font-family: var(--font-family);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--white-color); /* (from edit) */
    
    font-size: 16px; /* ป้องกันการซูมอัตโนมัติบน iOS */
}
.form-group input:focus, .form-group select:focus { /* (from payment) */
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.2);
}
.form-group select:disabled { /* (from edit) */
    background-color: var(--light-gray-color);
    color: #777;
    cursor: not-allowed;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: center; /* (Merged from payment) */
}
.form-row .form-group {
    flex: 1;
}
.form-row .form-group-select { /* (from payment) */
    flex: 1; 
    margin-bottom: 0; 
}
.time-note { /* (from payment) */
    font-size: 0.9rem; 
    color: #777; 
    margin-left: 0.5rem; 
}
.time-colon { /* (from payment) */
    font-size: 1.2rem; 
    font-weight: 600; 
    color: #555; 
}

/* --- Final Summary (from index) --- */
.final-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light-gray-color);
    border-radius: 8px;
}
.final-summary .summary-total {
    font-size: 1.5rem;
    font-weight: 700;
    border-top: none; 
    padding-top: 0;
    margin-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.final-summary .summary-total #summary-total {
    color: var(--primary-color);
}
#summary-item-list {
    width: 100%;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.summary-item .summary-item-name {
    color: var(--dark-color);
    padding-right: 1rem;
    word-break: break-word;
}
.summary-item .summary-item-price {
    font-weight: 600;
    color: var(--dark-color);
    flex-shrink: 0;
}
.summary-disclaimer {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: #777;
    margin-top: 1rem;
    line-height: 1.4;
}

.submit-order-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.5rem;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

/* --- Custom Checkbox CSS --- */
.terms-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
}
.terms-container a {
	color:var(--primary-color);
}
.terms-container input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}
.terms-container label {
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    user-select: none;
}
.terms-container label::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: 12px;
    background-color: var(--white-color);
    transition: all 0.2s ease;
}
.terms-container input[type="checkbox"]:checked + label::before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M1.5 4.5l1.5 1.5 3.5-3.5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 70%;
}
.terms-container input[type="checkbox"]:focus + label::before {
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.4);
}
.submit-order-btn:disabled {
    background-color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}
.icon-size {
	width:80%;
	pointer-events: none;
}
.icon-size-pp {
	width:50%;
	pointer-events: none;
}
.icon-size-list {
	/*width:80%;*/
	height: 30px;
	pointer-events: none;
}
.icon-size-pp-list {
	/*width:50%;*/
	height: 30px;
	pointer-events: none;
}
/* --- Modal Styles --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.modal-overlay.show {
    display: flex;
}
.modal-content {
    background: var(--white-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
}
.modal-close:hover {
    color: var(--dark-color);
}
.modal-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-align: center;
}
.modal-product-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-product-info img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: default;
}
.size-selector-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.size-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}
.size-item span {
    font-size: 1.1rem;
    font-weight: 600;
}
.modal-actions {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}
.modal-actions .btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
}
.select-options-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}

/* --- Profile Modal (from profile.html) --- */
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.profile-info-row {
    font-size: 1.1rem;
}
.profile-info-row label {
    display: block;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}
.profile-info-row span {
    font-weight: 600;
    word-break: break-all;
}

/* --- Image Lightbox CSS --- */
#image-modal {
    z-index: 201;
}
#image-modal .modal-content-image {
    background: none;
    box-shadow: none;
    padding: 0;
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto; /* (เพิ่มบรรทัดนี้) */
}
#image-modal #modal-image-src {
    display: block;
    max-width: 100%;
    /* (ลบ) max-height: 100%; */ /* <-- ลบบรรทัดนี้ทิ้ง */
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    cursor: default;
}
#image-modal .modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2.5rem;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
#image-modal .modal-close:hover {
    opacity: 1;
    color: white;
}


/* --- Sticky Total Bar CSS --- */
.sticky-total-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: 1rem 0;
    z-index: 199;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.sticky-total-bar.show-sticky {
    transform: translateY(0);
}
.sticky-total-bar.hide-sticky {
    transform: translateY(100%);
}
.sticky-total-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
}
.sticky-total-bar span:first-child {
    font-weight: 500;
    font-size: 1.1rem;
}
.sticky-total-bar span:last-child {
    font-weight: 700;
    font-size: 1.3rem;
}

/* --- Page-Specific: order_confirmation.html & vieworder.html --- */
.confirmation-section, .order-list-section { 
    padding: 3rem 0; 
}
.confirmation-section h2, .order-list-section h2 { 
    text-align: center; 
    margin-bottom: 2rem; 
    font-size: 2.5rem; 
}
.order-card { 
    background: var(--white-color); 
    border: 1px solid #e0e0e0; 
    border-radius: 8px; 
    margin-bottom: 2rem; 
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; 
}
.order-card:hover { 
    /*transform: translateY(-5px);*/ 
    box-shadow: 0 8px 25px rgba(0,0,0,0.15); 
}
.order-detail strong, .shipping-address strong, .order-item-list strong, .order-header .order-id { 
    display: flex; 
    align-items: center; 
    font-weight: 500; 
    color: #555; 
}
.order-header .order-id { 
    font-weight: 600; 
}
.order-detail i, .shipping-address i, .order-item-list i, .order-header i { 
    color: var(--primary-color); 
    margin-right: 10px; 
    font-size: 1.1em; 
    width: 20px; 
    text-align: center; 
}
.order-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background-color: var(--light-gray-color); 
    padding: 1rem 1.5rem; 
    border-bottom: 1px solid var(--border-color); 
}
.order-status { 
    padding: 0.3rem 0.8rem; 
    border-radius: 15px; 
    font-weight: 600; 
    font-size: 0.9rem; 
    text-align: center; 
}
.order-status.awaiting { 
    background-color: #ffc107; 
    color: var(--dark-color); 
}
.order-status.completed { 
    background-color: #00911b; 
    color: white; 
}
.order-status.processing { 
    background-color: #ff7e00; 
    color: white; 
}
.order-body { 
    padding: 1.5rem; 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 1.5rem; 
}
.order-detail { 
    font-size: 1rem; 
}
.order-detail strong { 
    margin-bottom: 0.25rem; 
}
.order-detail span { 
    font-weight: 600; 
}
.order-detail .total-note { 
    display: block; 
    font-size: 0.8rem; 
    color: #777; 
    margin-top: 0.25rem; 
}
.order-item-list { 
    grid-column: span 3; 
    margin-top: 1rem; 
    padding-top: 1rem; 
    border-top: 1px solid var(--border-color); 
}
.order-item-list > strong { 
    margin-bottom: 1rem; 
}
.item-image { 
    width: 60px; 
    height: 60px; 
    border-radius: 4px; 
    object-fit: cover; 
    flex-shrink: 0; 
}
.order-item-header { 
    display: flex; 
    justify-content: space-between; 
    font-weight: 600; 
    color: #555; 
    padding: 0 0.5rem 0.5rem 0.5rem; 
    border-bottom: 2px solid var(--border-color); 
    margin-bottom: 1rem; 
}
.item-header-title { 
    flex-grow: 1; 
}
.item-header-qty { 
    flex-basis: 80px; 
    text-align: center; 
}
.order-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 1rem; 
    padding-bottom: 1rem; 
    margin-bottom: 1rem; 
    border-bottom: 1px solid var(--light-gray-color); 
}
.order-item:last-child { 
    border-bottom: none; 
    margin-bottom: 0; 
}
.item-info { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
}
.item-details { 
    display: flex; 
    flex-direction: column; 
}
.item-name { 
    font-weight: 600; 
}
.item-price { 
    font-size: 0.9rem; 
    color: #666; 
}
.item-quantity { 
    font-size: 1.8rem; 
    font-weight: 700; 
    color: var(--primary-color); 
    flex-basis: 80px; 
    text-align: center; 
}
.order-summary-row { 
    grid-column: span 3; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: 1rem; 
    padding-top: 1rem; 
    border-top: 1px solid var(--border-color); 
    font-size: 1.1rem; 
}
.order-summary-row strong { 
    font-weight: 500; 
    display: flex; 
    align-items: center; 
    color: #555; 
}
.order-summary-row strong i { 
    color: var(--primary-color); 
    margin-right: 10px; 
    font-size: 1.1em; 
    width: 20px; 
    text-align: center; 
}
.order-summary-row .summary-price { 
    font-weight: 700; 
    font-size: 1.2rem; 
    color: var(--dark-color); 
}
.shipping-address { 
    grid-column: span 3; 
    margin-top: 1rem; 
    padding-top: 1rem; 
    border-top: 1px solid var(--border-color); 
    position: relative; 
}
.shipping-address strong { 
    margin-bottom: 0.5rem; 
}
.shipping-address address { 
    font-style: normal; 
    background-color: var(--light-gray-color); 
    padding: 1rem; 
    border-radius: 5px; 
}
.tracking-section { 
    grid-column: span 3; 
    margin-top: 1rem; 
    padding: 1.5rem; 
    text-align: center; 
    background-color: #e9f5ff; 
    border: 1px solid #bde0fe; 
    border-radius: 8px; 
}
.tracking-section p { 
    margin: 0.5rem 0; 
}
.tracking-number { 
    font-weight: 700; 
    color: var(--primary-color); 
    font-size: 1.2rem; 
}
.tracking-section .btn { 
    margin-bottom: 1rem; 
}
.order-actions { 
    grid-column: span 3; 
    margin-top: 1.5rem; 
    padding-top: 1.5rem; 
    border-top: 1px solid var(--border-color); 
    display: flex; 
    gap: 2rem; 
    align-items: flex-start; 
}
.order-actions .action-group { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
}
.action-group .btn { 
    width: 100%; 
    max-width: 280px; 
    margin-bottom: 0.8rem; 
}
.action-group .deadline-text { 
    font-size: 0.95rem; 
    color: #666; 
    line-height: 1.4; 
    margin-top: 0.2rem; 
}
.action-group h5 { 
    font-size: 1rem; 
    font-weight: 600; 
    margin-bottom: 0.75rem; 
    color: #555; 
}
.order-actions .alternative-payment-buttons { 
    display: flex; 
    flex-direction: row; 
    gap: 0.8rem; 
    width: 100%; 
    justify-content: center; 
}
.order-actions .alternative-payment-buttons .btn { 
    flex: 1; 
    margin-bottom: 0; 
    padding-left: 0.5rem; 
    padding-right: 0.5rem; 
}
.order-actions .divider { 
    width: 1px; 
    background-color: var(--border-color); 
    align-self: stretch; 
    margin: 0 1rem; 
}
.btn-edit-address { 
    position: absolute; 
    top: 0.5rem; 
    right: 1rem; 
    padding: 0.25rem 0.75rem; 
    font-size: 0.85rem; 
    font-weight: 500; 
    line-height: 1.5; 
}
.btn-edit-address i { 
    margin-right: 5px; 
}
.btn-edit-pickupby { 
    position: absolute; 
    top: 0.5rem; 
    right: 1rem; 
    padding: 0.25rem 0.75rem; 
    font-size: 0.85rem; 
    font-weight: 500; 
    line-height: 1.5; 
}
.btn-edit-pickupby i { 
    margin-right: 5px; 
}
.confirmation-details { 
    grid-column: span 3; 
    margin-top: 1rem; 
    padding: 1.5rem; 
    text-align: center; 
    background-color: #fffbeb; 
    border: 1px solid var(--warning-color); 
    border-radius: 8px; 
}
.payment-highlight-box { 
    background-color: var(--white-color); 
    border: 2px solid var(--primary-color); 
    border-radius: 8px; 
    padding: 1.5rem; 
    margin: 1.5rem auto; 
    max-width: 600px; 
}
.payment-highlight-box p { 
    margin-bottom: 0.25rem; 
    font-size: 1rem; 
    font-weight: 500; 
}
.payment-highlight-box .total-amount-display { 
    font-size: 2.2rem; 
    font-weight: 700; 
    color: var(--danger-color); 
    margin-bottom: 1rem; 
    line-height: 1.2; 
}
.payment-highlight-box .deadline-display { 
    font-size: 1.2rem; 
    font-weight: 700; 
    color: var(--dark-color); 
}
.instructions { 
    font-size: 0.9rem; 
    color: #555; 
    max-width: 600px; 
    margin: 1rem auto; 
    text-align: center; 
}
.bank-details { 
    margin: 2rem auto; /* <-- เปลี่ยน 0 เป็น auto เพื่อจัดกลาง */
    padding: 1rem; 
    border: 1px solid var(--border-color); 
    background: var(--white-color); 
    border-radius: 5px; 
    text-align: left; 
    max-width: 600px; /* <-- เพิ่มบรรทัดนี้ ให้กว้างเท่ากล่องบน */
    /* display: block; (ลบ/คงไว้ก็ได้ แต่ max-width จะคุมแทน) */
}
.bank-details h5 { 
    font-size: 1.1rem; 
    margin-bottom: 1rem; 
    text-align: center; 
}
.bank-details p { 
    margin: 0.25rem 0; 
    font-size: 1rem; 
}
.action-buttons { 
    margin-top: 1.5rem; 
    display: flex; 
    justify-content: center; 
    gap: 1rem; 
    flex-wrap: wrap; 
}
.action-buttons .btn { 
    font-size: 1.1rem; 
    font-weight: 600; 
}

/* --- Page-Specific: payment_notification.html --- */
.notification-section { padding: 3rem 0; }
.notification-section h2 { text-align: center; margin-bottom: 2rem; font-size: 2.5rem; }
.notification-card { background: var(--white-color); border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); overflow: hidden; }
.notification-header { background-color: var(--light-gray-color); padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); font-size: 1.1rem; font-weight: 600; }
.notification-header i { color: var(--primary-color); margin-right: 10px; }
.notification-body { padding: 2rem; }
.file-input-wrapper { position: relative; overflow: hidden; display: inline-block; width: 100%; }
.file-input-button { border: 1px solid var(--border-color); background-color: var(--light-gray-color); color: var(--dark-color); padding: 0.8rem; border-radius: 5px; cursor: pointer; display: block; text-align: center; }
.file-input-wrapper:hover .file-input-button { background-color: #e9e9e9; }
.file-input-wrapper input[type=file] { font-size: 100px; position: absolute; left: 0; top: 0; opacity: 0; cursor: pointer; }
#file-name { margin-top: 0.5rem; font-style: italic; color: #555; font-size: 0.9rem; }
.submit-btn-wrapper { text-align: center; margin-top: 2rem; }
.submit-btn-wrapper .btn { width: 100%; max-width: 300px; font-size: 1.2rem; font-weight: 600; }

/* --- Page-Specific: processing.html --- */
.processing-section { display: flex; align-items: center; justify-content: center; padding: 4rem 0; min-height: calc(100vh - 100px); }
.processing-section-no-orders { display: block; align-items: center; justify-content: top; padding: 4rem 0; min-height: calc(100vh - 100px); }
.processing-box { background: var(--white-color); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); padding: 3rem; text-align: center; max-width: 700px; }
.processing-box .spinner { font-size: 3.5rem; color: var(--primary-color); margin-bottom: 2rem; display: inline-block; }
.processing-box h2 { font-size: 1.8rem; margin-bottom: 1.5rem; font-weight: 600; }
.processing-box .message-th { font-size: 1.1rem; margin-bottom: 1rem; line-height: 1.7; }
.processing-box .message-en { font-size: 0.95rem; color: #555; margin-bottom: 2rem; }
.processing-box .countdown { font-size: 1rem; color: var(--secondary-color); margin: 2rem 0; }
.processing-box .countdown b { font-size: 1.5rem; color: var(--dark-color); font-weight: 700; }
.processing-box .action-button { margin-top: 2rem; }

/* --- Page-Specific: edit_address.html --- */
.edit-address-section { padding: 3rem 0; }
.edit-address-section h2 { text-align: center; margin-bottom: 2rem; font-size: 2.5rem; }
.form-container { max-width: 800px; margin: auto; padding: 2rem; background: var(--white-color); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.submit-btn-container { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; }
.submit-btn-container .btn { font-size: 1.1rem; font-weight: 600; padding: 0.8rem 2rem; }

/* --- Page-Specific: payment_confirmation620.php --- */
.payment-channel-icon {
    display: block;
    max-width: 300px;
    margin: 1rem auto;
}
.payment-confirmation-actions {
    text-align: center;
    margin-top: 2rem;
}
.payment-confirmation-actions .btn-primary {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.9rem 1.5rem;
    width: 100%;
    max-width: 350px;
    box-shadow: 0 4px 15px rgba(255, 122, 0, 0.3);
}
.payment-confirmation-actions .btn-primary i {
    margin-right: 10px;
}
.payment-confirmation-actions .btn-secondary {
    margin-top: 1rem;
    width: 100%;
    max-width: 350px;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .navbar { padding: 1rem; }
    .container { 
        padding: 0 10px;
    }
    
    .hero { height: 20vh; }
    
    .products-section, .checkout-section { padding: 2.5rem 0; }
    .checkout-container { 
        padding: 1.25rem;
    }
    .products-section h2 { font-size: 2rem; margin-bottom: 1.5rem; }
    
    .hamburger { display: block; }
    .nav-menu { position: fixed; left: -100%; top: 65px; flex-direction: column; background-color: var(--white-color); width: 100%; text-align: center; transition: 0.3s; box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05); padding-bottom: 2rem; }
    .nav-menu.active { left: 0; }
    .nav-menu li { padding: 1.5rem 0; width: 100%; }
    
    .nav-menu .nav-actions { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem 0; margin: 1rem 2rem 0 2rem; border-top: 1px solid var(--border-color); }
    .nav-menu .nav-actions .btn, .nav-menu .nav-actions .language-switcher { width: 100%; margin: 0; }
    .nav-menu .nav-actions .lang-button { width: 100%; justify-content: center; }
    
    .nav-menu .nav-actions #profile-modal-btn {
        width: 100%;
        height: auto;
        padding: 0.5rem 1rem;
        border-radius: 5px;
        font-size: 1rem;
    }
    
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-content h1 { font-size: 2.5rem; }
    .options-buttons { flex-direction: column; }
    
    /* (แก้ไข) สั่งให้ .form-row ในฟอร์มที่อยู่เป็น block */
    #ems-form .form-row,
    #edit-address-form .form-row { 
        display: block;
        gap: 0; 
    }
    /* (ส่วน .form-row ใน payment_notification.html จะยังคงเป็น flex) */
    
    /* (แก้ไข) ลดขนาดรูป icon-size ใน .options-buttons */
    .options-buttons .icon-size { 
        width: 50%; 
        pointer-events: none; 
    }
	.options-buttons .icon-size-pp { 
        width: 30%; 
        pointer-events: none; 
    }

    .sticky-total-bar {
        display: block;
    }
    .total-price-display.hide-original {
        visibility: hidden;
        height: 0;
        margin-bottom: 0;
        overflow: hidden;
    }

    /* Responsive Page Specific */
    .order-list-section, .confirmation-section, .notification-section, .edit-address-section { padding: 2.5rem 0; }
    .order-list-section h2, .confirmation-section h2, .notification-section h2, .edit-address-section h2 { font-size: 2rem; margin-bottom: 1.5rem; }
    
    .order-body { 
        grid-template-columns: 1fr;
        gap: 1rem; 
    }
    .shipping-address, 
    .tracking-section, 
    .order-item-list, 
    .order-actions, 
    .order-summary-row,
    .confirmation-details
    { 
        grid-column: span 1;
    }

    .form-container { 
        padding: 1.25rem;
    }
    .processing-section { padding: 2rem 0; }
    .processing-box { padding: 2rem; }
    .processing-box .spinner { font-size: 3rem; margin-bottom: 1.5rem; }
    .processing-box h2 { font-size: 1.5rem; }
    .processing-box .message-th { font-size: 1rem; }
    
    
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    .checkout-container,
    .form-container { 
        padding: 0.75rem;
    }
    .order-body, .order-header { 
        padding: 0.75rem; 
    }
    .notification-body { 
        padding: 1rem; 
    }

    .products-section, .checkout-section { padding: 2rem 0; }
    .hero-content h1 { font-size: 2rem; }
    .total-price-display { font-size: 1.5rem; margin-bottom: 1.5rem; }
    .final-summary { padding: 1rem; }
    .terms-container { margin: 1.25rem 0; font-size: 0.85rem; }
    .submit-order-btn { padding: 0.9rem; font-size: 1.1rem; }
    #ems-form { padding: 1rem; }
    .product-grid { gap: 0.75rem; }
    .product-card { padding: 0.75rem; }
    .product-card h3 { font-size: 0.9rem; }
    .product-card .price { font-size: 1rem; }
 	
    /* (ลบ) .icon-size, .icon-size-pp ที่ซ้ำซ้อนออก */

    /* Responsive Page Specific */
    .order-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .btn-edit-address { top: 0.5rem; right: 0.75rem; }
    .order-actions .alternative-payment-buttons { display: block; flex-direction: row; gap: 0.8rem; width: 100%; justify-content: center; }
    .order-actions .alternative-payment-buttons .btn { flex: 1; margin-bottom: 0; padding-left: 0.5rem; padding-right: 0.5rem; margin-bottom:0.5rem; }
    .order-actions .divider { width: 1px; background-color: var(--border-color); align-self: stretch; margin: 0; }
 	
    /* (แก้ไข) .icon-size ใน vieworder */
    .order-actions .icon-size { width:80%; }
	.order-actions .icon-size-pp { width:50%; }

	.order-actions { gap: 1rem; }
    .payment-highlight-box .total-amount-display { font-size: 1.8rem; }
    .payment-highlight-box .deadline-display { font-size: 1.1rem; }
    .item-header-qty, .item-quantity { flex-basis: 50px; }
    .item-quantity { font-size: 1.5rem; }
    
    /* (แก้ไข) นี่คือจุดที่แก้ปัญหา payment_notification */
    .form-row.date-row, .form-row.time-row { 
        display: flex; /* (สำคัญ) ต้องสั่ง display: flex ที่นี่ */
        flex-direction: row; 
        gap: 0.5rem; 
        align-items: center; 
    }
    /* ================================== */

    .time-note { margin: 0.5rem 0 0 0; text-align: center; }
    .submit-btn-container { justify-content: center; }
    .submit-btn-container .btn { width: 100%; }
}

.pickup-user-name {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--white-color);
            background-color: var(--primary-color); /* (นี่คือตัวที่ทำให้เป็นป้ายสีส้มครับ) */
            padding: 0.1rem 0.5rem;
            border-radius: 4px;
            margin-left: 10px;
        }
        
/* --- Bank Info Layout (Flexbox) --- */
.bank-info-grid,
.bank-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* ระยะห่างระหว่างบรรทัด */
}

.bank-info-grid p,
.bank-info-list p {
    display: flex;
    flex-wrap: wrap; /* เผื่อจอมือถือแคบมาก */
    justify-content: space-between; /* ดัน label และ value ไปคนละฝั่ง */
    margin: 0; /* ล้าง margin เก่า */
    line-height: 1.5;
    
    /* เพิ่มเส้นคั่นบางๆ (ถ้าชอบ) */
    /* border-bottom: 1px solid var(--light-gray-color); 
       padding-bottom: 0.5rem; */
}
/*
.bank-info-list p:last-child,
.bank-info-grid p:last-child {
    border-bottom: none; 
}
*/

.bank-info-grid p strong,
.bank-info-list p strong {
    display: inline; /* แก้ปัญหา line break (ถ้ามี) */
    margin-right: 1rem; /* เว้นวรรคหลัง label */
    font-weight: 700;
    color: #555; /* ทำให้ label ชัดขึ้น */
}

.bank-info-grid p span,
.bank-info-list p span {
     font-weight: 600; /* ทำให้ Value (ค่า) เป็นตัวหนาเล็กน้อย */
     text-align: right;
     word-break: break-all; /* กันข้อความยาวล้น */
}

.btn-notify{
box-shadow: 0 4px 15px rgba(255, 122, 0, 0.4);
}

/* 1. ลดระยะห่างด้านล่าง (Goal 1) */
/* โดยการลดช่องว่างบนของ .shipping-address ที่อยู่ติดกัน */
#shipping-row-ems-vieworder + .shipping-address {
    margin-top: 0.25rem;  /* ลดจาก 1rem */
    padding-top: 0.5rem; /* ลดจาก 1rem */
    
    /* (ทางเลือก) ถ้าเส้นขอบบนมันดูซ้ำ ให้ลบออกด้วย */
    /* border-top: none; */
}

/* 2. ขยับยอดเงินมาทางซ้าย (Goal 2 & 3) */
/* โดยตั้งค่าให้ตรงกับคอลัมน์ Quantity (ที่มี flex-basis: 80px) */
#shipping-row-ems-vieworder .summary-price {
    flex-basis: 80px;   /* กำหนดความกว้างให้เท่าคอลัมน์ Quantity */
    text-align: center; /* จัดให้อยู่กลางพื้นที่ 80px */
    flex-shrink: 0;     /* ป้องกันการหดตัว */
}
