/* ซ่อน/แสดงเวอร์ชัน */
.hero-mobile{ display:none; }
.hero-desktop{ display:block; }

@media (max-width: 767.98px){
  .hero-desktop{ display:none; }
  .hero-mobile{ display:block; }

  .hero-mobile.page-hero{
    height:auto; min-height:unset; margin-top:12px;
  }

  .hero-slider{
  display: flex;
  overflow-x: hidden;
}
  .hero-slide{
    flex:0 0 100%;
    scroll-snap-align:start;
  }
  .hero-slide img{
    width:100%; height:auto; object-fit:contain;
    padding:0 8px; box-sizing:border-box;  
  }


  .hero-dots{
    display:flex; justify-content:center; gap:6px;
    margin-top:8px;
  }
  .hero-dots button{
    width:8px; height:8px; border:0; border-radius:50%;
    background:#d1d5db; cursor:pointer;
  }
  .hero-dots button.is-active{ background:#0970fa; }
}
@media (max-width: 767.98px){
  .hero-slider{
    overflow-x: auto !important;   
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
}


/* ===== HERO BASE ===== */
.page-hero{
  position: relative;
}



.hero-slide.is-hero-sale{
  position: relative;
  min-width: 100%;
}

.hero-slide:not(.is-hero-sale){
  height: auto;
}

.hero-slide img{
  width:100%;
  height:auto;
  object-fit: cover;
  display:block;
}


.hero-overlay{
  position:absolute;
  inset:0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.8),
    rgba(0,0,0,.4),
    rgba(0,0,0,.1)
  );
}


.hero-content{
  position:absolute;
  inset:0;
  z-index:2;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding:20px;
  color:#fff;
  font-family:'Kanit';
}

.hero-price{
  font-size:13px;
  opacity:.9;
  margin-bottom:6px;
}

.hero-title{
  font-size:28px;
  font-weight:500;
  line-height: 1.35;
  margin:0 0 10px;
  transform: skewX(-6deg);
}

.hero-sub{
  font-size:14px;
  opacity:.9;
  margin-bottom:16px;
}

/* ===== CTA ===== */
.hero-btn{
  width:160px;
  padding:12px 0;
  text-align:center;
  border-radius:999px;
  background:#fc7801; 
  color:#fff;
  font-weight:600;
  text-decoration:none;
  box-shadow:0 6px 16px rgba(0,0,0,.3);
}

.hero-note{
  font-size:11px;
  opacity:.7;
  margin-top:10px;
}


.hero-slide:not(.is-hero-sale) .hero-content,
.hero-slide:not(.is-hero-sale) .hero-overlay{
  display:none;
}


/* ===== ABOUT SECTION (Wix-like) ===== */
.about-section{
  background:#fff;
  padding: clamp(40px, 7vw, 96px) 0;
}


.about-grid{
  display:grid;
  grid-template-columns: 1.08fr 0.92fr;
  grid-template-areas:
    "img1 copy"
    "img1 img2";
  gap: clamp(20px, 4vw, 48px) clamp(24px, 5vw, 64px);
  align-items:start;
  margin-inline:auto;

}


.about-img--left  { grid-area: img1; }
.about-copy       { grid-area: copy; }
.about-img--right { grid-area: img2; }


.about-img{
  border-radius: 18px;
  overflow: hidden;
}
.about-img img{
  width:100%; height:100%;
  display:block;
  object-fit: cover;
  object-position: center;
}


.about-img--left{
  display:flex;
  justify-content:center;   
}

.about-img--right img{
  width: 448px;
  height: 305px;
  object-fit: cover;
  margin-top: 55px;
}


.eyebrow{
  color: var(--brand-orange);
  font-weight: 500;
  letter-spacing: .10em;
  text-transform: uppercase;
  font-size: 14px;
  margin-bottom: .5rem;
}


.about-title{
  display: inline-block;      
  transform-origin: left center;
}


.about-desc{ 
  color:#605E5E;
  font-size: 14px;  
  line-height: 1.7;
  margin-bottom: 1rem;
}


