/* ============================================================
   BabyWorld clone — design system (from storefront-child)
   ============================================================ */
:root {
  --base-color: #00aeef;
  --base-color-blue: #003f7c;
  --dark-blue: #1796c5;
  --color-red: #ea3223;
  --color-yellow: #ffd700;
  --text: #333;
  --line: #eee;
  --bg-soft: #fafafa;
}

@font-face {
  font-family: "krasarbold";
  src: url("fonts/krasar-bold.woff2") format("woff2"), url("fonts/krasar-bold.woff") format("woff");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "krasarregular";
  src: url("fonts/krasar-regular.woff2") format("woff2"), url("fonts/krasar-regular.woff") format("woff");
  font-weight: 400; font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "krasarregular", "Noto Sans Khmer", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  padding-top: 200px;
}
img { max-width: 100%; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--base-color); }
h1, h2, h3, h4, h5, h6 { font-family: "krasarbold", "krasarregular", sans-serif; margin: 0 0 12px; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: 1230px; margin: 0 auto; padding: 0 15px; }

/* ============================ HEADER ============================ */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 999; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .25s ease-out; }

/* Row 1: top utility menu */
.top-menu { background: var(--base-color-blue); height: 40px; overflow: hidden; }
.top-menu .container { display: flex; align-items: center; }
.top-menu ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; flex: 1; flex-wrap: nowrap; }
.top-menu li { position: relative; flex: 0 0 auto; }
.top-menu li a { color: #fff; font-size: 14px; font-weight: 500; line-height: 40px; padding: 0 9px; display: inline-block; white-space: nowrap; }
.top-menu li a:hover { background: rgba(255,255,255,.15); color: #fff; }
.top-menu li.menu-item-has-children:hover > .sub-menu { opacity: 1; top: 40px; visibility: visible; }
.top-menu .sub-menu {
  list-style: none; margin: 0; position: absolute; background: var(--base-color-blue); z-index: 2;
  top: 60px; visibility: hidden; opacity: 0; padding: 10px 18px 20px; border-radius: 0 0 8px 8px;
  min-width: 240px; transition: all .25s ease-out;
}
.top-menu .sub-menu li { white-space: nowrap; }
.top-menu .sub-menu li a { line-height: 32px; width: 100%; }
.top-menu .lang { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-menu .lang a { color: #fff; font-size: 14px; font-weight: 500; }
.top-menu .lang .cur { color: var(--color-yellow); text-decoration: underline; }

/* Row 2: logo + search + wishlist/cart */
.logo-search-cart { display: flex; align-items: center; height: 60px; gap: 20px; }
.logo-search-cart a.logo img { max-height: 54px; display: block; }
.site-search { flex: 1; max-width: 640px; margin: 0 auto; position: relative; }
.site-search input {
  width: 100%; height: 38px; padding: 0 46px 0 14px; font-size: 14px;
  border: 1px solid var(--base-color); border-radius: 4px; outline: none; font-family: inherit;
}
.site-search button {
  position: absolute; right: 0; top: 0; height: 38px; width: 44px;
  background: var(--base-color); border: 0; color: #fff; font-size: 15px; border-radius: 0 4px 4px 0;
}
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.icon-link { position: relative; color: var(--base-color); font-size: 24px; line-height: 1; }
.icon-link .badge {
  position: absolute; right: -8px; top: -10px; background: var(--color-red); color: #fff;
  padding: 1px 5px; height: 20px; line-height: 20px; border-radius: 8px; font-size: 10px; min-width: 20px; text-align: center;
}

/* Row 3: category mega menu */
.primary-navigation ul.cat-menu { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.primary-navigation .cat-item { position: relative; flex: 1; }
.primary-navigation .cat-item > a { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 92px; padding: 6px 4px 4px; font-size: 13px; line-height: 18px; text-align: center; transition: color .2s; }
.primary-navigation .cat-item > a img { width: 42px; height: 42px; object-fit: contain; margin-bottom: 6px; transition: transform .25s ease-out; }
.primary-navigation .cat-item:hover > a { color: var(--base-color); }
.primary-navigation .cat-item:hover > a img { transform: scale(1.12); }
.primary-navigation .cat-dropdown {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 999; display: none;
  background: var(--bg-soft); box-shadow: 0 1px 8px rgba(0,0,0,.15); border-radius: 0 0 4px 4px;
}
.primary-navigation .cat-item:hover .cat-dropdown { display: block; }
.cat-dropdown-inner { max-width: 1300px; margin: 0 auto; padding: 20px 15px 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.cat-col { border-left: 1px solid #eee; padding: 0 16px 22px; }
.cat-col:first-child { border-left: 0; }
.cat-col > a { display: block; font-weight: 700; font-size: 14px; line-height: 28px; margin-bottom: 4px; }
.cat-col > a:hover { color: var(--base-color); }
.cat-col .children { list-style: none; margin: 0; padding: 0; }
.cat-col .children li a { display: block; font-size: 13px; line-height: 20px; margin: 4px 0 4px 8px; }
.cat-col .children li a:hover { color: var(--base-color); }
.cat-dropdown .brand-strip { grid-column: 1 / -1; border-top: 1px solid #eee; margin-top: 8px; padding-top: 12px; }
.cat-dropdown .brand-strip .row { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-dropdown .brand-strip img { width: 70px; height: 70px; object-fit: contain; border: 1px solid #eee; padding: 6px; }

/* shrunk header on scroll (mirrors .smaller) */
.site-header.smaller { transform: translateY(-40px); }
.site-header.smaller .top-menu { display: none; }

/* ============================ PAGE TITLE ============================ */
.page-title-bar {
  font-size: 32px; font-family: "krasarbold", sans-serif; background: var(--bg-soft);
  line-height: 60px; padding: 0 15px; border-radius: 4px 4px 0 0; border-bottom: 1px solid rgba(0,174,239,.2);
}
.breadcrumbs { padding: 10px 0 0; font-size: 13px; color: #888; }
.breadcrumbs a { color: #888; }
.breadcrumbs a:hover { color: var(--base-color); }

/* ============================ PRODUCT GRID ============================ */
.shop-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.shop-toolbar select, .shop-toolbar label.chk {
  height: 36px; padding: 0 10px; border: 1px solid #ddd; border-radius: 4px; background: #fff;
  font-size: 13px; font-family: inherit; color: var(--text);
}
.shop-toolbar label.chk { display: flex; align-items: center; gap: 6px; padding: 0 12px; cursor: pointer; }
.result-count { margin-left: auto; font-size: 13px; color: #777; }
.products-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; padding: 5px 0 20px; }
.products-grid.three { grid-template-columns: repeat(3, 1fr); gap: 18px; }

.card {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 5px;
  padding: 8px; display: flex; flex-direction: column; transition: all .25s ease-in;
}
.card:hover { border-color: rgba(0,174,239,.35); box-shadow: 0 0 10px rgba(0,174,239,.1); }
.card .thumb { display: block; overflow: hidden; border-bottom: 1px solid var(--bg-soft); margin-bottom: 10px; }
.card .thumb img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; margin: 0 auto; transition: transform .25s ease-in; }
.card:hover .thumb img { transform: scale(1.06); }
.card .title {
  font-size: 14px; font-weight: 300; font-family: "krasarregular", sans-serif; min-height: 46px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0 auto 6px; text-align: center;
}
.card .title a { color: var(--text); }
.card .price { color: var(--base-color); font-size: 22px; text-align: center; margin: 0 0 5px; font-weight: 400; }
.card .price del { color: #999; font-size: 14px; margin-right: 6px; }
.card .add-to-cart {
  display: block; text-align: center; background: var(--base-color); color: #fff;
  font-size: 14px; padding: 8px 4px; border-radius: 4px; margin-top: auto; border: 0; width: 100%;
}
.card .add-to-cart:hover { background: var(--dark-blue); color: #fff; }
.card .add-to-cart .fa-cart { margin-right: 6px; }
.card .onsale {
  position: absolute; top: -6px; left: -6px; background: var(--color-red); color: #fff;
  font-size: 12px; padding: 0 8px; border-radius: 4px; height: 28px; line-height: 28px; z-index: 1;
}
.card .oos {
  position: absolute; top: -6px; right: -6px; background: #6b7684; color: #fff;
  font-size: 12px; padding: 0 8px; border-radius: 4px; height: 28px; line-height: 28px; z-index: 1;
}
.card .lowstk {
  position: absolute; top: -6px; right: -6px; background: #f5a623; color: #fff;
  font-size: 12px; padding: 0 8px; border-radius: 4px; height: 28px; line-height: 28px; z-index: 1;
}
.card .add-to-cart:disabled { background: #cfd6dd; color: #fff; cursor: not-allowed; }
.pd-stock { margin: 8px 0; font-weight: 600; }
.pd-stock.ok { color: #2e9e5b; }
.pd-stock.low { color: #d98a00; }
.pd-stock.oos { color: var(--color-red); }
.btn-add:disabled { background: #cfd6dd; color: #fff; cursor: not-allowed; }

/* ============================ HOME ============================ */
.hero { position: relative; border-radius: 4px; overflow: hidden; margin-bottom: 30px; background: var(--base-color-blue); }
.hero .slide { display: none; width: 100%; }
.hero .slide.active { display: block; }
.hero .slide img { width: 100%; display: block; }
.hero .nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 56px; border: 0; background: rgba(0,0,0,.25); color: #fff; font-size: 20px;
}
.hero .nav-arrow.prev { left: 0; }
.hero .nav-arrow.next { right: 0; }
.hero .dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.hero .dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; }
.hero .dots span.active { background: #fff; }

.home-section { margin-bottom: 40px; }
.title-product-cat {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 24px; font-family: "krasarbold", sans-serif; margin-bottom: 18px;
}
.title-product-cat .view-all { font-size: 14px; font-family: "krasarregular", sans-serif; color: var(--base-color); }
.title-product-cat .view-all:hover { text-decoration: underline; }

.brands-row { display: flex; flex-wrap: wrap; gap: 14px; }
.brands-row .brand-cell {
  flex: 0 0 calc(12.5% - 12px); min-width: 110px; background: #fff; border: 1px solid var(--line);
  border-radius: 5px; padding: 10px; display: flex; align-items: center; justify-content: center; min-height: 100px;
}
.brands-row .brand-cell img { max-width: 100%; max-height: 80px; object-fit: contain; }
.brands-row .brand-cell:hover { border-color: var(--base-color); }

.cat-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; }
.cat-tile { position: relative; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; display: block; }
.cat-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; transition: transform .25s; }
.cat-tile:hover img { transform: scale(1.05); }
.cat-tile .cap {
  position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,63,124,.82); color: #fff;
  text-align: center; padding: 6px 4px; font-size: 14px;
}

/* ============================ PRODUCT DETAIL ============================ */
.product-detail { display: flex; gap: 36px; padding: 26px 0; }
.product-detail .pd-image { flex: 0 0 380px; border: 1px solid var(--line); border-radius: 5px; padding: 10px; }
.product-detail .pd-image img { width: 100%; }
.product-detail .pd-summary { flex: 1; }
.product-detail .pd-summary h1 { font-size: 26px; font-family: "krasarregular", sans-serif; margin-bottom: 18px; }
.product-detail .pd-price { color: var(--base-color); font-size: 28px; margin-bottom: 18px; }
.product-detail .pd-price del { color: #999; font-size: 18px; margin-right: 8px; }
.product-detail .pd-sku { font-size: 13px; color: #888; margin-bottom: 18px; }
.product-detail .pd-desc { line-height: 1.7; font-size: 14px; }
.btn-add {
  display: inline-block; background: var(--base-color); color: #fff; font-size: 15px;
  padding: 10px 30px; border: 0; border-radius: 4px; margin-top: 20px;
}
.btn-add:hover { background: var(--dark-blue); color: #fff; }
.pd-links { margin-top: 22px; font-size: 13px; color: #777; line-height: 2; }
.pd-links a { color: var(--base-color); margin-right: 4px; }

/* ============================ CONTENT PAGES ============================ */
.content-page { padding: 24px 0 40px; }
.content-page .entry { max-width: 900px; margin: 0 auto; }
.content-page h1 { font-size: 28px; }
.content-page h2 { font-size: 22px; margin-top: 24px; }
.content-page h3 { font-size: 18px; }
.content-page p { line-height: 1.8; }
.content-page img { border-radius: 4px; max-width: 100%; }
.content-page ul, .content-page ol { line-height: 1.9; }
.content-page table { border-collapse: collapse; width: 100%; margin: 14px 0; }
.content-page th, .content-page td { border: 1px solid #ddd; padding: 8px 10px; text-align: left; font-size: 13px; }
.content-page th { background: var(--bg-soft); }
.post-list { padding: 20px 0; }
.post-item { display: block; padding: 16px 12px; border-bottom: 1px solid var(--line); }
.post-item h3 { font-size: 17px; margin: 0 0 4px; }
.post-item .date { color: #999; font-size: 12px; }
.post-item:hover h3 { color: var(--base-color); }

/* ============================ PAGINATION ============================ */
.pagination { display: flex; gap: 6px; padding: 18px 0 40px; flex-wrap: wrap; }
.pagination a, .pagination span.cur {
  min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #ddd; border-radius: 4px; font-size: 14px; padding: 0 8px; background: #fff;
}
.pagination a:hover { border-color: var(--base-color); color: var(--base-color); }
.pagination span.cur { background: var(--base-color); color: #fff; border-color: var(--base-color); }
.pagination .gap { border: 0; }

/* ============================ FOOTER ============================ */
.site-footer { background: rgba(0,174,239,.08); border-top: 1px solid rgba(0,174,239,.25); margin-top: 50px; }
.footer-cols { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 30px; padding: 36px 0 26px; }
.footer-cols h4 { font-size: 16px; margin-bottom: 14px; color: var(--base-color-blue); }
.footer-cols .about { font-size: 13px; line-height: 1.8; color: #555; margin-top: 14px; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols ul li a { display: inline-block; line-height: 2.1; font-size: 13px; color: #555; }
.footer-cols ul li a:hover { color: var(--base-color); }
.social-row { display: flex; gap: 10px; margin-top: 14px; }
.social-row a { display: block; width: 40px; height: 40px; border-radius: 6px; overflow: hidden; }
.social-row img { width: 100%; height: 100%; object-fit: cover; }
.store-item { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.store-item img { width: 96px; height: auto; border-radius: 4px; }
.store-item .st-name { font-size: 13px; font-weight: 700; color: var(--base-color-blue); }
.footer-bottom { border-top: 1px solid rgba(0,174,239,.2); padding: 14px 0; font-size: 12px; color: #777; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }

/* ============================ CART DRAWER ============================ */
#cartOverlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: none; }
#cartOverlay.open { display: block; }
#cartDrawer {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100%; background: #fff;
  z-index: 1001; box-shadow: -4px 0 16px rgba(0,0,0,.15); transition: right .25s ease; display: flex; flex-direction: column;
}
#cartDrawer.open { right: 0; }
.cart-head { padding: 16px 18px; background: var(--base-color-blue); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.cart-head h3 { margin: 0; font-size: 18px; color: #fff; }
.cart-head button { background: none; border: 0; color: #fff; font-size: 20px; }
.cart-body { flex: 1; overflow-y: auto; padding: 12px 18px; }
.cart-empty { text-align: center; color: #999; padding: 40px 0; font-size: 14px; }
.cart-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 64px; height: 64px; object-fit: contain; flex: 0 0 64px; }
.cart-item .ci-info { flex: 1; min-width: 0; }
.cart-item .ci-name { font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item .ci-price { color: var(--base-color); font-size: 14px; margin-top: 4px; }
.qty-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-row button { width: 24px; height: 24px; border: 1px solid #ddd; background: #fff; border-radius: 4px; font-size: 13px; }
.ci-remove { background: none; border: 0; color: var(--color-red); font-size: 12px; margin-left: auto; }
.cart-foot { padding: 14px 18px; border-top: 1px solid var(--line); }
.cart-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.cart-total .amt { color: var(--base-color); font-size: 20px; }
.btn-checkout { width: 100%; background: var(--base-color); color: #fff; border: 0; border-radius: 4px; padding: 12px; font-size: 15px; }
.btn-checkout:hover { background: var(--dark-blue); }
.cart-note { font-size: 11px; color: #999; text-align: center; margin-top: 8px; }

/* toast */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--base-color-blue); color: #fff; padding: 10px 22px; border-radius: 24px;
  font-size: 14px; z-index: 1200; opacity: 0; transition: all .3s ease; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================ BRANDS / CATEGORIES INDEX ============================ */
.brand-index { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; padding: 20px 0 40px; }
.brand-index .b-cell { border: 1px solid var(--line); border-radius: 5px; padding: 14px; text-align: center; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.brand-index .b-cell img { max-height: 60px; max-width: 90%; object-fit: contain; }
.brand-index .b-cell:hover { border-color: var(--base-color); }
.cat-tree { columns: 2; column-gap: 40px; padding: 20px 0 40px; }
.cat-tree .top { margin-bottom: 18px; break-inside: avoid; }
.cat-tree .top > a { font-size: 17px; font-weight: 700; color: var(--base-color-blue); }
.cat-tree ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 18px; }
.cat-tree ul a { font-size: 13px; line-height: 2.1; color: #555; display: inline-block; }
.cat-tree ul a:hover { color: var(--base-color); }

.empty-state { text-align: center; color: #999; padding: 60px 0; font-size: 15px; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1100px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .brands-row .brand-cell { flex: 0 0 calc(16.6% - 12px); }
  .cat-tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  body { padding-top: 100px; }
  .primary-navigation { display: none; }
  .top-menu ul li:not(.keep) { display: none; }
  .products-grid, .products-grid.three { grid-template-columns: repeat(2, 1fr); }
  .cat-tiles, .brand-index { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: 1fr; }
  .product-detail { flex-direction: column; }
  .product-detail .pd-image { flex: none; max-width: 380px; }
  .cat-tree { columns: 1; }
}
