/*
Theme Name: Webnail B2B Portal
Description: Reseller portal theme for the Webnail B2B Operations Platform. Premium, fast, Hebrew RTL, zero page builders. Requires the Webnail B2B plugin.
Version: 1.4.0
Author: Webnail
Text Domain: webnail-b2b-theme
Requires PHP: 8.1
*/

/* Design language: monochrome premium (per design/DESIGN.md), Heebo/Inter, RTL. */

:root {
  --surface: #f8f9fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #191c1d;
  --text-2: #6b7280;
  --primary: #000000;
  --success: #10b981;
  --success-bg: #d1fae5;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --warn-bg: #fef3c7;
  --info-bg: #e0e7ff;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -2px rgba(0,0,0,.05);
  --max: 1280px;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: 'Heebo', 'Inter', -apple-system, sans-serif;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  direction: rtl;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { letter-spacing: -0.01em; line-height: 1.25; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- header ---------- */
.site-head { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.site-head .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { font-size: 20px; font-weight: 700; text-decoration: none; }
.logo span { color: var(--text-2); font-weight: 400; font-size: 13px; }
.head-nav { display: flex; gap: 4px; flex: 1; }
.head-nav a { text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-weight: 500; font-size: 14px; }
.head-nav a:hover { background: var(--surface); }
.head-nav a.on { background: #edeeef; font-weight: 600; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.draft-btn { position: relative; text-decoration: none; padding: 8px 14px; border-radius: var(--radius); background: var(--primary); color: #fff; font-weight: 500; font-size: 14px; }
.draft-btn .lbl-short { display: none; }
.draft-btn .count {
  background: #fff; color: #000; border-radius: 999px; font-size: 11px; font-weight: 700;
  padding: 1px 7px; margin-inline-start: 6px; display: inline-block; min-width: 20px; text-align: center;
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px;
  border-radius: var(--radius); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; background: var(--primary); color: #fff; text-decoration: none; transition: background .15s;
}
.btn:hover { background: #262626; }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.input {
  font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--card); width: 100%;
}
.input:focus { outline: none; border-color: var(--primary); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }

.qty {
  display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
}
.qty button { border: 0; background: none; font-size: 16px; width: 32px; height: 36px; cursor: pointer; color: var(--text-2); }
.qty button:hover { background: var(--surface); }
.qty input { border: 0; width: 44px; text-align: center; font: inherit; font-size: 14px; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { display: none; }
.qty input:focus { outline: none; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-pad { padding: 24px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #edeeef; }
.pill.green { background: var(--success-bg); color: #047857; }
.pill.red { background: var(--error-bg); color: #b91c1c; }
.pill.amber { background: var(--warn-bg); color: #92400e; }
.pill.blue { background: var(--info-bg); color: #3730a3; }
.muted { color: var(--text-2); }

/* ---------- home ---------- */
.home-top { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 16px; margin: 32px 0; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-card b { font-size: 26px; font-weight: 600; display: block; letter-spacing: -0.02em; }
.stat-card span { color: var(--text-2); font-size: 13px; }
.manager-card { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.manager-card img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.manager-card .who b { display: block; }
.manager-card .who span { font-size: 12px; color: var(--text-2); display: block; }
.manager-card .links { margin-inline-start: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.announce { background: var(--primary); color: #fff; border-radius: var(--radius-lg); padding: 14px 20px; margin: 24px 0 0; font-size: 14px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 40px 0 16px; }
.section-head h2 { font-size: 20px; margin: 0; }
.section-head a { font-size: 13px; color: var(--text-2); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 16px; text-align: center; text-decoration: none; font-weight: 600; font-size: 14px;
  transition: border-color .15s;
}
.cat-card:hover { border-color: #9ca3af; }
.cat-card img { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; margin-bottom: 8px; }
.cat-card small { display: block; color: var(--text-2); font-weight: 400; }

/* ---------- product grid ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.prod-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s; }
.prod-card:hover { border-color: #9ca3af; }
.prod-card .img { display: block; aspect-ratio: 1; background: #fff; }
.prod-card .img img { width: 100%; height: 100%; object-fit: contain; }
.prod-card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.prod-card .name { font-weight: 500; font-size: 14px; text-decoration: none; line-height: 1.4; flex: 1; }
.prod-card .price { font-weight: 600; font-size: 16px; }
.prod-card .price small { color: var(--text-2); font-weight: 400; font-size: 11px; display: block; }
.prod-card .buy { display: flex; gap: 8px; align-items: center; }
.prod-card .buy .btn { flex: 1; }

/* ---------- category layout ---------- */
.cat-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin: 32px 0; align-items: start; }
.filters { position: sticky; top: 88px; }
.filters h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; color: var(--text-2); letter-spacing: .03em; }
.filters .card-pad { padding: 16px; }
.filters label { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 4px 0; cursor: pointer; }
.subcats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.subcats a { text-decoration: none; border: 1px solid var(--border); background: var(--card); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.subcats a:hover { border-color: var(--primary); }

/* ---------- product page ---------- */
.product-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin: 40px 0; align-items: start; }
.gallery-main { border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gallery-main img { max-height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs img { width: 64px; height: 64px; border: 1px solid var(--border); border-radius: var(--radius); object-fit: contain; background: #fff; cursor: pointer; }
.gallery-thumbs img.on { border-color: var(--primary); }
.p-brand { color: var(--text-2); font-size: 13px; }
.p-title { font-size: 26px; margin: 4px 0 12px; }
.p-prices { display: flex; align-items: baseline; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.p-wholesale { font-size: 28px; font-weight: 700; }
.p-retail { color: var(--text-2); text-decoration: line-through; }
.p-save { background: var(--success-bg); color: #047857; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; }
.p-buy { display: flex; gap: 12px; margin: 20px 0; }
.accordion { border-top: 1px solid var(--border); }
.accordion details { border-bottom: 1px solid var(--border); }
.accordion summary { padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.accordion summary::after { content: '+'; color: var(--text-2); }
.accordion details[open] summary::after { content: '–'; }
.accordion .inner { padding: 0 0 16px; font-size: 14px; color: #374151; }
.variations select { margin-bottom: 12px; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: right; font-size: 12px; color: var(--text-2); font-weight: 500; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid #f3f4f6; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover { background: var(--surface); }
.tbl .num { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
.tbl img.thumb { width: 48px; height: 48px; object-fit: contain; border-radius: var(--radius); background: #fff; border: 1px solid var(--border); }
.tbl-empty { padding: 56px; text-align: center; color: var(--text-2); }

/* ---------- account ---------- */
.account-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin: 32px 0; align-items: start; }
.account-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 88px; }
.account-nav a { text-decoration: none; padding: 10px 14px; border-radius: var(--radius); font-weight: 500; font-size: 14px; }
.account-nav a:hover { background: #edeeef; }
.account-nav a.on { background: var(--primary); color: #fff; }
.page-title { font-size: 24px; margin: 32px 0 8px; }

/* ---------- draft ---------- */
.draft-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; margin: 32px 0; align-items: start; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.summary-row.total { border-top: 2px solid var(--text); font-weight: 700; font-size: 18px; margin-top: 8px; padding-top: 12px; }

/* ---------- auth ---------- */
.auth-wrap { max-width: 420px; margin: 64px auto; padding: 0 24px; }
.auth-wrap .card-pad { padding: 32px; }
.auth-wrap h1 { font-size: 24px; margin: 0 0 6px; }
.auth-logo { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 24px; }
.notice { border-radius: var(--radius); padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }
.notice.error { background: var(--error-bg); color: #7f1d1d; }
.notice.ok { background: var(--success-bg); color: #065f46; }

/* ---------- order detail ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.ship-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.ship-box .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--primary); color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; animation: t-in .2s ease-out; }
.toast.error { background: var(--error); }
@keyframes t-in { from { opacity: 0; transform: translateY(8px); } }

.site-foot { border-top: 1px solid var(--border); margin-top: 64px; padding: 24px 0; color: var(--text-2); font-size: 13px; background: var(--card); }

.pager { display: flex; gap: 6px; margin: 24px 0; }
.pager a { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); padding: 6px 12px; text-decoration: none; font-size: 13px; }
.pager a.on { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 900px) {
  .home-top, .product-layout, .draft-layout, .cat-layout, .account-layout { grid-template-columns: 1fr; }
  .filters, .account-nav { position: static; }
  .site-head .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .head-nav { order: 3; width: 100%; overflow-x: auto; }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .wrap { padding: 0 14px; }
  .page-title { font-size: 20px; margin: 18px 0 6px; }
  .section-head { margin: 26px 0 12px; }
  .section-head h2 { font-size: 17px; }

  /* Header: one compact row — small logo, icon buttons, short draft label. */
  .site-head .wrap { flex-wrap: nowrap; gap: 8px; }
  .logo { font-size: 15px; white-space: nowrap; }
  .logo span { display: none; } /* hide the "B2B" suffix */
  .head-actions { margin-inline-start: auto; gap: 6px; }
  .head-actions .btn .lbl { display: none; }   /* account/logout → icons only */
  .head-actions .btn { padding: 8px 10px; font-size: 15px; line-height: 1; }
  .draft-btn { padding: 8px 10px; font-size: 12.5px; white-space: nowrap; }
  .draft-btn .lbl { display: none; }
  .draft-btn .lbl-short { display: inline; }
  /* No category menu on phones — navigation happens from the home page tiles. */
  .head-nav { display: none; }

  /* Product grid: two columns, stacked buy controls. */
  .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .prod-card .body { padding: 10px; gap: 6px; }
  .prod-card .name { font-size: 12.5px; }
  .prod-card .price { font-size: 14px; }
  .prod-card .buy { flex-direction: column; align-items: stretch; gap: 6px; }
  .prod-card .qty { display: flex; }
  .prod-card .qty input { flex: 1; width: auto; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-card { padding: 14px 10px; font-size: 13px; }

  /* Home. */
  .stat-card b { font-size: 20px; }
  .manager-card { flex-wrap: wrap; }
  .manager-card .links { margin-inline-start: 0; flex-direction: row; gap: 14px; width: 100%; }
  .announce { padding: 10px 14px; font-size: 13px; }

  /* Category page: products first, filters after. */
  .cat-layout { display: flex; flex-direction: column; margin: 18px 0; }
  .cat-layout .filters { order: 2; }
  .subcats a { padding: 5px 12px; font-size: 12.5px; }

  /* Tables scroll horizontally inside their card instead of breaking the page. */
  .card { overflow-x: auto; }
  .tbl { min-width: 540px; }

  /* Account area: horizontal pill nav instead of a sidebar. */
  .account-layout { display: block; margin: 16px 0; }
  .account-nav { flex-direction: row; overflow-x: auto; gap: 6px; margin-bottom: 14px; scrollbar-width: none; padding-bottom: 2px; }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-nav a { white-space: nowrap; padding: 7px 14px; font-size: 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); }
  .account-nav a.on { border-color: var(--primary); }

  /* Draft + product page. */
  .draft-layout { display: block; margin: 18px 0; }
  .draft-layout > * + * { margin-top: 14px; }
  .product-layout { gap: 18px; margin: 18px 0; }
  .p-title { font-size: 20px; }
  .p-wholesale { font-size: 22px; }
  .p-buy { flex-wrap: wrap; }
  .gallery-thumbs img { width: 52px; height: 52px; }

  .auth-wrap { margin: 24px auto; }
  .auth-wrap .card-pad { padding: 20px; }
  .home-top { margin: 18px 0; gap: 10px; }
  .ship-box { padding: 12px; }
  .pager { flex-wrap: wrap; }

  /* Toasts: full-width at the bottom, thumb-visible. */
  .toasts { left: 14px; right: 14px; bottom: 14px; }
  .toast { text-align: center; }
}