@media (max-width: 767.98px){
  .about-grid{
    grid-template-columns: 1fr;
    grid-template-areas:
      "img1"
      "copy"
      "img2";
  }
  .about-img--left img{
    width: 100%;
    height: 360px;
    margin-top: 16px;
    margin-left: 0;
  }
  .about-img--right img{
    width: 100%;
    height: 240px;
    margin-top: 12px;
  }
}


.about-section .about-btn {
  background: var(--brand-blue) !important;
  color: #fff !important;
  border-color: var(--brand-blue) !important;
  border-style: solid !important;
  border-width: 2px !important;
  padding: .6rem 1.3rem;        
  border-radius: .6rem;
  font-weight: 700;
  display: inline-block;
  text-decoration: none;
  transition: all .25s ease;
}


.about-section .about-btn:hover {
  background: var(--brand-blue) !important;
  color: #3b2419 !important;
}
/* ========== ABOUT (เฉพาะมือถือ) ========== */
@media (max-width: 640px){


  .about-section{
    padding-top: clamp(64px, 12vw, 96px);
  }
  .about-section .container{
    padding-left: 16px;
    padding-right: 16px;
  }


  .about-grid{
    display: flex;
    flex-direction: column;
    gap: 14px;
  }


  .about-section .eyebrow{
    font-size: 12px;
    margin-bottom: 6px;
  }


  .about-section .about-title{
    font-size: 26px;
    line-height: 1.35;
    text-wrap: balance;
    margin-bottom: 12px;
  }


  .about-section .about-copy .desc{
    font-size: 16px;
    line-height: 1.7;
    text-align: justify;
    text-justify: inter-character;
    white-space: normal;
    word-spacing: 0;
    letter-spacing: normal;
    text-align-last: left;
    text-indent: 1.5em;
    margin: 0 0 12px;
  }
  .about-section .about-copy .desc:last-child{ margin-bottom: 0; }


  .about-section .about-btn{
    margin-top: 12px;
    order: 2;    
  }


  .about-section .about-img{
    border-radius: 14px;
    overflow: hidden;
    max-height: 360px;
    margin-top: 6px;
    order: 3;    
  }
  .about-section .about-img img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
  }


  .about-section .about-img--right{
    display: none;
  }
}

.page-hero{
  margin-bottom: clamp(12px, 3vw, 24px);
}


#whybb{
  height: auto;
  padding: 32px 0;              
  background: #fff;
  overflow: hidden;

  --why-card-h: 130px;
  --why-gap: 12px;
}

#whybb .whybb__container{
  display: flex;
  align-items: stretch;          
  justify-content: space-between;
  gap: 32px;                   
  flex-wrap: nowrap;
}


#whybb .whybb__left{
  flex: 0 1 54%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}


#whybb .whybb__title{
  margin: 0;
  font-weight: 400;              
  font-size: 30px;               
  line-height: 1.25;
  color: #3b2419;
  transform: skewX(-6deg);       
}
#whybb .whybb__brand{ color: var(--brand-yellow); }  
#whybb .whybb__sub{ margin-top: 6px; color: #6b7280; }


#whybb .whybb__grid{
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: var(--why-gap);
}

#whybb .whybb__card{
  min-height: var(--why-card-h);
  border-radius: 28px;            
  padding: 16px;                  
  box-shadow: 0 10px 24px rgba(0,0,0,.08);  
  background: #fff;               
  border: 1px solid var(--border, #e5e7eb);
  display: block;                 
}
#whybb .whybb__card--wide{ grid-column: span 2; }

#whybb .whybb__icon{
  width: 38px; height: 38px;      
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2f7;            
  color: var(--brand-blue);
}
#whybb .whybb__icon svg{ width: 18px; height: 18px; }

#whybb .whybb--blue   .whybb__icon{ background:#eef5ff; color:var(--brand-blue); }
#whybb .whybb--orange .whybb__icon{ background:#fff1e6; color:var(--brand-orange); }
#whybb .whybb--yellow .whybb__icon{ background:#fff7d6; color:var(--brand-yellow); }
#whybb .whybb--pale   .whybb__icon{ background:#f3f4f6; color:#334155; }
#whybb .whybb--navy   .whybb__icon{ background:#0f172a; color:#fff; }

#whybb .whybb__cardTitle{
  margin: 6px 0 4px;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.3;
}
#whybb .whybb__cardDesc{
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
  white-space: normal;        
  word-break: normal;         
  overflow-wrap: break-word;  
}

