:root {
  --bg: #f6f7f2;
  --ink: #14160f;
  --muted: #6c6f62;
  --accent: #0e7d4f;
  --accent-soft: #e3f0e8;
  --card: #ffffff;
  --line: #e4e6dc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== الهيدر ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand .mark {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -1px;
}

.brand .name {
  display: flex;
  flex-direction: column;
}

.brand .name b { font-size: 18px; font-weight: 800; }
.brand .name span { font-size: 12px; color: var(--muted); font-weight: 500; }

header nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  margin-inline-start: 22px;
  transition: color .15s;
}
header nav a:hover { color: var(--accent); }

/* ===== المحتوى المركزي ===== */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hero {
  text-align: center;
  width: 100%;
  max-width: 560px;
}

.hero .slogan {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.hero .sub {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 28px;
}

/* ===== كرت الباركود ===== */
.barcode-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 40px 30px;
  box-shadow: 0 1px 2px rgba(20,22,15,.04), 0 12px 34px rgba(20,22,15,.07);
  display: inline-block;
}

.barcode-card .label {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 16px;
}

.scanner-box {
  position: relative;
  width: 300px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #10130d;
  aspect-ratio: 1 / 1;
}

#reader {
  width: 100%;
  height: 100%;
}

#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 14px;
}

/* إطار المسح داخل الكاميرا */
#reader__scan_region {
  position: relative;
}
#reader__scan_region img {
  display: none;
}
#qr-shaded-region {
  border-width: 0 !important;
}

.scan-btn {
  display: block;
  margin: 18px auto 0;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 34px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .15s;
}
.scan-btn:hover { background: #0b6a43; }

.scan-result {
  margin-top: 16px;
  font-size: 15px;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid #cfe6d8;
  border-radius: 10px;
  padding: 12px 16px;
}
.scan-result .code {
  font-weight: 800;
  letter-spacing: 1px;
  direction: ltr;
  display: inline-block;
}
.scan-result .note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.barcode-card .hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* ===== البحث ===== */
.search {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 6px 6px 18px;
  box-shadow: 0 1px 2px rgba(20,22,15,.03);
  text-align: right;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  background: transparent;
  color: var(--ink);
  padding: 10px 0;
}

.search input::placeholder { color: var(--muted); }

.search button {
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.search button:hover { background: #0b6a43; }

/* ===== الفوتر ===== */
footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 480px) {
  header { padding: 16px 18px; }
  header nav { display: none; }
  .hero .slogan { font-size: 24px; }
  .barcode-card { padding: 26px 20px 22px; }
  .scanner-box { width: 250px; }
}
