/* Songkhla FC Official Shop */
.shop-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.shop-nav-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.shop-nav-cats a {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border: 1px solid var(--paper-3, #EAE5DC);
    background: #fff;
    color: var(--ink, #0A0A0C);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 2px;
    transition: border-color .15s, color .15s;
}

.shop-nav-cats a:hover,
.shop-nav-cats a.active {
    border-color: var(--red, #D7000F);
    color: var(--red, #D7000F);
}

.shop-cart-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink, #0A0A0C);
}

.shop-cart-link .badge {
    background: var(--red, #D7000F);
    color: #fff;
    min-width: 22px;
    height: 22px;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0 6px;
}

.shop-search {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 420px;
}

.shop-search input {
    flex: 1;
    border: 1px solid #ddd;
    padding: 10px 12px;
    font: inherit;
    border-radius: 2px;
    background: #fff;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .shop-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
    .shop-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.shop-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--paper-3, #EAE5DC);
    text-decoration: none;
    color: inherit;
    border-radius: 2px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.shop-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(10, 10, 12, 0.08);
}

.shop-card-thumb {
    aspect-ratio: 1;
    background: #f5f2ed;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.shop-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.shop-card-cat {
    font-size: 0.75rem;
    color: #7a7a85;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.shop-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

.shop-card-price {
    margin-top: auto;
    font-weight: 800;
    color: var(--red, #D7000F);
    font-size: 1.05rem;
}

.shop-card-price s {
    color: #9A9AA5;
    font-weight: 500;
    margin-right: 6px;
    font-size: 0.9rem;
}

.shop-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 800px) {
    .shop-product { grid-template-columns: 1fr; gap: 24px; }
}

.shop-product-media {
    background: #f5f2ed;
    border: 1px solid #EAE5DC;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.shop-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-product-info h1 {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.shop-price-lg {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--red, #D7000F);
    margin: 12px 0 20px;
}

.shop-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 20px;
}

.shop-variants label {
    cursor: pointer;
}

.shop-variants input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.shop-variants span {
    display: inline-flex;
    min-width: 44px;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #ccc;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 2px;
}

.shop-variants input:checked + span {
    border-color: var(--red, #D7000F);
    background: var(--red, #D7000F);
    color: #fff;
}

.shop-variants input:disabled + span {
    opacity: .35;
    text-decoration: line-through;
}

.shop-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.shop-qty input {
    width: 80px;
    padding: 10px;
    border: 1px solid #ccc;
    font: inherit;
    border-radius: 2px;
}

.shop-desc {
    margin-top: 24px;
    color: #444;
    line-height: 1.7;
    white-space: pre-line;
}

.shop-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.shop-table th,
.shop-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #EAE5DC;
    text-align: left;
    vertical-align: middle;
}

.shop-table th {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
}

.shop-line {
    display: flex;
    gap: 12px;
    align-items: center;
}

.shop-line img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    background: #f5f2ed;
    border-radius: 2px;
}

.shop-summary {
    background: #fff;
    border: 1px solid #EAE5DC;
    padding: 20px;
    border-radius: 2px;
}

.shop-summary dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 16px;
    margin: 0 0 16px;
}

.shop-summary dt { color: #666; }
.shop-summary dd { margin: 0; font-weight: 700; text-align: right; }
.shop-summary .total dd { color: var(--red, #D7000F); font-size: 1.2rem; }

.shop-layout-2 {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 900px) {
    .shop-layout-2 { grid-template-columns: 1fr; }
}

.shop-form .field {
    margin-bottom: 14px;
}

.shop-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.shop-form .input,
.shop-form textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ccc;
    font: inherit;
    border-radius: 2px;
    background: #fff;
}

.shop-form .form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .shop-form .form-grid-2 { grid-template-columns: 1fr; }
}

/* Select2 — Thai address */
.shop-form .select2-container {
    width: 100% !important;
}

.shop-form .select2-container--default .select2-selection--single {
    height: 44px;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #fff;
    padding: 0;
}

.shop-form .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding-left: 12px;
    padding-right: 36px;
    color: #0A0A0C;
    font-family: inherit;
    font-size: 1rem;
}

.shop-form .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
    right: 8px;
}

.shop-form .select2-container--default.select2-container--focus .select2-selection--single,
.shop-form .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--red, #D7000F);
}

.shop-form .select2-dropdown {
    border: 1px solid #ccc;
    border-radius: 2px;
    font-family: "Noto Sans Thai", sans-serif;
}

.shop-form .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--red, #D7000F);
}

