/* =========================================================
   UDO Welding Wire Center — Shared Stylesheet
   Used by every page (index.html, category.html, ฯลฯ)
   ========================================================= */

:root{
  --red:#e2231a;
  --green:#5cb531;
  --dark-green:#4a9e26;
  --dark:#2b2f36;
  --gray-img:#d8d8d8;
  --gray-border:#e2e2e2;
  --text:#222;
}
*{box-sizing:border-box;}
body{
  margin:0;
  font-family:"Sarabun","Noto Sans Thai",Arial,sans-serif;
  color:var(--text);
  background:#fff;
}
a{color:inherit;text-decoration:none;}

/* ---------- Top bar ---------- */
.topbar{
  background:var(--red);
  color:#fff;
  font-size:12.5px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:6px 24px;
}
.topbar .left{display:flex;gap:14px;align-items:center;}
.topbar .right{display:flex;gap:10px;align-items:center;}
.topbar .right span{opacity:.6;}

/* ---------- Header ---------- */
.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 24px;
  gap:24px;
  flex-wrap:wrap;
}
.logo{display:flex;align-items:center;gap:10px;}
.logo-badge{
  width:52px;height:52px;
  background:var(--dark);
  border-radius:6px;
  position:relative;
  flex-shrink:0;
}
.logo-badge::before{
  content:"";
  position:absolute;inset:8px;
  background:repeating-linear-gradient(90deg,#fff 0 6px, transparent 6px 12px);
}
.logo-badge::after{
  content:"";
  position:absolute;right:6px;bottom:6px;width:14px;height:10px;background:var(--red);
}
.logo-text{line-height:1.1;}
.logo-text .main{font-weight:800;font-size:15px;letter-spacing:.5px;}
.logo-text .sub{font-size:10px;letter-spacing:1px;color:#666;}

.searchbox{
  flex:1;
  display:flex;
  max-width:560px;
  min-width:260px;
}
.searchbox .cat-btn{
  background:var(--dark);
  color:#fff;
  border:none;
  padding:0 18px;
  font-size:13px;
  border-radius:4px 0 0 4px;
  white-space:nowrap;
  cursor:pointer;
}
.searchbox input{
  flex:1;
  border:1px solid var(--gray-border);
  border-left:none;border-right:none;
  padding:0 14px;
  font-size:13px;
  color:#888;
}
.searchbox .go{
  background:var(--red);
  border:none;
  width:46px;
  border-radius:0 4px 4px 0;
  color:#fff;
  font-size:16px;
  cursor:pointer;
}

.header-right{display:flex;align-items:center;gap:18px;}
.account{display:flex;flex-direction:column;align-items:center;font-size:11px;gap:2px;}
.account .icon{
  width:30px;height:30px;border-radius:50%;
  background:#eee;border:1px solid #ccc;
  display:flex;align-items:center;justify-content:center;
}
.line-btn{
  background:#06c755;color:#fff;font-size:12px;font-weight:700;
  padding:8px 14px;border-radius:20px;
}

/* ---------- Nav ---------- */
.nav{
  background:var(--green);
  display:flex;
  justify-content:center;
  gap:48px;
  padding:12px 0;
  font-size:14px;
  font-weight:600;
}
.nav a{color:#fff;}
.nav a.active{text-decoration:underline;text-underline-offset:4px;}

/* ---------- Breadcrumb ---------- */
.breadcrumb{
  background:var(--dark);
  color:#ccc;
  font-size:12.5px;
  padding:10px 24px;
}
.breadcrumb b{color:#fff;font-weight:400;}

.wrap{max-width:1300px;margin:0 auto;padding:0 24px;}

/* ---------- Section headings ---------- */
.section-eyebrow{
  color:var(--red);
  font-size:13px;
  margin:28px 0 2px;
  font-weight:600;
}
.section-title{
  font-size:26px;
  font-weight:800;
  margin:0 0 4px;
  border-bottom:3px solid var(--red);
  display:inline-block;
  padding-bottom:6px;
}

/* ---------- Category grid ---------- */
.cat-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:22px;
  margin-top:22px;
}
.cat-card{text-align:center;}
.cat-img{
  background:var(--gray-img);
  aspect-ratio:1.5/1;
  border-radius:4px;
  margin-bottom:10px;
}
.cat-card .name{font-size:14px;font-weight:600;}
.cat-card .count{font-size:12.5px;color:var(--red);margin-top:2px;}

/* ---------- Step bar ---------- */
.stepbar{
  background:var(--dark-green);
  border-radius:6px;
  display:flex;
  align-items:center;
  padding:14px 18px;
  margin-top:24px;
  gap:0;
}
.step{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 18px;
  border-radius:6px;
  color:#fff;
  position:relative;
}
.step.active{background:var(--dark);cursor:pointer;}
.step.chosen{background:rgba(0,0,0,.15);}
.step .caret{font-size:10px;opacity:.75;margin-left:2px;}

/* Group dropdown menu (เมนู "กลุ่มสินค้า") */
.group-dropdown{
  display:none;
  position:absolute;
  top:calc(100% + 10px);
  left:0;
  width:340px;
  background:#fff;
  border-radius:8px;
  box-shadow:0 12px 32px rgba(0,0,0,.18);
  overflow:hidden;
  z-index:200;
  color:var(--text);
}
.group-dropdown.open{display:block;}
.group-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:13px 18px;
  font-size:13.5px;
  font-weight:600;
  color:var(--text);
  border-bottom:1px solid #f0f0f0;
}
.group-item:last-child{border-bottom:none;}
.group-item:hover{background:#f7f7f7;}
.group-item.active{background:#eaf5e2;color:var(--dark-green);}
.count-badge{
  font-size:11.5px;
  font-weight:600;
  color:#999;
  background:#f2f2f2;
  padding:3px 11px;
  border-radius:10px;
  flex-shrink:0;
  margin-left:12px;
}
.group-item.active .count-badge{background:#d9edc9;color:var(--dark-green);}
.step-dot{
  width:22px;height:22px;border-radius:50%;
  background:#fff;color:var(--dark-green);
  display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:800;flex-shrink:0;
}
.step .label{font-size:11px;opacity:.85;display:block;}
.step .value{font-size:14.5px;font-weight:700;}
.step-arrow{color:#fff;font-size:20px;padding:0 8px;opacity:.7;}

/* ---------- Sub tabs ---------- */
.subtabs{
  background:var(--dark);
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:0;
  border-radius:0 0 6px 6px;
  margin-bottom:0;
}
.subtabs a{
  padding:14px 18px;
  font-size:13.5px;
  color:#ddd;
  white-space:nowrap;
  display:flex;
  align-items:center;
}
.subtabs a.active{
  background:var(--green);
  color:#fff;
  font-weight:700;
  margin:0 6px;
  padding:7px 20px;
  border-radius:999px;
}

.result-count{
  margin:22px 0 16px;
  font-size:15px;
  font-weight:700;
}
.result-count span{color:#888;font-weight:400;font-size:13px;}

/* ---------- Product grid ---------- */
.product-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:20px;
  margin-bottom:20px;
}
.product-card{
  border:1px solid var(--gray-border);
  border-radius:6px;
  overflow:hidden;
  background:#fff;
  position:relative;
}
.product-img{
  background:var(--gray-img);
  aspect-ratio:1/1;
  position:relative;
}
.badge{
  position:absolute;top:10px;left:10px;
  font-size:10.5px;
  font-weight:800;
  color:#fff;
  padding:4px 10px;
  letter-spacing:1px;
}
.badge.new{background:var(--green);}
.badge.sale{background:var(--red);}
.product-body{padding:12px 14px 14px;}
.product-name{font-size:14px;font-weight:700;margin:0 0 8px;line-height:1.3;}
.tags{display:flex;gap:6px;margin-bottom:8px;}
.tags span{
  font-size:10.5px;
  border:1px solid #ccc;
  color:#777;
  padding:2px 8px;
  border-radius:10px;
}
.stock{
  font-size:12px;color:#3a9d1f;margin-bottom:10px;
  display:flex;align-items:center;gap:5px;
}
.stock::before{content:"";width:7px;height:7px;border-radius:50%;background:#3a9d1f;}
.price-row{
  display:flex;justify-content:space-between;align-items:center;
  padding-top:10px;border-top:1px solid #f0f0f0;
}
.price{font-size:17px;font-weight:800;}
.price sup{font-size:12px;font-weight:600;}
.price .unit{font-size:12px;font-weight:400;color:#888;}
.add-btn{
  background:var(--dark);
  color:#fff;
  border:none;
  width:32px;height:32px;
  border-radius:5px;
  font-size:16px;
  cursor:pointer;
}
.add-btn:hover{background:var(--green);}

/* ---------- Footer ---------- */
footer{background:var(--green);color:#fff;margin-top:36px;}
.footer-grid{
  max-width:1300px;margin:0 auto;
  display:grid;grid-template-columns:1.3fr 1fr 1.3fr 1.1fr;
  gap:24px;
  padding:40px 24px;
}
.footer-logo{display:flex;flex-direction:column;gap:14px;}
.footer-logo .badge-box{
  width:46px;height:46px;background:var(--dark);border-radius:6px;
}
.footer-logo .brand{font-weight:800;letter-spacing:1px;font-size:15px;}
.socials{display:flex;gap:10px;margin-top:4px;}
.socials div{
  width:34px;height:34px;border-radius:50%;
  background:#fff;color:var(--green);
  display:flex;align-items:center;justify-content:center;
  font-size:14px;font-weight:800;
}
.socials .line{background:#06c755;color:#fff;font-size:9px;}
.hours{font-size:12px;margin-top:6px;opacity:.9;}
footer h4{font-size:15px;margin:0 0 12px;}
footer p{font-size:13px;line-height:1.7;margin:0 0 12px;opacity:.95;}
footer ul{list-style:none;margin:0;padding:0;font-size:13px;line-height:2;}
.bottom-bar{
  background:var(--red);color:#fff;
  display:flex;justify-content:space-between;align-items:center;
  padding:12px 24px;font-size:12.5px;flex-wrap:wrap;gap:8px;
}
.bottom-bar .links{display:flex;gap:20px;font-weight:600;}

/* ---------- Chat bubble ---------- */
.chat-fab{
  position:fixed;right:20px;bottom:90px;
  background:#fff;border:1px solid #ddd;color:var(--dark);
  font-size:11px;text-align:center;padding:8px 10px;
  border-radius:10px;box-shadow:0 2px 8px rgba(0,0,0,.15);
  z-index:50;
}
.chat-line{
  position:fixed;right:24px;bottom:24px;
  width:52px;height:52px;border-radius:50%;
  background:#06c755;color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:11px;font-weight:800;
  box-shadow:0 2px 10px rgba(0,0,0,.2);
  z-index:50;
}

/* ---------- Generic page content (for pages other than category) ---------- */
.page-content{
  padding:40px 0 60px;
  min-height:300px;
}

/* ---------- Responsive ---------- */
@media(max-width:1000px){
  .cat-grid{grid-template-columns:repeat(2,1fr);}
  .product-grid{grid-template-columns:repeat(2,1fr);}
  .footer-grid{grid-template-columns:1fr 1fr;}
  .stepbar{flex-wrap:wrap;gap:8px;}
}
@media(max-width:600px){
  .cat-grid{grid-template-columns:1fr 1fr;}
  .product-grid{grid-template-columns:1fr 1fr;}
  .footer-grid{grid-template-columns:1fr;}
  .nav{gap:18px;flex-wrap:wrap;padding:10px 12px;}
  .header{padding:12px;}
}