#whybb .whybb__right{
  flex: 0 1 46%;
  min-height: calc(var(--why-card-h) * 3 + var(--why-gap) * 2);
  display: flex; align-items: center; justify-content: center;
  border-radius: 24px;
  overflow: hidden;
  background: transparent;
}
#whybb .whybb__imgBg{ display: none; }
#whybb .whybb__img{
  position: static;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

#whybb img{ max-width:100%; float:none; }

@media (max-width: 480px){

  #whybb{ padding:16px 0; }

  #whybb .whybb__container{
    flex-direction: column;
    gap:16px;
    align-items: stretch;
  }

  #whybb .whybb__title{
    font-size: clamp(1.6rem, 6.2vw, 2.2rem);
    line-height: 1.38;
    word-break: keep-all;
    white-space: normal;
  }
  #whybb .whybb__title span{ display:inline-block; }
  #whybb .whybb__sub{ font-size:13px; margin:0 0 10px; }

  #whybb{ --why-card-h:88px; --why-gap:8px; }
  #whybb .whybb__grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:var(--why-gap);
    margin-top:8px;
  }
  #whybb .whybb__card{
    min-height:var(--why-card-h);
    padding:10px 14px;
    border-radius:16px;
  }
  #whybb .whybb__icon{ width:26px; height:26px; border-radius:8px; margin-bottom:2px; }
  #whybb .whybb__icon svg{ width:12px; height:12px; }

  #whybb .whybb__cardTitle{
    font-size:13px; font-weight:600; margin:0 0 2px;
    line-height:1.25; word-break:keep-all; line-break:loose; hyphens:none;
  }
  #whybb .whybb__cardDesc{
    font-size:12px; font-weight:400; line-height:1.55; margin:0;
    white-space:normal;
    word-break: break-word;     
    overflow-wrap:anywhere;
    text-wrap:pretty;
  }

  #whybb .whybb__right{
    order:2; width:100%; max-width:86%; margin:0 auto;
    min-height:auto; aspect-ratio:auto;
  }
  #whybb .whybb__img{ position:static; width:100%; height:auto; }
}


/* ================== PRODUCTS ================== */
.products-section{
  background:#ffffff;             
}

.products-section .container{
  margin-left: auto;
  margin-right: auto;
}


.products-title{
  text-align:center;
   font-weight: 400;
  color: #342216;
  line-height: 1.45;
  font-size: 30px;
  margin-bottom: .75rem;
  transform: skewX(-6deg);
}
.products-title span{ color:#0970fa; } 
.products-sub{
  text-align:center;
  color: #605E5E;     
  margin:0 0 1.75rem;
  font-size:16px;
  line-height:1.7;
}



.products-grid{
  display:grid;
  gap: 1.5rem;
  width: 100%;
}
@media (min-width: 768px){
  .products-grid{ grid-template-columns: repeat(3, 1fr); }
}


.product-card{
  position: relative;
  background:#fff;
  border-radius: 18px;           
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 10px 28px rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.06);
}


.product-badge{
  position:absolute;
  top: .9rem; right: 1rem;
  background:#f7dd1e;
  color:#1f2937;
  font-size: 13px;
  padding: .35rem .75rem;
  border-radius: 999px;
  line-height:1;
}


.product-head{ margin: .25rem 0 .5rem; }
.product-title{
  margin:0;
  font-weight: 400;
  font-size: 30px;
  color:#342216;
}

.product-sub{
  font-size: 13px;
  color:#64748b;
  margin-top: .15rem;
}

.product-points{
  margin: .5rem 0 1rem;
  padding-left: 1.1rem;
}
.product-points li{
  list-style: disc;
  line-height: 1.7;
  margin: .25rem 0;
  color: #342216;
  font-size: 14px;
}


.product-sep{
  height:1px;
  background: rgba(0,0,0,.08);
  margin: .25rem 0 .9rem;
}


