/*
Theme Name: ToolStore DZ
Theme URI: https://toolstoredz.com
Description: Algerian artisans tools aggregator. Mobile-first, Bootstrap 5, RTL + Polylang ready.
Version: 1.0.0
Author: Hermes Agent
License: GPL-2.0-or-later
Text Domain: toolstore
*/

:root {
  --ts-surface: #faf9f7;
  --ts-surface-card: #ffffff;
  --ts-primary: #ffa500;
  --ts-primary-dark: #855400;
  --ts-on-surface: #1a1c1b;
  --ts-secondary: #5f5e5e;
  --ts-outline: #eeeeee;
  --ts-radius: 12px;
}

body {
  background: var(--ts-surface);
  color: var(--ts-on-surface);
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 24px;
}

.ts-brand { color: var(--ts-on-surface); font-weight: 600; font-size: 20px; text-decoration: none; }
.ts-brand span { color: var(--ts-primary); }

/* Header nav links: no underline, hover changes color */
.ts-nav-link { color: var(--ts-secondary); text-decoration: none; transition: color .15s; }
.ts-nav-link:hover, .ts-nav-link:focus { color: var(--ts-primary); text-decoration: none; }
.ts-nav-link.active { color: var(--ts-primary); }

/* Kill underline everywhere in our theme, beat Bootstrap */
.ts-topbar a, .ts-drawer a, footer a, .ts-card, .ts-cat, .ts-nav-link, .ts-source, .ts-social, .btn-ts, .btn-ts-outline {
  text-decoration: none !important;
}
.ts-topbar a:hover, .ts-drawer a:hover, footer a:hover, .ts-card:hover, .ts-cat:hover, .ts-nav-link:hover, .ts-source:hover, .ts-social:hover {
  text-decoration: none !important;
}
a { text-decoration: none !important; }
a:hover { text-decoration: none !important; }

.ts-topbar {
  background: var(--ts-surface);
  border-bottom: 1px solid var(--ts-outline);
  position: sticky;
  top: 0;
  z-index: 40;
}

.ts-search {
  border: 1px solid var(--ts-outline);
  border-radius: 999px;
  padding: 14px 22px;
  padding-inline-end: 62px; /* keep the text clear of the round search button */
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
.ts-search:focus { border-color: var(--ts-primary); box-shadow: 0 0 0 2px rgba(255,165,0,.25); }

/* Round icon search button (no text) */
.ts-search-go {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: var(--ts-primary); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.ts-search-go:hover { opacity: .9; }

.ts-card {
  background: var(--ts-surface-card);
  border: 1px solid var(--ts-outline);
  border-radius: var(--ts-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, background .15s;
}
.ts-card:hover { border-color: #cccccc; background: #f4f3f1; }
.ts-card-img { height: 190px; background: var(--ts-surface-card); object-fit: cover; width: 100%; }
.ts-card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.ts-brand-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ts-secondary); }
.ts-price { font-size: 18px; font-weight: 600; }
.ts-source { font-size: 12px; color: #888; }

.btn-ts { background: var(--ts-primary); color: #fff; border-radius: 8px; font-weight: 500; padding: 10px 20px; border: none; }
.btn-ts:hover { opacity: .9; color: #fff; }
.btn-ts-outline { background: transparent; border: 1px solid var(--ts-outline); color: var(--ts-on-surface); border-radius: 8px; padding: 10px 20px; }

/* Material Symbols icons */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* Categories grid */
.ts-slider { -ms-overflow-style: none; scrollbar-width: thin; }
.ts-slider::-webkit-scrollbar { height: 6px; }
.ts-slider::-webkit-scrollbar-thumb { background: var(--ts-outline); border-radius: 3px; }
.ts-cat {
  background: var(--ts-surface-card);
  border: 1px solid var(--ts-outline);
  border-radius: var(--ts-radius);
  padding: 14px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; color: var(--ts-on-surface);
  font-size: 14px; line-height: 18px;
  transition: border-color .15s, background .15s;
}
/* Homepage chips: equal, compact, long French names wrap on two lines */
.ts-slider .ts-cat { flex: 1 1 auto; min-width: 116px; max-width: 220px; }
.ts-cat:hover { border-color: var(--ts-primary); background: #fff; text-decoration: none; }
.ts-cat .ico { font-size: 32px; color: var(--ts-secondary); line-height: 1; }
.ts-cat:hover .ico { color: var(--ts-primary); }

.ts-drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 60; display: none; }
.ts-drawer-backdrop.open { display: block; }
.ts-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 85%; max-width: 360px;
  background: var(--ts-surface); z-index: 61; transform: translateX(100%);
  transition: transform .25s; overflow-y: auto; padding: 20px;
}
.ts-drawer.open { transform: translateX(0); }
.ts-drawer a { display: block; padding: 12px 8px; color: var(--ts-on-surface); border-bottom: 1px solid var(--ts-outline); }
.ts-drawer a:hover { text-decoration: none; color: var(--ts-primary); }

/* Filter boxes */
.ts-filter-box { background: var(--ts-surface-card); border: 1px solid var(--ts-outline); border-radius: var(--ts-radius); }
.ts-filter-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ts-secondary); margin-bottom: 10px; }
.ts-filter-list { list-style: none; padding: 0; margin: 0; }
.ts-filter-list li { margin-bottom: 6px; }
.ts-filter-chk { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--ts-on-surface); }
.ts-filter-chk input { accent-color: var(--ts-primary); }
.ts-range { -webkit-appearance: none; height: 4px; background: var(--ts-outline); border-radius: 2px; }
.ts-range::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: var(--ts-primary); cursor: pointer; margin-top: -6px; }
.ts-filter-scroll { max-height: 180px; overflow-y: auto; padding-right: 6px; }
.ts-filter-scroll::-webkit-scrollbar { width: 6px; }
.ts-filter-scroll::-webkit-scrollbar-thumb { background: var(--ts-outline); border-radius: 3px; }

