/* ============================================================
   VWBP — Design tokens & base styles
   Mobile-first, no framework. Logical properties used where it
   costs nothing so the layout stays easy to mirror for RTL later.
   ============================================================ */
:root {
  --teal:       #0F766E;
  --teal-dark:  #0B5B54;
  --teal-light: #E6F4F2;
  --ink:        #111827;
  --gold:       #C9974D;
  --gold-dark:  #A8793A;
  --bg:         #F8F7F4;
  --card:       #FFFFFF;
  --border:     #E5E2DA;
  --muted:      #6B7280;
  --success:    #16A34A;
  --success-bg: #EAF7EE;
  --danger:     #DC2626;
  --danger-bg:  #FDECEA;
  --warn:       #B45309;
  --warn-bg:    #FEF3E2;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(17,24,39,.06), 0 1px 2px rgba(17,24,39,.08);
  --shadow-lg:  0 8px 24px rgba(17,24,39,.10);
  --font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
img { max-width: 100%; display: block; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.container { max-width: 1120px; margin-inline: auto; padding-inline: 1.25rem; }
.section { padding-block: clamp(2.5rem, 2rem + 2vw, 4.5rem); }
.section--alt { background: #fff; border-block: 1px solid var(--border); }
.text-center { text-align: center; }
.grid { display: grid; gap: 1.5rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row--between { justify-content: space-between; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.3rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; background: var(--teal); color: #fff;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { background: var(--teal-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--gold { background: var(--gold); }
.btn--gold:hover { background: var(--gold-dark); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--ghost:hover { background: #f3f2ee; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #b91c1c; }
.btn--sm { padding: .4rem .9rem; font-size: .82rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--active { background: var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.card--pad-lg { padding: 2rem; }
.card-list .card { margin-block-end: 1rem; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-block: .9rem .3rem; }
input, select, textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 8px;
  font-size: .95rem; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: .8rem; color: var(--muted); margin-block-start: .25rem; }
.form-error { font-size: .8rem; color: var(--danger); margin-block-start: .25rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: .5rem; }
.checkbox-row input { width: auto; margin-block-start: .3rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; }
legend { font-weight: 700; padding-inline: .4rem; }

/* Honeypot field — present in the DOM/tab order for bots, hidden from sighted users */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Alerts / badges ---------- */
.alert { padding: .8rem 1rem; border-radius: 8px; margin-block-end: 1rem; font-size: .92rem; }
.alert--success { background: var(--success-bg); color: #166534; }
.alert--error   { background: var(--danger-bg); color: #991b1b; }
.alert--warn    { background: var(--warn-bg); color: #92400e; }
.alert--info    { background: var(--teal-light); color: var(--teal-dark); }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge--success { background: var(--success-bg); color: #166534; }
.badge--warn    { background: var(--warn-bg); color: #92400e; }
.badge--danger  { background: var(--danger-bg); color: #991b1b; }
.badge--muted   { background: #eee; color: var(--muted); }
.badge--teal    { background: var(--teal-light); color: var(--teal-dark); }

/* ---------- Nav / header ---------- */
.site-header { background: #fff; border-block-end: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding-block: .85rem; gap: 1rem; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); display: inline-block; }
.main-nav { display: flex; gap: 1.4rem; align-items: center; }
.main-nav a { color: var(--ink); font-weight: 600; font-size: .93rem; }
.main-nav a:hover { color: var(--teal); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav { position: absolute; inset-inline: 0; top: 100%; background: #fff; flex-direction: column;
    align-items: stretch; padding: 1rem 1.25rem; border-block-end: 1px solid var(--border); display: none; gap: .3rem; }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: .6rem 0; border-block-end: 1px solid #f1f0ec; }
}

/* ---------- Hero ---------- */
.hero { background: linear-gradient(160deg, var(--teal-dark), var(--teal) 70%); color: #fff; padding-block: clamp(3rem, 2.5rem + 3vw, 6rem); }
.hero h1 { color: #fff; }
.hero p { color: #E6F4F2; max-width: 640px; font-size: 1.1rem; }
.hero .row { margin-block-start: 1.5rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #cbd5d1; padding-block: 2.5rem; margin-block-start: 3rem; }
.site-footer a { color: #fff; }
.site-footer .grid { margin-block-end: 1.5rem; }
.site-footer h4 { color: #fff; font-size: .95rem; }
.footer-bottom { border-block-start: 1px solid #2a2f31; padding-block-start: 1rem; font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .7rem; text-align: start; border-block-end: 1px solid var(--border); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
tbody tr:hover { background: #fafaf8; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap table { margin: 0; }
.table-wrap th, .table-wrap td { padding: .8rem 1rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; margin-block-start: 1.2rem; }
.pagination-links { display: flex; gap: .3rem; flex-wrap: wrap; }
.pagination-links .btn { padding: .35rem .75rem; font-size: .85rem; }

/* ---------- Admin shell ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; flex-shrink: 0; background: var(--ink); color: #cbd5d1; padding: 1.2rem 1rem; }
.admin-sidebar .brand { color: #fff; margin-block-end: 1.5rem; }
.admin-sidebar a { display: block; color: #cbd5d1; padding: .5rem .7rem; border-radius: 8px; font-size: .9rem; margin-block-end: .15rem; }
.admin-sidebar a:hover, .admin-sidebar a.is-active { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.admin-sidebar .group-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #8a9490; margin: 1rem .7rem .3rem; }
.admin-main { flex: 1; min-width: 0; }
.admin-topbar { background: #fff; border-block-end: 1px solid var(--border); padding: .9rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.admin-content { padding: 1.5rem; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.stat-card .num { font-size: 1.9rem; font-weight: 800; color: var(--teal-dark); }
.stat-card .label { font-size: .82rem; color: var(--muted); }

/* The admin sidebar stays permanently visible at every width (never auto-hides).
   admin-main already shrinks (min-width:0) and its tables scroll internally
   (.table-wrap), so no special narrow-viewport handling is needed here. */

/* ---------- Cookie consent ---------- */
.cookie-banner {
  position: fixed; inset-inline: 0; bottom: 0; background: var(--ink); color: #fff; padding: 1rem 1.25rem;
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; z-index: 100; box-shadow: 0 -4px 16px rgba(0,0,0,.15);
}
.cookie-banner p { margin: 0; flex: 1; min-width: 240px; font-size: .88rem; color: #e5e7eb; }

/* ---------- Utility ---------- */
.qr-box { background: #fff; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); display: inline-block; }
.certificate-frame { border: 3px solid var(--gold); border-radius: var(--radius); padding: 2rem; background: #fff; }

/* ---------- Language switcher ---------- */
.lang-switch { display: flex; gap: .3rem; font-size: .82rem; font-weight: 700; }
.lang-switch a { padding: .25rem .55rem; border-radius: 6px; color: var(--muted); }
.lang-switch a.is-active { background: var(--teal-light); color: var(--teal-dark); }
.admin-sidebar .lang-switch a { color: #9aa6a1; }
.admin-sidebar .lang-switch a.is-active { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- RTL (Arabic) ----------
   Logical properties (margin-inline, inset-inline, text-align:start, etc.)
   already used throughout this file flip automatically under dir="rtl" —
   only physical-property exceptions need explicit overrides here. */
:root[dir="rtl"] body { font-family: "Segoe UI", Tahoma, Geneva, Arial, var(--font); }
