:root {
    --ink: #1a2638;
    --espresso: #0f3460;
    --cocoa: #1f5fa8;
    --gold: #3d9be9;
    --gold-light: #bfe1fb;
    --cream: #f2f8fd;
    --paper: #ffffff;
    --line: #dce8f5;
    --muted: #7e8ea3;
}

html, body.shop-body {
    height: 100%;
}
body.shop-body {
    background-color: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
/* ดันให้ footer อยู่ชิดล่างสุดของจอเสมอ แม้หน้าที่เนื้อหาสั้น (ไม่ดันขึ้นมากลางจอ) */
body.shop-body > .container.mb-5 {
    flex: 1 0 auto;
}
.shop-footer {
    flex-shrink: 0;
}

/* Bootstrap's .badge และ h1-h6 ตั้ง line-height ไว้แคบ (1 และ 1.2 ตามลำดับ) ซึ่งไม่พอสำหรับ
   สระบน/ล่างและวรรณยุกต์ของฟอนต์ไทย ทำให้ดูเหมือนตัวอักษรจม/ถูกตัดขอบ ปรับให้มีที่ว่างพอดี */
.badge {
    line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
    line-height: 1.5;
}
/* .text-truncate ของ Bootstrap ใช้ overflow:hidden เพื่อตัดคำยาวด้วย ... ซึ่งจะไปตัดขอบบนของ
   วรรณยุกต์/สระภาษาไทยที่สูงเกิน line-height ปกติไปด้วย ต้องให้ line-height กว้างกว่าที่อื่น */
.text-truncate {
    line-height: 1.8;
    padding-top: 0.15em;
}

/* ---------- Navbar ---------- */
.shop-navbar {
    background: var(--espresso) !important;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}
.shop-navbar .navbar-brand {
    color: var(--cream) !important;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}
.shop-navbar .navbar-brand i {
    color: var(--gold);
}
.shop-navbar .btn-cart {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    color: var(--cream);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    transition: all 0.15s ease;
}
.shop-navbar .btn-cart:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--espresso);
}
.shop-navbar .btn-track {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    color: var(--cream);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    transition: all 0.15s ease;
}
.shop-navbar .btn-track:hover {
    background: rgba(255,255,255,0.12);
    color: var(--gold-light);
}
.shop-navbar .btn-staff-login {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.shop-navbar .btn-staff-login:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.shop-navbar .btn-cart .badge {
    background: var(--gold);
    color: var(--espresso);
    font-weight: 700;
}
.shop-navbar .btn-cart:hover .badge {
    background: var(--espresso);
    color: var(--gold-light);
}

/* ---------- Navbar: mobile layout ---------- */
@media (max-width: 575.98px) {
    .shop-navbar {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }
    .shop-navbar .container {
        flex-wrap: nowrap;
    }
    .shop-navbar .navbar-brand {
        font-size: 0.95rem;
        letter-spacing: 0.5px;
        margin-right: 0.5rem;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .shop-navbar-actions {
        gap: 0.4rem;
    }
    .shop-navbar .btn-track,
    .shop-navbar .btn-cart {
        padding: 0.4rem 0.55rem;
        margin-right: 0 !important;
    }
    .shop-navbar .btn-track .btn-label,
    .shop-navbar .btn-cart .btn-label {
        display: none;
    }
    .shop-navbar .btn-staff-login {
        width: 30px;
        height: 30px;
    }
}

/* ---------- Hero ---------- */
.shop-hero {
    background: var(--espresso);
    color: var(--cream);
    border-radius: 0;
    padding: 3.5rem 1rem 3rem;
    margin: -1.5rem calc(50% - 50vw) 2.5rem;
    text-align: center;
    position: relative;
}
.shop-hero::after {
    content: "";
    display: block;
    width: 48px;
    height: 2px;
    background: var(--gold);
    margin: 1.1rem auto 0;
}
.shop-hero .eyebrow {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    color: var(--gold-light);
    font-weight: 600;
    margin-bottom: 0.6rem;
}
.shop-hero h1 {
    font-weight: 700;
    font-size: 1.85rem;
    margin-bottom: 0.5rem;
}
.shop-hero p {
    opacity: 0.8;
    font-size: 0.98rem;
    margin: 0;
}

/* ---------- Filters ---------- */
.shop-toolbar {
    margin-bottom: 1.75rem;
}
#shopSearch {
    border: 1px solid var(--line);
    background: var(--paper);
    height: 46px;
}
#shopSearch:focus {
    border-color: var(--gold);
    box-shadow: none;
}
.input-group-text {
    border: 1px solid var(--line);
}