/* Top search bar on products page */
.ts-searchbar { display: flex; align-items: center; gap: 10px; background: var(--ts-surface-card); border: 2px solid var(--ts-primary); border-radius: 10px; padding: 6px 12px; max-width: 560px; }
.ts-search-ico { color: var(--ts-primary); font-size: 22px; }
.ts-search-input { flex: 1; border: none; background: transparent; outline: none; font-size: 16px; color: var(--ts-on-surface); }
.ts-search-btn { background: var(--ts-primary); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; font-weight: 600; cursor: pointer; }
.ts-search-btn:hover { opacity: .92; }

/* Active filter chips */
.ts-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ts-af-label { color: var(--ts-secondary); font-size: 13px; margin-right: 2px; }
.ts-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--ts-primary); color: var(--ts-on-surface); padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.ts-chip a { color: var(--ts-secondary); text-decoration: none; display: inline-flex; align-items: center; font-size: 14px; line-height: 1; }
.ts-chip a:hover { color: var(--ts-primary); }
.ts-clear-all { color: var(--ts-secondary); font-size: 14px; font-weight: 500; text-decoration: none; margin-left: 4px; }
.ts-clear-all:hover { color: var(--ts-primary); text-decoration: underline; }

.ts-hamburger { font-size: 28px; background: none; border: none; cursor: pointer; color: var(--ts-on-surface); }

/* Language switcher — always visible, compact pills */
.ts-lang { display: inline-flex; align-items: center; gap: 4px; }
.ts-lang-btn {
  background: transparent;
  border: 1px solid var(--ts-outline);
  color: var(--ts-secondary);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 10px;
  white-space: nowrap;
}
.ts-lang-btn:hover { border-color: var(--ts-primary); color: var(--ts-primary); }
.ts-lang-btn.is-current { background: var(--ts-primary); border-color: var(--ts-primary); color: #fff; }
.ts-lang-btn .caret { font-size: 10px; opacity: .6; }

/* Drawer items (agreed menu on top, pages at bottom) */
.ts-drawer-item { display: block; padding: 12px 8px; color: var(--ts-on-surface); border-bottom: 1px solid var(--ts-outline); font-weight: 500; }
.ts-drawer-item:hover { text-decoration: none; color: var(--ts-primary); }
.ts-drawer-page { color: var(--ts-secondary); font-weight: 400; font-size: 14px; }
.ts-drawer-sep { border: none; border-top: 1px dashed var(--ts-outline); margin: 12px 0; }

/* Social icons in footer */
.ts-social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--ts-outline); color: var(--ts-secondary);
  transition: color .15s, border-color .15s;
}
.ts-social:hover { color: var(--ts-primary); border-color: var(--ts-primary); text-decoration: none; }

