/* Dzstorex storefront styles.
 *
 * Mobile-first: the base rules target a phone, and the only media query widens
 * to a two-column layout on a large screen. Algerian shoppers are overwhelmingly
 * on a phone, usually on mobile data, so the page ships no framework, no web
 * fonts and no build step - it is hand-written HTML, CSS and one small JS file.
 *
 * Design intent: product-focused. Name, photo, price, availability, order. The
 * availability check is the loudest control on the page because it is the thing
 * that makes the price trustworthy.
 */

:root {
  --green: #006233;
  --green-dark: #004d29;
  --green-soft: #e8f3ec;
  --ink: #14181c;
  --muted: #5b6b73;
  --line: #dde4e7;
  --bg: #f6f8f8;
  --card: #ffffff;
  --amber: #b26a00;
  --amber-soft: #fdf3e3;
  --red: #b3261e;
  --red-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 24, 28, .08), 0 6px 18px rgba(20, 24, 28, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  /* Stops iOS Safari zooming when a field is focused. */
}

img { max-width: 100%; display: block; }

a { color: var(--green); }

/* ---- layout -------------------------------------------------------------- */

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 14px; }

header.site {
  background: var(--green);
  color: #fff;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

header.site .brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .2px;
}

header.site .tagline {
  font-size: 12px;
  opacity: .85;
  font-weight: 400;
  display: block;
}

main { padding: 16px 0 48px; }

footer.site {
  border-top: 1px solid var(--line);
  padding: 18px 0 32px;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
}

/* ---- cards --------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  main { padding-top: 24px; }
}

@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- product card -------------------------------------------------------- */

.product {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.product .thumb {
  aspect-ratio: 1 / 1;
  background: var(--green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product .thumb img { width: 100%; height: 100%; object-fit: cover; }

.product .thumb .noimg {
  font-size: 34px;
  color: var(--green);
  opacity: .5;
}

.product .body { padding: 10px 12px 12px; display: flex; flex-direction: column;
  gap: 6px; flex: 1; }

.product .name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product .price {
  font-weight: 700;
  color: var(--green);
  font-size: 16px;
  margin-top: auto;
}

/* ---- badges -------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .2px;
  white-space: nowrap;
}

.badge.ok       { background: var(--green-soft); color: var(--green-dark); }
.badge.warn     { background: var(--amber-soft); color: var(--amber); }
.badge.bad      { background: var(--red-soft);   color: var(--red); }
.badge.neutral  { background: #eef1f2;          color: var(--muted); }

/* ---- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;              /* comfortable touch target on a phone */
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.btn:hover:not(:disabled) { background: var(--green-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn.secondary {
  background: #fff;
  color: var(--green-dark);
  border: 2px solid var(--green);
}

.btn.secondary:hover:not(:disabled) { background: var(--green-soft); }

.btn.danger { background: var(--red); }

.btn.small { min-height: 38px; font-size: 14px; padding: 8px 12px;
  width: auto; }

/* ---- product detail ------------------------------------------------------ */

.detail { display: grid; gap: 16px; }

@media (min-width: 860px) {
  .detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

.gallery img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--green-soft);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin-bottom: 8px;
}

h1 { font-size: 20px; line-height: 1.3; margin: 0 0 6px; }

.price-big {
  font-size: 27px;
  font-weight: 800;
  color: var(--green);
  margin: 10px 0 2px;
}

.price-note { font-size: 12px; color: var(--muted); }

.spec { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

/* ---- availability panel -------------------------------------------------- */

.avail {
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
  background: #fff;
}

.avail.ok    { border-left-color: var(--green); background: var(--green-soft); }
.avail.warn  { border-left-color: var(--amber); background: var(--amber-soft); }
.avail.bad   { border-left-color: var(--red);   background: var(--red-soft); }
.avail.busy  { border-left-color: var(--amber); }

.avail .title { font-weight: 700; margin-bottom: 3px; }
.avail .sub { font-size: 13px; color: var(--muted); }
.avail.ok .sub { color: var(--green-dark); }
.avail.bad .sub { color: #7a1c16; }
.avail.warn .sub { color: #7a4a00; }

.spinner {
  width: 15px; height: 15px;
  border: 2.5px solid var(--amber);
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* ---- forms --------------------------------------------------------------- */

label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;            /* >=16px stops the iOS zoom-on-focus */
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
  border-color: var(--green);
}

textarea { min-height: 84px; resize: vertical; }

.field-error input, .field-error select { border-color: var(--red); }

.err {
  color: var(--red);
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

/* The message div is a SIBLING of the field, not a descendant, so it is shown
   by toggling its own class rather than by nesting selectors. */
.err.show { display: block; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; }
.check input { width: 22px; min-height: 22px; margin-top: 2px; flex: 0 0 auto; }
.check label { margin: 0; font-weight: 400; font-size: 14px; }

/* Honeypot: off-screen but present in the DOM, so a human never sees it. */
.hp {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.notice {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 12px 0;
}

.notice.ok   { background: var(--green-soft); color: var(--green-dark);
  border: 1px solid #b9dcc7; }
.notice.bad  { background: var(--red-soft);   color: var(--red);
  border: 1px solid #f2c4c0; }
.notice.warn { background: var(--amber-soft); color: var(--amber);
  border: 1px solid #f0dcb8; }

/* ---- misc ---------------------------------------------------------------- */

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hidden { display: none !important; }

.skeleton {
  background: linear-gradient(90deg, #eef1f2 25%, #f7f9f9 37%, #eef1f2 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--radius);
}

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- dashboard (desktop-leaning, still usable on a phone) ---------------- */

table.dash {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.dash th, table.dash td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.dash th { font-weight: 700; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .3px; }

table.dash tr:hover td { background: #fafbfb; }

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--muted); font-weight: 700; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; }
.stat .s { font-size: 11px; color: var(--muted); }

.tabs { display: flex; gap: 6px; margin: 14px 0; overflow-x: auto; }
.tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--green); color: #fff;
  border-color: var(--green); }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