.product-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
}
.product-price{
  color:#0f172a;
  font-size: 14px;
  font-weight: 400;
}
.btn-orange{
  display:inline-block;
  background:#fc7801;
  color:#fff;
  padding:.6rem 1.1rem;
  border-radius: 14px;
  font-weight:700;
  text-decoration:none;
  box-shadow: 0 6px 14px rgba(252,120,1,.35);
  transition: transform .08s ease, opacity .2s ease;
  white-space: nowrap;
}
.btn-orange:hover{ opacity:.95; }
.btn-orange:active{ transform: translateY(1px); }
.btn-orange.pill{ border-radius: 999px; }

@media (max-width:420px){
  .product-foot{ flex-direction:column; align-items:stretch; }
  .btn-orange{ text-align:center; }
}

/* ====== PRODUCTS: CTA (ชั่งตัก) ====== */
.products-cta{
  background:#0970fa;
  color:#fff;
  border-radius:1rem;
  padding:1.5rem;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:1rem;
  margin-top:2rem;
  margin-bottom:2rem;
}
@media (min-width:768px){
  .products-cta{
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
  }
}
.products-cta__text{ flex:1; text-align:center; }
@media (min-width:768px){
  .products-cta__text{ text-align:left; }
}
.products-cta__title{
  margin:0;
  font-size:20px;        
  font-weight:700;
}
.products-cta__desc{
  margin:.5rem 0 0;
  font-size:14px;
  color:rgba(255,255,255,.9);
}
.products-cta__action{ text-align:center; }
.products-cta__price{
  font-size:18px;        
  font-weight:700;
  color:#f7dd1e;
}
.products-cta__unit{
  font-size:12px;
  margin-top:.25rem;
  opacity:.95;
}

.products-footer{ text-align:center; }
.btn-lg{ font-size:16px; padding:.8rem 1.5rem; }


/* ========== PRODUCTS (มือถือ) ========== */
@media (max-width: 480px){

  .products-title{
    font-size: clamp(1.6rem, 6.2vw, 2.2rem);
    line-height: 1.38;
    font-weight: 400;
    transform: skewX(-6deg);
    margin-bottom: 10px;
  }

  .products-sub{
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 12px;
  }

  .product-title{
    font-size: 22px;     
    line-height: 1.3;
  }

  .product-sub{
    font-size: 12px;     
  }

  .product-points li{
    font-size: 13px;     
    line-height: 1.6;
  }

  .product-price{
    font-size: 13px;     
  }

  .btn-lg,
  .btn-orange{
    font-size: 14px;
    padding: .7rem 1.2rem;
  }
}

/* ===== NAVBAR (INDEX ONLY) — Mobile layout, single clean block ===== */
@media (max-width: 767.98px){

  .site-header{
    padding-top: var(--nav-height) !important;
  }

  .site-header .nav-bar{
    position: fixed !important;
    top: 0; left: 0; right: 0;
    height: var(--nav-height) !important;
    z-index: 1000;
  }

  .site-header .nav-bar .container.nav{
    position: relative !important;
    height: 100% !important;
  }

  .site-header .nav-menu{
    display: none !important;
  }

  .site-header .nav-toggle{
    position: absolute !important;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    display: inline-flex !important;
    margin: 0 !important;
  }

  .site-header .nav-left{ position: static !important; }
  .site-header .nav-left .logo{
    position: absolute !important;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    margin: 0 !important;
  }
  .site-header .logo img{
    height: 56px !important; 
  }

  .site-header .nav-right{
    position: absolute !important;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    display: inline-flex !important;
    align-items: center !important;
    gap: 16px !important;
  }
  .site-header .nav-right .nav-right{
    display: contents !important;
  }

  .site-header .nav-login{
    font-size: 0 !important;
    padding: 6px !important;
    line-height: 1 !important;
  }
  .site-header .nav-login svg{
    width: 24px !important;
    height: 24px !important;
  }

  .site-header .icon-cart{
    width: 24px !important;
    height: 24px !important;
  }
  .site-header .nav-cart{
    position: relative !important;
    color: var(--brand-orange) !important;
  }
  .site-header #cart-count{
    position: absolute !important;
    top: -6px; right: -10px;
    background: var(--brand-orange);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
  }
}


/* ================= IMAGE POPUP ================= */
.bb-img-popup{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9999;

  display: none;
  align-items: center;
  justify-content: center;
}

.bb-img-box{
  position: relative;
  width: min(92vw, 420px);
}