.shop-form .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9A9AA5;
}

.shop-form .select2-container--default.select2-container--disabled .select2-selection--single {
    background: #f5f2ed;
    cursor: not-allowed;
}

.shop-alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 2px;
    font-weight: 600;
}

.shop-alert-success { background: #e8f6ec; color: #0d6a2f; }
.shop-alert-error { background: #fde8ea; color: #a10010; }

.shop-pay-box {
    background: #0A0A0C;
    color: #fff;
    padding: 24px;
    border-radius: 2px;
    margin-bottom: 24px;
}

.shop-pay-box h2 {
    margin: 0 0 12px;
    font-size: 1.2rem;
}

.shop-pay-box p { margin: 6px 0; color: #ddd; }
.shop-pay-box strong { color: #fff; font-size: 1.15rem; }

.shop-status {
    display: inline-flex;
    padding: 6px 10px;
    background: #f5f2ed;
    border: 1px solid #EAE5DC;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 2px;
}

.shop-empty {
    text-align: center;
    padding: 48px 16px;
    background: #fff;
    border: 1px dashed #ccc;
}

.shop-empty p { margin: 0 0 16px; color: #666; }

.req { color: var(--red, #D7000F); }
.err { color: var(--red, #D7000F); font-size: 0.85rem; display: block; margin-top: 4px; }
.hint { color: #888; font-size: 0.85rem; }

/* ---------- รายการคำสั่งซื้อ (แจ้งชำระเงิน / ตรวจสอบการสั่งซื้อ) ---------- */
.shop-order-list {
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.shop-order-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #EAE5DC;
    border-left: 3px solid var(--red, #D7000F);
    border-radius: 2px;
}

/* ต้องมี min-width:0 ไม่งั้นชื่อสินค้ายาว ๆ จะดันการ์ดจนล้นจอมือถือ */
.shop-order-main { min-width: 0; flex: 1; }

.shop-order-no {
    font-weight: 700;
    letter-spacing: .04em;
    margin-right: 10px;
}

.shop-order-items {
    margin: 8px 0 4px;
    color: #555;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.shop-order-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.shop-order-total {
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .shop-order-row { flex-direction: column; }
    .shop-order-side { align-items: stretch; width: 100%; }
    .shop-order-side .btn { text-align: center; }
}

/* .btn-cancel ถูกใช้ในหน้า checkout อยู่แล้วแต่นิยามอยู่ใน admin.css เท่านั้น
   ซึ่งหน้าบ้านไม่ได้โหลด ปุ่มจึงออกมาไม่มีสไตล์ — ประกาศไว้ที่นี่ให้ครบ */
.shop-form .btn-cancel,
.shop-order-list .btn-cancel {
    background: transparent;
    border: 1px solid #CFC8BC;
    color: #444;
}

.shop-form .btn-cancel:hover,
.shop-order-list .btn-cancel:hover {
    border-color: var(--ink-900, #0A0A0C);
    color: var(--ink-900, #0A0A0C);
}

/* ให้เห็นชัดตอนกรอกผิดรูปแบบ — :user-invalid ทำงานหลังผู้ใช้พิมพ์แล้วเท่านั้น
   ต่างจาก :invalid ที่แดงตั้งแต่ยังไม่ได้แตะช่อง ซึ่งน่ารำคาญ */
.shop-form .input:user-invalid {
    border-color: var(--red, #D7000F);
    background: #fff8f8;
}

/* ตารางในตะกร้า/ออเดอร์กว้างเกินจอมือถือ ให้เลื่อนอยู่ในกล่องตัวเอง
   ไม่ใช่ดันทั้งหน้าจนเลื่อนแนวนอนได้ (วัดจริงที่ 375px: หน้าตะกร้าล้น 174px)

   ต้องมีสองอย่างคู่กัน:
   1) .shop-table-wrap ทำหน้าที่เป็นกล่องเลื่อน
   2) ลูกของ grid มี min-width:auto เป็นค่าเริ่มต้น ถ้าไม่ตั้งเป็น 0
      กล่องจะไม่ยอมหดต่ำกว่าความกว้างของตาราง overflow-x จึงไม่มีผลเลย */
.shop-layout-2 > * { min-width: 0; }

.shop-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.shop-table-wrap .shop-table { min-width: 420px; }