.category-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.category-pills::-webkit-scrollbar { height: 4px; }
.category-pill {
    flex-shrink: 0;
    border-radius: 999px;
    padding: 0.4rem 1.15rem;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--cocoa);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.category-pill.active,
.category-pill:hover {
    background: var(--espresso);
    border-color: var(--espresso);
    color: var(--cream);
}

/* ---------- Product cards ---------- */
.product-tile {
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    background: var(--paper);
    cursor: pointer;
}
.product-tile:hover {
    border-color: var(--gold);
    box-shadow: 0 10px 24px rgba(61, 43, 31, 0.1);
}
.product-tile .product-tile-img {
    height: 190px;
    object-fit: cover;
    width: 100%;
    transition: transform 0.4s ease;
    display: block;
}
.product-tile:hover .product-tile-img {
    transform: scale(1.04);
}
.product-tile .product-tile-placeholder {
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    color: var(--gold);
}
.product-tile .card-body {
    padding: 1rem 1.1rem 1.1rem;
    border-top: 1px solid var(--line);
}
.product-tile .category-label {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: block;
}
.product-tile h6 {
    color: var(--ink);
}
.product-tile .price-tag {
    color: var(--cocoa);
    font-weight: 700;
    font-size: 1rem;
}
.btn-add {
    background: var(--cocoa);
    border: 1px solid var(--cocoa);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 2px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(31, 95, 168, 0.35);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn-add:hover,
.btn-add:focus {
    background: var(--espresso);
    border-color: var(--espresso);
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 52, 96, 0.4);
}
.btn-add:active {
    transform: scale(0.97);
}
.product-tile .btn-outline-view {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 2px;
}
.product-tile .btn-outline-view:hover {
    border-color: var(--cocoa);
    color: var(--cocoa);
}
.product-tile .quick-add-form .btn-add {
    font-size: 0.8rem;
}
.product-tile .category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--espresso);
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 0.3px;
    border-radius: 2px;
}

.empty-cart-illustration {
    font-size: 3.2rem;
    color: var(--gold);
}

.modal-content {
    border: none;
    border-radius: 6px;
}
.modal .carousel-item img {
    border-radius: 4px;
}
.modal-title {
    color: var(--ink);
}

/* ---------- Cart page ---------- */
.cart-item {
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: none;
    background: var(--paper);
    margin-bottom: 0.9rem;
}
.cart-item-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.cart-item-thumb-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    color: var(--gold);
    flex-shrink: 0;
}
.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
}
.qty-stepper button {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--cream);
    color: var(--cocoa);
    font-weight: 700;
    line-height: 1;
}
.qty-stepper button:hover {
    background: var(--gold);
    color: #fff;
}
.qty-stepper input {
    width: 42px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    font-weight: 600;
    color: var(--ink);
    height: 30px;
}
.qty-stepper input:focus {
    outline: none;
}
.cart-remove-btn {
    color: var(--muted);
    border: none;
    background: transparent;
    font-size: 0.82rem;
}
.cart-remove-btn:hover {
    color: #a33b2e;
}
.cart-summary-card {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--espresso);
    color: var(--cream);
    box-shadow: none;
}
.cart-summary-card h6 {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.78rem;
    color: var(--gold-light);
}
.cart-summary-card .btn-checkout {
    background: var(--gold);
    border: none;
    color: var(--espresso);
    font-weight: 700;
    border-radius: 3px;
    padding: 0.65rem 1rem;
    letter-spacing: 0.3px;
}
.cart-summary-card .btn-checkout:hover {
    background: var(--gold-light);
    color: var(--espresso);
}
.empty-cart-box {
    text-align: center;
    padding: 4rem 1rem;
}

