/* ==========================================================================
   4) COMPONENTS — buttons, forms, product card, rails, pagination, toast …
   ========================================================================== */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--text); font-weight: 700; font-size: 15px;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--on-accent); }
.btn-ghost { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #f3c3c9; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 16.5px; border-radius: 14px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-weight: 600; font-size: 14px; color: var(--text-2); }
.field label small { font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea, .select {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; font-size: 16px; /* 16px stops iOS zoom */
  outline: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field select, .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2368778d' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.field input:focus, .field select:focus, .field textarea:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field .err { display: none; color: var(--danger); font-size: 13px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); background: var(--danger-soft); }
.field.invalid .err { display: block; }
.form-grid { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; margin-bottom: 14px; }
.alert-err { background: var(--danger-soft); color: #9c1f30; border: 1px solid #f5c2c9; }
.alert-ok { background: var(--ok-soft); color: #0a6b45; border: 1px solid #b6e6d0; }
.alert ul { margin: 6px 0 0 18px; }

/* ---------- chips / badges / tags ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 999px; background: #fff; font-weight: 600; font-size: 14px; color: var(--text); }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.status { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--bg); color: var(--text-2); }
.status.ok { background: var(--ok-soft); color: #0a6b45; }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.bad { background: var(--danger-soft); color: #a8222f; }

/* ---------- product card (single-line title everywhere except checkout) ---------- */
.pgrid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 900px) { .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .pgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.pgrid.pgrid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .pgrid.pgrid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .pgrid.pgrid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.pcard { position: relative; display: flex; flex-direction: column; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: box-shadow .18s, transform .18s; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pthumb { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--bg); overflow: hidden; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { width: 100%; height: 100%; display: grid; place-items: center; color: #a9b6c9; }
.thumb-ph .ic { width: 42px; height: 42px; }
.tag { position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1.6; background: var(--accent); color: var(--on-accent); }
.tag-out { left: auto; right: 8px; background: #475569; color: #fff; }
.pbody { display: flex; flex-direction: column; gap: 5px; padding: 10px 10px 12px; min-width: 0; }
.pname { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname a { color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname a:hover { color: var(--brand-dark); text-decoration: none; }
.pprice { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; line-height: 1.3; }
.pprice strong { font-size: 17px; color: var(--brand-dark); font-weight: 800; }
.pprice s { font-size: 12.5px; color: var(--muted); }
.pactions { display: flex; gap: 6px; margin-top: 4px; }
.pactions .btn { min-height: 38px; padding: 0 10px; font-size: 13.5px; border-radius: 10px; }
.pactions .btn-add { flex: none; width: 40px; padding: 0; }
.pactions .btn-order { flex: 1; min-width: 0; }
@media (min-width: 900px) { .pname { font-size: 15px; } .pbody { padding: 12px; } }

.skel { background: linear-gradient(100deg, #e9eef5 30%, #f6f8fb 50%, #e9eef5 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- sections with "সব দেখুন" ---------- */
.section { margin: 26px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.section-head h2 .ic { color: var(--accent); }
.link-more { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.link-more:hover { text-decoration: none; background: var(--brand); color: var(--on-brand); }
@media (min-width: 900px) { .section { margin: 38px 0; } .section-head h2 { font-size: 26px; } .link-more { font-size: 14.5px; padding: 8px 18px; } }

/* ---------- auto-scrolling rails (right → left). Behaviour lives in site.js: Store.autoRail() ---------- */
.rail { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: none; }
.rail .pcard { width: 164px; }
@media (min-width: 640px) { .rail { gap: 14px; } .rail .pcard { width: 200px; } }
@media (min-width: 1200px) { .rail .pcard { width: 214px; } }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 26px 0 6px; }
.pagination a, .pagination span.pg {
  min-width: 42px; height: 42px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 12px; background: #fff; border: 1.5px solid var(--line-2);
  color: var(--text); font-weight: 700; font-size: 15px;
}
.pagination a:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-dark); }
.pagination .cur { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pagination .dis { opacity: .4; pointer-events: none; }
.pagination .gap { border: 0; background: none; min-width: 20px; padding: 0; }
.page-info { color: var(--muted); font-size: 14px; }

/* ---------- misc ---------- */
.empty-state { text-align: center; padding: 48px 18px; background: #fff; border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty-state .ic-big { width: 54px; height: 54px; color: #a9b6c9; margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); padding: 14px 0 8px; }
.breadcrumb a { color: var(--muted); } .breadcrumb span:last-child { color: var(--text-2); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bn-h) + var(--safe-b) + 14px); transform: translate(-50%, 24px); opacity: 0; pointer-events: none; z-index: 120;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 28px); padding: 12px 16px; border-radius: 14px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg);
  font-size: 14.5px; transition: opacity .2s, transform .2s;
}
.toast .ic { color: #4ade80; }
.toast a { color: #8cc4ff; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; }
.qty button { width: 38px; height: 38px; border: 0; background: var(--bg); display: grid; place-items: center; }
.qty button:hover { background: var(--brand-soft); }
.qty input { width: 44px; height: 38px; border: 0; text-align: center; font-weight: 700; font-size: 15px; -moz-appearance: textfield; appearance: textfield; background: #fff; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- static / blog content (also used by server-rendered /blog and /page/*) ---------- */
.page-hero { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: var(--on-navy); padding: 30px 0; }
.page-hero h1 { color: inherit; margin: 0 0 6px; } .page-hero p { margin: 0; opacity: .85; }
.prose { font-size: 16.5px; line-height: 1.85; color: var(--text-2); overflow-wrap: anywhere; }
.prose h2 { margin-top: 1.6em; font-size: 22px; } .prose h3 { margin-top: 1.3em; }
.prose img { border-radius: var(--r); margin: 1em 0; }
.prose ul, .prose ol { margin: 0 0 1em 1.3em; padding: 0; } .prose li { margin-bottom: .35em; }
.prose blockquote { margin: 1em 0; padding: 8px 18px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 var(--r) var(--r) 0; }
.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.article { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 24px; }
.article-head h1 { font-size: 26px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.article-meta span { display: inline-flex; align-items: center; gap: 5px; }
.article-cover img { width: 100%; border-radius: var(--r); margin-bottom: 16px; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.faq-section { margin-top: 28px; } .faq-section h2 { font-size: 20px; }
.faq-item { border: 1px solid var(--line); border-radius: var(--r); background: #fff; margin-bottom: 8px; overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--brand); }
.faq-item[open] summary::after { content: "–"; }
.faq-a { padding: 0 16px 14px; color: var(--text-2); }
.post-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .post-grid { grid-template-columns: repeat(2, 1fr); } } @media (min-width: 1000px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
.post-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.post-thumb { aspect-ratio: 16 / 10; background: var(--bg); display: block; overflow: hidden; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb-ph { width: 100%; height: 100%; display: grid; place-items: center; color: #a9b6c9; }
.post-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.post-body h2 { font-size: 18px; margin: 0; } .post-body h2 a { color: var(--text); }
.post-body p { color: var(--muted); font-size: 14.5px; margin: 0; }
.post-date { color: var(--muted); font-size: 13px; }
.related-posts { margin: 28px 0; }
.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 30px 0; padding: 22px; border-radius: var(--r-lg); background: linear-gradient(135deg, var(--brand), var(--navy)); color: #fff; }
.cta-band h2 { color: #fff; margin: 0 0 4px; font-size: 20px; } .cta-band p { margin: 0; opacity: .9; }
.legal { padding: 20px 0 10px; } .legal-box { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.legal-box h2 { font-size: 19px; margin-top: 1.4em; } .legal-box h2:first-child { margin-top: 0; }
.legal-box p, .legal-box li { color: var(--text-2); } .legal-box ul { margin: 0 0 1em 1.3em; }