/* Single product extras (Stitch-like) */
.ts-icon-btn { background: none; border: none; color: var(--ts-secondary); cursor: pointer; padding: 4px; position: relative; }
.ts-icon-btn:hover { color: var(--ts-primary); }
.ts-icon-btn.is-on { color: var(--ts-primary); }
.ts-icon-btn.is-on .material-symbols-outlined { font-variation-settings: 'FILL' 1; }
.ts-tip {
  position: absolute; top: 100%; inset-inline-end: 0; margin-top: 6px;
  background: var(--ts-on-surface); color: #fff;
  font-family: 'Geist', system-ui, sans-serif; font-size: 12px; line-height: 1;
  padding: 6px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.ts-tip.show { opacity: 1; }
.ts-desc p { line-height: 26px; }
html[dir="rtl"] .ts-crumb-sep { transform: scaleX(-1); }
.ts-available-box { background: var(--ts-surface-card); border: 1px solid var(--ts-outline); border-radius: var(--ts-radius); }
.ts-spec-row { border-color: var(--ts-outline) !important; }

/* ---------- Mobile / responsive fixes ---------- */
/* Prevent any horizontal overflow */
body { overflow-x: hidden; }
img, video, iframe { max-width: 100%; height: auto; }

/* About/contact pages: remove fixed paddings that overflow small screens */
.page-content > div, .entry-content > div { max-width: 100% !important; }

/* Footer: text follows the reading direction (right in Arabic, left in French) */
footer .ts-brand, footer .ts-source, footer .fw-semibold { text-align: start; }
footer .fw-semibold { display: block; margin-bottom: 6px; }
footer .ts-social-row { justify-content: flex-start; }

/* Footer link lists: a hairline separator under every link (long names may wrap) */
.ts-foot-list a {
  display: block;
  padding: 6px 0;
  border-bottom: 1px solid #f2f1ef;
  line-height: 16px;
}
.ts-foot-list a:last-child { border-bottom: none; }

@media (max-width: 575.98px) {
  /* Product cards: keep 2 columns (small) but tighten image height */
  .ts-card-img { height: 150px; }
}

/* ---- product gallery (single product) ---- */
/* The frame hugs the photo: no forced aspect-ratio, no grey letterboxing. */
.ts-gallery-main {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ts-outline);
  border-radius: var(--ts-radius);
  background: var(--ts-surface-card);
  overflow: hidden;
}
.ts-gallery-main img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 640px;
  object-fit: contain;
}
.ts-gallery-empty {
  min-height: 240px;
  color: #c9c8c6;
  background: var(--ts-surface-card);
}
.ts-gallery-empty .material-symbols-outlined { font-size: 48px; }

.ts-gallery-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--ts-secondary);
}
.ts-gallery-hint { opacity: .75; }

.ts-gallery-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-bottom: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.ts-thumb {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 1px solid var(--ts-outline);
  border-radius: 10px;
  background: var(--ts-surface-card);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ts-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ts-thumb:hover { border-color: #cccccc; }
.ts-thumb.is-active {
  border-color: var(--ts-primary);
  box-shadow: 0 0 0 2px rgba(255, 165, 0, .25);
}

@media (max-width: 575.98px) {
  .ts-thumb { width: 62px; height: 62px; }
  .ts-gallery-main img { max-height: 420px; }
}

/* Footer text alignment: never stick to one side */
footer .ts-source { text-align: start; }
footer .fw-semibold { display: block; margin-bottom: 6px; }

/* ---------- BottomNavBar (mobile only) ---------- */
.ts-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: none;
  justify-content: space-around;
  align-items: center;
  background: var(--ts-surface-card);
  border-top: 1px solid var(--ts-outline);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.ts-bottombar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 6px 0;
  color: var(--ts-secondary);
  text-decoration: none !important;
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
}
.ts-bottombar-item .material-symbols-outlined { font-size: 24px; }
.ts-bottombar-item:hover, .ts-bottombar-item:active { color: var(--ts-primary); }
.ts-bottombar-item.active { color: var(--ts-primary); font-weight: 600; }

/* Show bottom bar + keep content clear of it — mobile only */
@media (max-width: 767.98px) {
  .ts-bottombar { display: flex; }
  main { padding-bottom: 76px; }
  footer { margin-bottom: 58px; }
}

/* ---------- Brands page ---------- */
/* Cards: one per row on mobile, two columns on desktop */
.ts-brandlist {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 768px) {
  .ts-brandlist { grid-template-columns: 1fr 1fr; }
}
.ts-brand2 {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--ts-surface-card);
  border: 1px solid var(--ts-outline);
  border-radius: var(--ts-radius);
  padding: 16px;
  color: var(--ts-on-surface);
  transition: border-color .15s, background .15s;
}
.ts-brand2:hover { border-color: var(--ts-primary); background: #fff; }
.ts-brand2-logo {
  width: 56px; height: 56px; flex-shrink: 0;
  background: var(--ts-surface);
  border: 1px solid var(--ts-outline);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; color: var(--ts-secondary);
}
.ts-brand2-body { flex: 1; min-width: 0; }
.ts-brand2-name { font-size: 18px; font-weight: 600; margin: 0 0 2px; color: var(--ts-on-surface); }
.ts-brand2-count { font-size: 12px; color: var(--ts-primary-dark); font-weight: 500; }

/* ---------- Categories page ---------- */
.page-cat-grid .ts-cat { height: 100%; }
.page-cat-grid .ts-cat .ts-source { font-size: 12px; }

/* Arabic (RTL) typography — Geist has no Arabic glyphs */
html[dir="rtl"] body,
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4,
html[dir="rtl"] .ts-brand, html[dir="rtl"] .ts-nav-link, html[dir="rtl"] .ts-card-body {
  font-family: "IBM Plex Sans Arabic", Geist, system-ui, -apple-system, sans-serif;
}