.slip-pending-alert {
    background: var(--gold-light);
    border: 1px solid var(--gold);
    color: var(--espresso);
    font-weight: 600;
    border-radius: 6px;
}

/* ---------- Slip upload dropzone ---------- */
.slip-dropzone {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: 8px;
    background: var(--cream);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slip-dropzone:hover,
.slip-dropzone.dragover {
    border-color: var(--gold);
    background: #eef6fd;
}
.slip-dropzone.has-file {
    padding: 0.75rem;
}
.slip-dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}
.slip-dropzone-empty {
    color: var(--muted);
}
.slip-dropzone-empty i {
    color: var(--gold);
}
.slip-dropzone-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    text-align: left;
}
.slip-dropzone-preview img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.slip-preview-info {
    flex-grow: 1;
    min-width: 0;
}
.slip-preview-info span {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.slip-remove-btn {
    border: none;
    background: transparent;
    color: #a33b2e;
    font-size: 0.8rem;
    padding: 0;
    margin-top: 2px;
}
.slip-remove-btn:hover {
    text-decoration: underline;
}

/* ---------- Order tracking page ---------- */
.order-no-text {
    color: var(--cocoa);
}
.track-steps {
    position: relative;
}
.track-step {
    position: relative;
    font-size: 0.78rem;
    color: var(--muted);
}
.track-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid var(--line);
}
.track-step.done .track-step-circle {
    background: var(--cocoa);
    border-color: var(--cocoa);
    color: #fff;
}
.track-step.current .track-step-circle {
    background: var(--espresso);
    border-color: var(--espresso);
    color: #fff;
    box-shadow: 0 0 0 4px var(--gold-light);
}
.track-step.done small,
.track-step.current small {
    color: var(--ink);
    font-weight: 600;
}

/* ---------- PromptPay QR card ---------- */
.qr-frame {
    width: fit-content;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}
#qrcode canvas,
#qrcode img {
    border-radius: 4px;
}
.qr-meta {
    border-top: 1px solid var(--line);
    padding-top: 0.75rem;
    text-align: left;
}

/* ---------- Payment countdown ---------- */
.payment-countdown {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
}
.payment-countdown-ok {
    background: var(--gold-light);
    color: var(--espresso);
}
.payment-countdown-warn {
    background: #fde3cf;
    color: #a3550a;
}
.payment-countdown-overdue {
    background: #f8d7da;
    color: #a33b2e;
}

/* ---------- Order confirmation page ---------- */
.order-hero-card {
    border: none;
    border-radius: 6px;
    background: var(--espresso);
    color: #fff;
}
.order-status-badge {
    background: var(--gold);
    color: #fff;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
}
/* สีตามสถานะ สำหรับหน้าที่แสดงหลายออเดอร์พร้อมกัน (เช่น ผลค้นหาด้วยเบอร์โทร)
   จะได้แยกออกง่ายๆ ว่าอันไหนรอ อันไหนเสร็จแล้ว ไม่ใช้สีทองเดียวกันหมดจนงง */