.bb-img{
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

/* ปุ่มปิด */
.bb-img-close{
  position: absolute;
  top: -12px;
  right: -12px;

  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;

  background: #ffffff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;

  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

@media (max-width: 768px){
  .bb-img-popup{
    display: flex;
  }
}

/* --- REAL-TIME AUTH STYLES --- */
.user-menu-wrap {
  position: relative;
  display: inline-block;
  margin-right: 8px;
}
.user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  padding: 4px 14px 4px 5px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Kanit', sans-serif;
}
.user-trigger:hover { border-color: #0970fa; background: #f8fafc; }
.user-avatar {
  width: 32px;
  height: 32px;
  background: #0970fa;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 500; color: #334155; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
  padding: 8px;
  display: none;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}
.user-dropdown.is-active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  border-radius: 8px;
  transition: 0.2s;
}
.dropdown-item:hover { background: #f1f5f9; color: #0970fa; }
.dropdown-divider { height: 1px; background: #f1f5f9; margin: 6px 0; }
.logout-item { color: #ef4444 !important; }
.logout-item:hover { background: #fef2f2 !important; }
#login-link.is-hidden { display: none !important; }

@media (max-width: 640px) {
  .user-name { display: none; }
}

/* ถ้า stats-container อยู่ภายใต้ <main> หรือ <div> อื่น */
.stats-container {
  display: flex;
  flex-wrap: wrap;       /* รองรับหน้าจอมือถือ */
  gap: 30px;
  width: 90%;            /* ขยายให้กว้างขึ้นนิดหน่อยสำหรับจอเล็ก */
  max-width: 1200px;     /* ล็อคความกว้างสูงสุดเพื่อความสวยงาม */
  margin: 50px auto;     /* จัดกึ่งกลางหน้าจอ */
  justify-content: center; /* กรณีกล่องมีไม่ครบ 3 กล่อง จะได้อยู่ตรงกลาง */
}

.stats-card {
  min-width: 250px;      /* ขนาดขั้นต่ำของแต่ละกล่อง */
  flex: 1;
  background: #fffcf5;
  border: 1px solid #fde6d2;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;   /* จัด GIF และตัวเลขให้อยู่กลางกล่อง */
}

.stats-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.stats-label {
  display: block;
  font-size: 16px;
  color: #64748b;
}

@media (max-width: 768px) {
  .stats-container {
    flex-direction: column;
  }
}

/* เอฟเฟกต์ Loading สำหรับตัวเลข */
.loading-pulse {
  display: inline-block;
  width: 60px;
  height: 32px;
  background-color: #e2e8f0;
  border-radius: 4px;
  animation: pulse 1.5s infinite ease-in-out;
  vertical-align: middle;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* --- Desktop Styles (Default) --- */
.stats-container {
  display: flex;
  flex-direction: row;
  gap: 20px;
  width: 100%;
  margin-bottom: 30px;
}

.stats-card {
  flex: 1;
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  text-align: center;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.stats-number {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-loading-icon {
  width: 24px;
  height: 24px;
}

/* --- Mobile Styles (แนวนอน แต่เล็กลง) --- */
@media (max-width: 600px) {
  .stats-container {
    gap: 8px;
    padding: 0;
    margin-bottom: 20px;
  }

  .stats-card {
    padding: 12px 8px;
    border-radius: 12px;
    gap: 4px;
    min-width: 0; /* ป้องกันการล้นหน้าจอ */
  }

  .stats-label {
    font-size: 10px;
    line-height: 1.2;
    word-break: break-word; /* ตัดคำยาวๆ ถ้าจำเป็น */
  }

  .stats-number {
    font-size: 18px;
    min-height: 28px;
  }

  .stats-loading-icon {
    width: 16px;
    height: 16px;
  }
}

/* --- สำหรับจอเล็กมากๆ --- */
@media (max-width: 400px) {
  .stats-container {
    gap: 6px;
  }

  .stats-card {
    padding: 10px 6px;
  }

  .stats-label {
    font-size: 9px;
  }

  .stats-number {
    font-size: 16px;
    min-height: 24px;
  }

  .stats-loading-icon {
    width: 14px;
    height: 14px;
  }
}