:root {
  --bg: #0b0b0b;
  --card: #111216;
  --soft: #171922;
  --line: #222433;
  --text: #e6e7ef;
  --muted: #a8adbf;
  --red: #e50914;
  --red-2: #ff2442;
  --glow: 0 10px 30px rgba(229,9,20,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Noto Sans Thai", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(229,9,20,.15), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(229,9,20,.12), transparent 60%),
    linear-gradient(180deg,#090909 0%, #0d0d10 40%, #0b0b0b 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  min-height: 100vh;
}

/* Containers */
.mx-container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.mx-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14,14,18,.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 3px 20px rgba(0,0,0,.25);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
}
.brand-text { font-weight: 900; letter-spacing: .5px; }
.brand-red { color: var(--red); }
.badge-dot { width: 12px; height: 12px; border-radius: 999px; background: var(--red); box-shadow: 0 0 0 6px rgba(229,9,20,.18); }

.nav { display: flex; gap: 18px; }
.nav-link {
  color: #dfe3ff; text-decoration: none; opacity: .8; padding: 8px 12px; border-radius: 10px; transition: .2s;
}
.nav-link:hover { opacity: 1; background: rgba(255,255,255,.06); }
.nav-link.is-active { background: rgba(229,9,20,.2); color: #fff; box-shadow: var(--glow); }
.nav-link.login { background: linear-gradient(90deg,var(--red),var(--red-2)); color: white; box-shadow: var(--glow); }

.hamburger { display: none; background: none; border: none; cursor: pointer; }
.hamburger span { display: block; width: 24px; height: 2px; background: #fff; margin: 5px 0; }

.mobile-menu {
  display: none; position: fixed; top:64px; left:0; right:0;
  background:#0e0f14; border-bottom:1px solid #222; padding:12px 16px; z-index:40;
}
.mobile-menu.open { display:block; animation: drop .2s ease; }
@keyframes drop { from { transform:translateY(-10px); opacity:0; } to { transform:translateY(0); opacity:1; } }
.m-link { display:block; color:#fff; text-decoration:none; padding:12px; border-radius:12px; }
.m-link.is-active, .m-link:hover { background:rgba(229,9,20,.18); }

/* Announcement */
.announce { border-bottom: 1px solid rgba(255,255,255,.06); background:#0c0d12;margin-top: 10px; }
.announce-inner { display:flex; gap:2px; align-items:center; height:44px; }
/*.pill { background:linear-gradient(90deg,var(--red),var(--red-2)); padding:6px 10px; border-radius:25px; font-weight:700; width: 100px; }*/
.pill {
  background:linear-gradient(90deg,var(--red),var(--red-2));
  padding:6px 10px;
  border-radius:25px;
  font-weight:700;
  width: 100px;
  flex: 0 0 100px; 
  min-width: 100px;
  max-width: 100px;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.announce-marquee { overflow:hidden; white-space:nowrap; }
.announce-marquee span { display:inline-block; animation: marq 30s linear infinite; }
@keyframes marq { from{transform:translateX(0);} to{transform:translateX(-100%);} }
@media (max-width:1300px){.pill{width: 100px;}}
@media (max-width:600px){.pill{width: 100px;}}
/* Hero Slider */
.hero{padding:20px 0 8px}
.slider{position:relative}
.slides{display:grid;grid-auto-flow:column;grid-auto-columns:100%;overflow:hidden;border-radius:18px;border:1px solid var(--line);background:var(--soft)}
.slide{aspect-ratio:1248/490;background:#0e0f15 url('') center/cover no-repeat;position:relative}
.slide>a,.slide>img{display:block;width:100%;height:100%;object-fit:cover}
/* -Banner */
.hero .slide {
  aspect-ratio: 1116 / 279;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}



.skeleton{background:linear-gradient(90deg,#14161f 25%,#1c2030 37%,#14161f 63%);background-size:400% 100%;animation:shimmer 1.2s infinite}
@keyframes shimmer{0%{background-position:100% 0}100%{background-position:0 0}}
.slider-nav{position:absolute;top:50%;transform:translateY(-50%);width:44px;height:44px;border:1px solid rgba(255,255,255,.2);border-radius:12px;background:rgba(12,12,16,.5);backdrop-filter: blur(6px);color:#fff;cursor:pointer;z-index: 5;}
.slider-nav:hover{box-shadow:var(--glow)}
.slider-nav.left{left:12px}
.slider-nav.right{right:12px}
.dots{display:flex;gap:8px;justify-content:center;margin-top:10px}
.dot{width:10px;height:10px;border-radius:999px;background:#3b3e4e;cursor:pointer}
.dot.active{background:linear-gradient(90deg,var(--red),var(--red-2));box-shadow:var(--glow)}

/* Section */
.section { padding:26px 0; }
.section-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.title { margin:0; font-size:22px; }
.progress-rail { width:180px; height:10px; background:#1a1d2a; border-radius:999px; overflow:hidden; }
.progress-bar { width:0; height:100%; background:linear-gradient(90deg,var(--red),var(--red-2)); color:#fff; text-align:right; font-size:10px; padding-right:4px; }

/* Cards */
.cards-row { display:grid; grid-auto-flow:column; grid-auto-columns:140px; gap:14px; overflow-x:auto; padding-bottom:8px; scroll-snap-type:x mandatory; }
.cards-row::-webkit-scrollbar { height:8px; }
.cards-row::-webkit-scrollbar-thumb { background:#2a2e40; border-radius:999px; }
.row-btn { width:38px; height:38px; border:1px solid rgba(255,255,255,.18); border-radius:12px; background:#0f1118; color:#fff; cursor:pointer; }
.row-btn:hover { box-shadow:var(--glow); }

.cards-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:14px; }
@media (max-width:1200px){.cards-grid{grid-template-columns:repeat(6,1fr)}}
@media (max-width:900px){.cards-grid{grid-template-columns:repeat(4,1fr)} .nav{display:none} .hamburger{display:block}.slider-nav{width: 30px;height: 30px;border-radius:8px;}}
@media (max-width:600px){.cards-grid{grid-template-columns:repeat(3,1fr)}.badge.effect{font-size:7.5px}.badge.discount{font-size:8px}.effect2{font-size:16px}.cards-row{grid-auto-columns: 110px;}.slider-nav{width: 25px;height: 25px;border-radius:5px;}}

/* ===== Card ===== */
.card {
  background:linear-gradient(180deg,#0f1118,#0c0d13);
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  transition:transform .2s,box-shadow .2s,border-color .2s;
  scroll-snap-align:center;
  position:relative;
}
.card:hover { transform:translateY(-2px); box-shadow:var(--glow); border-color:rgba(229,9,20,.4); }
/* badge */
.card-thumb{
  position: relative;
  overflow: hidden;
  border-radius: 14px;


  --pad: clamp(6px, 1.2vw, 12px);
  --fs-badge: clamp(9px, 1.2vw, 12px);
  --fs-effect: clamp(9px, 1.1vw, 11.5px);
  padding: var(--pad);
}


.card-thumb img{
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  /*object-fit: contain;*/
  display: block;
  margin: 0;
  border-radius: 10px;
  background: #0e0f15;
}

.card-thumb img{
  position: relative;
  z-index: 0;
}

/* badge ตั้งไว้ข้างบนจะได้มองเห็นแหละ */
.card-thumb .badge,
.card-thumb .effect2{
  position: absolute;   /* เผื่อบางตัวไม่ได้กำหนดไว้ก่อนค่อยมาดู */
  z-index: 1;
}


/* badge ส่วนลด ขวาบน */
.card-thumb .badge.discount{
  position: absolute;
  top: var(--pad);
  right: var(--pad);
  font-size: var(--fs-badge);
  background: linear-gradient(90deg,var(--red),var(--red-2));
  color: #fff;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: var(--glow);
}

/* badge effect ล่างซ้าย */
.card-thumb .badge.effect{
  position: absolute;
  bottom: var(--pad);
  left: var(--pad);
  font-size: var(--fs-effect);
  color: #fff;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}

/* effect2 (ไอคอน ⚙️🔥⭐) ซ้ายบน */
.card-thumb .effect2{
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  font-size: clamp(16px, 2vw, 20px);
  animation: pop 1.5s ease-in-out infinite;
}

/* style effect*/
.effect2.fire { color: #ff3c00; text-shadow: 0 0 10px #ff7040; }
.effect2.news { color: #fff; text-shadow: 0 0 10px #00a4ff; animation: pop 2.0s linear(0 0%, 0 2.27%, 0.02 4.53%, 0.04 6.8%, 0.06 9.07%, 0.1 11.33%, 0.14 13.6%, 0.25 18.15%, 0.39 22.7%, 0.56 27.25%, 0.77 31.8%, 1 36.35%, 0.89 40.9%, 0.85 43.18%, 0.81 45.45%, 0.79 47.72%, 0.77 50%, 0.75 52.27%, 0.75 54.55%, 0.75 56.82%, 0.77 59.1%, 0.79 61.38%, 0.81 63.65%, 0.85 65.93%, 0.89 68.2%, 1 72.7%, 0.97 74.98%, 0.95 77.25%, 0.94 79.53%, 0.94 81.8%, 0.94 84.08%, 0.95 86.35%, 0.97 88.63%, 1 90.9%, 0.99 93.18%, 0.98 95.45%, 0.99 97.73%, 1 100%) infinite; }
.effect2.star { color: #ffd700; text-shadow: 0 0 10px #fff4b0; animation: spin 2s linear infinite; }
.effect2.gear { color: #ccc; text-shadow: 0 0 8px #777; animation: spin 2s linear infinite; }

@keyframes pop {
  0%,100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* สีพื้นหลังป้าย effect */
.effect-1 { background: linear-gradient(90deg,#ff4141,#ff7a7a); }
.effect-2 { background: linear-gradient(90deg,#ff9900,#ffd966); }
.effect-3 { background: linear-gradient(90deg,#41ff79,#7affb1); }
.effect-4 { background: linear-gradient(90deg,#4a9cff,#89c7ff); }
.effect-5 { background: linear-gradient(90deg,#ff00ff,#ff55aa); }

/* ตำแหน่งล่างซ้าย (ยึด var(--pad)*/
.card-thumb .badge.effect{
  bottom: var(--pad);
  left: var(--pad);
  font-size: var(--fs-effect);
  color: #fff;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}



/* Card body */
.card-body { padding:10px; }
.card-title { margin:0; font-size:13px; line-height:1.35; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;text-align: center; }
@media (max-width:900px){.card-title{white-space: nowrap;font-size:13px;}}
@media (max-width:500px){.card-title{white-space: nowrap;font-size:9px;}}

.price { display:flex; gap:8px; margin-top:6px; }
.price-now { font-weight:800; font-size:13px; }
.price-old { color:var(--muted); text-decoration:line-through; font-size:12px; }
.progress {
  position: relative;
  background: #1a1d2a;
  height: 18px;
  border-radius: 999px;
  margin-top: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 4px rgba(255,255,255,0.1);
}
.progress > span:not(.progress-text) {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--red-2));
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  text-align: center;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Tabs + Search */
.tabs{display:flex;gap:8px}
.tab{background:#0f1118;border:1px solid var(--line);color:#cfd5f7;padding:8px 12px;border-radius:10px;cursor:pointer}
.tab.is-active{background:linear-gradient(90deg,var(--red),var(--red-2));color:#fff;box-shadow:var(--glow)}
.tab-panels .panel{display:none}
.tab-panels .panel.is-active{display:block}

.searchbar{position:relative;margin:12px 0 18px}
.searchbar input{
  width:100%;background:#0f1118;border:1px solid var(--line);color:#fff;
  padding:12px 44px;border-radius:12px;outline:none;transition:border-color .2s;
}
.searchbar input:focus{border-color:rgba(229,9,20,.6);box-shadow:var(--glow)}
.searchbar i{position:absolute;left:12px;top:50%;transform:translateY(-50%);opacity:.75}
.suggest{position:absolute;left:0;right:0;top:100%;background:#0f1118;border:1px solid var(--line);border-radius:12px;margin-top:6px;list-style:none;padding:6px 0;display:none;z-index:5;max-height:260px;overflow:auto}
.suggest li{padding:10px 12px;cursor:pointer}
.suggest li:hover{background:#141726}

/* Footer */
.footer { margin-top:30px; border-top:1px solid rgba(255,255,255,.06); padding:24px 0; background:#0c0d12; }
.footer-inner { display:grid; grid-template-columns:2fr 1fr 1fr; gap:18px; }
.footer a { display:block; color:#cfd5f7; text-decoration:none; margin:6px 0; }
.footer a:hover { color:#fff; }
.foot-note { opacity:.8; margin:6px 0 0; }
.copyright { text-align:center; font-size:13px; opacity:.6; padding-top:8px; border-top:1px solid rgba(255,255,255,.06); }

/* ===== CUSTOMER ORDER NOTIFICATION (RED-THEME VERSION) ===== */
#notification-container {
  position: fixed;
  bottom: 120px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 9998;
  transition: right 0.4s ease, bottom 0.4s ease;
}
#notification-container.closed {
  right: -360px;
}

/* กล่องแจ้งเตือน */
.notification {
  display: flex;
  align-items: flex-start;
  background: rgba(20, 20, 25, 0.85);
  color: #fff;
  padding: 12px;
  border-radius: 12px;
  max-width: 320px;
  font: 14px/1.4 "Noto Sans Thai", sans-serif;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  border: 1px solid rgba(229,9,20,0.35);
  box-shadow: 0 0 15px rgba(229,9,20,0.25);
  backdrop-filter: blur(8px);
}

/* Animation */
@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.8) translateY(20px); }
  60%  { opacity: 1; transform: scale(1.05) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.notification.show {
  animation: popIn 0.5s ease forwards;
}

/* Animation */
@keyframes slideOutRight {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(100%); }
}
.notification.exit {
  animation: slideOutRight 0.5s ease-in-out forwards;
}

/* ภาพสินค้า */
.notification img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  margin-right: 12px;
  box-shadow: 0 0 12px rgba(229,9,20,0.35);
}

/* รายละเอียดข้อความ */
.notification .details {
  display: flex;
  flex-direction: column;
}
.notification .details div {
  margin-bottom: 4px;
}
.notification label {
  font-weight: bold;
  margin-right: 6px;
  min-width: 60px;
  color: var(--red-2);
}

/* ===== TOGGLE BUTTON ===== */
.toggle-btn {
  position: fixed;
  right: 16px;
  bottom: 68px;
  background: linear-gradient(90deg,var(--red),var(--red-2));
  border: none;
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  box-shadow: var(--glow);
  z-index: 1110;
}
.toggle-btn:hover { opacity: 0.9; }

/* ===== RESPONSIVE ===== */
@media (max-width:600px) {
  #notification-container { bottom: 140px; }
  .notification {
    max-width: 200px;
    padding: 8px;
    font: 12px/1.3 "Noto Sans Thai", sans-serif;
    border-radius: 12px;
  }
  .notification img { width: 48px; height: 48px; margin-right: 8px; }
  .notification label { min-width: 50px; margin-right: 4px; }
  #toggle-btn { bottom: 70px; right: 20px; }
}



/*menu*/
.nav-link.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
}
.nav-link.user-info .cash {
  color: var(--red-2);
  font-weight: 800;
}
.nav-link.logout {
  background: none;
  color: #ff8080;
}
.nav-link.logout:hover {
  background: rgba(229,9,20,.25);
  color: #fff;
}

/* ให้ header อยู่เหมือนเป็นลูกของ <body> เพื่อให้ sticky ทำงานยาวทั้งหน้า */
#header-container { display: contents; }

/* ===== Fixed header (CSS only) ===== */
:root { --header-h: 64px; } /* เท่ากับ .header-inner สูง 64px */

.mx-header{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000; /* สูงกว่า mobile menu (40) และปุ่มสไลด์ (5) */
}
/* ชดเชยระยะให้คอนเทนต์ไม่โดนทับ */
body{ padding-top: var(--header-h); }




/* ===== Scrollbar Theme (แดง-ดำ MxLarenShop) ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #0b0e1a;            /* สีพื้นหลัง scrollbar */
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff0033, #8b0000);
  border-radius: 8px;
  border: 2px solid #0b0e1a;      /* ให้มีขอบดูมีมิติ */
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff3355, #b00000);
}
::-webkit-scrollbar-corner {
  background: #0b0e1a;
}

/* สำหรับ Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #ff0033 #0b0e1a;
}


/*ช่องค้นหา CSS*/
.suggest li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.suggest li:hover {
  background: #141726;
}
.suggest li img.sug-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}
.suggest li .sug-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



/* ===== Floating Particles (background) ===== */
#mx-particles{
  position: fixed; inset: 0;
  pointer-events: none; overflow: hidden;
  z-index: 0;
}
.mx-dot{
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ff6a80, #e50914 55%, rgba(229,9,20,.5) 100%);
  box-shadow: 0 0 18px rgba(255, 60, 90, .55);
  opacity: .0;
  animation: mx-float var(--dur, 12s) linear infinite;
  transform: translate3d(0,0,0) scale(var(--scale, 1));
  will-change: transform, opacity;
  filter: saturate(1.1) contrast(1.05);
}
@keyframes mx-float{
  0%   { transform: translate3d(var(--x,0), 110vh, 0) scale(var(--scale,1)); opacity: 0; }
  8%   { opacity: .9; }
  50%  { opacity: 1; }
  100% { transform: translate3d(calc(var(--x,0) + var(--drift, 0px)), -10vh, 0) scale(var(--scale,1.1)); opacity: 0; }
}

.mx-dot.s { width: 5px; height: 5px; box-shadow: 0 0 10px rgba(255,40,60,.45); }
.mx-dot.m { width: 8px; height: 8px; }
.mx-dot.l { width: 12px; height: 12px; box-shadow: 0 0 28px rgba(255,50,70,.65); }

@media (prefers-reduced-motion: reduce){
  #mx-particles{ display:none; }
}