.order-status-badge.status-badge-pending { background: var(--muted); }
.order-status-badge.status-badge-progress { background: var(--cocoa); }
.order-status-badge.status-badge-ready { background: var(--gold); }
.order-status-badge.status-badge-completed { background: #1f9d5a; }
.order-status-badge.status-badge-cancelled { background: #c0392b; }
.order-line {
    font-size: 0.92rem;
    color: var(--ink);
}
.btn-print-order {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: var(--cream);
    font-weight: 500;
    border-radius: 999px;
    padding: 0.3rem 1rem;
}
.btn-print-order:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}

/* ---------- Checkout page ---------- */
.checkout-card {
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: none;
}
.checkout-card label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink);
}
.checkout-card .form-control {
    border: 1px solid var(--line);
}
.checkout-card .form-control:focus {
    border-color: var(--gold);
    box-shadow: none;
}
.btn-checkout-confirm {
    background: var(--espresso);
    border: none;
    color: #fff;
    font-weight: 700;
    border-radius: 3px;
    padding: 0.7rem 1rem;
    letter-spacing: 0.3px;
}
.btn-checkout-confirm:hover {
    background: var(--cocoa);
    color: #fff;
}
.checkout-summary-line {
    font-size: 0.92rem;
    opacity: 0.92;
}
.checkout-summary-divider {
    border-color: rgba(255, 255, 255, 0.25);
}

/* Keep toast alerts below the sticky navbar instead of covering it */
.swal2-container.swal2-top-end {
    margin-top: 72px;
}

/* ---------- Generic section heading on shop pages ---------- */
.shop-section-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.shop-section-title::before {
    content: "";
    width: 4px;
    height: 18px;
    background: var(--gold);
    display: inline-block;
    border-radius: 2px;
}

/* ---------- Storefront promotion ---------- */
.shop-ad-dialog {
    max-width: min(46rem, calc(100% - 1.5rem));
    margin-inline: auto;
}

.shop-ad-modal {
    --ad-gutter: 1.375rem;

    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
}

.shop-ad-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.125rem var(--ad-gutter) .875rem;
}

.shop-ad-mark {
    display: grid;
    flex: 0 0 2.75rem;
    height: 2.75rem;
    place-items: center;
    background: var(--gold-light);
    color: var(--espresso);
    border-radius: 6px;
    font-size: 1.1rem;
}

.shop-ad-title {
    margin: 0;
    color: var(--espresso);
    font-size: clamp(1.125rem, 3vw, 1.45rem);
    font-weight: 700;
}

.shop-ad-icon-btn {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--espresso);
    font-size: .8rem;
    line-height: 1;
}

.shop-ad-icon-btn:hover {
    background: var(--cream);
    color: var(--cocoa);
}

.shop-ad-close {
    margin-left: auto;
    font-size: 1rem;
}

.shop-ad-carousel {
    margin-inline: var(--ad-gutter);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--cream);
}

.shop-ad-carousel .shop-ad-image {
    display: block;
    width: 100%;
    height: min(55vh, 28rem);
    object-fit: contain;
    border-radius: 0;
}

.shop-ad-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .875rem 1rem;
    padding: .875rem var(--ad-gutter) 1.25rem;
}

.shop-ad-details {
    display: grid;
    min-width: 0;
    gap: .5rem;
}

.shop-ad-caption {
    margin: 0;
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.shop-ad-controls {
    display: flex;
    align-items: center;
    gap: .375rem;
}

.shop-ad-position {
    min-width: 2.5rem;
    text-align: center;
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.shop-ad-playback {
    margin-left: .25rem;
}

.shop-ad-continue {
    flex-shrink: 0;
    margin-left: auto;
}

.shop-ad-continue i { margin-right: .3rem; }

.shop-ad-icon-btn:focus-visible,
.shop-ad-continue:focus-visible {
    outline: 2px solid var(--cocoa);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .shop-ad-modal { --ad-gutter: .875rem; }
    .shop-ad-carousel .shop-ad-image { height: min(45vh, 75vw); }
    .shop-ad-footer { flex-wrap: wrap; }
    .shop-ad-details, .shop-ad-continue { width: 100%; }
}

/* ---------- Footer ---------- */
.shop-footer {
    margin-top: 3rem;
    padding: 2rem 0 1.5rem;
    background: var(--espresso);
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
}
.shop-footer-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 0.5rem;
}
.shop-footer-address {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}
.shop-footer-copy {
    margin-top: 1rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.5);
}
