@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
  --ink: #1f1a2e;
  --ink-soft: #5b5670;
  --line: #e7e1d3;
  --paper: #faf7f0;
  --card: #ffffff;
  --brand: #2a1b4d;
  --brand-2: #3d2a6b;
  --gold: #c9a24b;
  --gold-deep: #a9812e;
  --gold-soft: #f6eddc;
  --ok: #2f7d5b;
  --warn: #b5562a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 26, 46, .06), 0 8px 24px rgba(31, 26, 46, .07);
  --font: "Vazirmatn", "Tahoma", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; display: block; }
a { color: var(--brand-2); }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.container { width: min(1140px, 92vw); margin-inline: auto; }

/* Header */
.site-header {
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand-text { line-height: 1.3; }
.brand-text strong { display: block; font-size: 15px; font-weight: 700; }
.brand-text span { font-size: 12px; opacity: .75; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: #fff; text-decoration: none; opacity: .9; font-size: 14px; }
.nav a:hover { opacity: 1; color: var(--gold); }
.lang-switch {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .4);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.lang-switch:hover { border-color: var(--gold); color: var(--gold); }

/* Hero */
.hero {
  background:
    radial-gradient(900px 300px at 85% -10%, rgba(201, 162, 75, .28), transparent 60%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 72px 0 96px;
}
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.35; margin: 0 0 14px; font-weight: 800; }
.hero p { font-size: clamp(16px, 1.6vw, 18px); opacity: .88; max-width: 62ch; margin: 0 0 28px; }
.eyebrow {
  display: inline-block;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: .04em;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 8px; }
.hero-stats div { font-size: 14px; opacity: .85; }
.hero-stats strong { display: block; font-size: 26px; color: var(--gold); font-weight: 800; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid rgba(201, 162, 75, .55); outline-offset: 2px; }
.btn-gold { background: var(--gold); color: var(--brand); box-shadow: 0 6px 18px rgba(201, 162, 75, .35); }
.btn-gold:hover { background: #d6b260; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-2); }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* Sections and cards */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 26px; font-weight: 800; color: var(--brand); }
.section-head p { margin: 4px 0 0; color: var(--ink-soft); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.opp-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; transition: transform .2s ease, box-shadow .2s ease; }
.opp-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(31, 26, 46, .12); }
.opp-card h3 { margin: 0; font-size: 19px; color: var(--brand); line-height: 1.5; }
.opp-card p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.opp-card .meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.opp-card .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--brand-2); font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold-deep);
}
.badge.invite { background: #ece6f7; color: var(--brand-2); }
.badge.closed { background: #efedf3; color: var(--ink-soft); }
.chip {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Filters */
.filters {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr repeat(3, 1fr);
  margin-top: -56px;
  position: relative;
  box-shadow: var(--shadow);
}
.filters label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.control {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 75, .2); }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); grid-column: 1 / -1; }

/* Opportunity detail */
.page-hero { background: var(--brand); color: #fff; padding: 48px 0 72px; }
.page-hero h1 { margin: 8px 0 10px; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.4; }
.page-hero p { margin: 0; opacity: .85; max-width: 70ch; }
.crumbs { font-size: 14px; opacity: .85; }
.crumbs a { color: #fff; }
.layout { display: grid; gap: 24px; grid-template-columns: 2fr 1fr; margin-top: -40px; align-items: start; }
.prose { color: var(--ink); white-space: pre-line; font-size: 16px; }
.prose-block + .prose-block { margin-top: 24px; }
.prose-block h3 { margin: 0 0 8px; font-size: 18px; color: var(--brand); }
.facts { display: grid; gap: 14px; margin: 0; }
.fact dt { font-size: 13px; color: var(--ink-soft); }
.fact dd { margin: 2px 0 0; font-weight: 600; }
.share { display: grid; gap: 10px; }
.share .btn { width: 100%; }
.share-note { font-size: 13px; color: var(--ink-soft); margin: 0; }
.sticky { position: sticky; top: 90px; }

/* Forms */
.form-wrap { margin-top: -40px; display: grid; gap: 24px; grid-template-columns: 1fr 300px; align-items: start; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.form-section { border: 0; padding: 0; margin: 0 0 32px; min-width: 0; }
.form-section legend { font-size: 18px; font-weight: 800; color: var(--brand); padding: 0 0 10px; margin-bottom: 16px; border-bottom: 2px solid var(--gold-soft); width: 100%; }
.fields { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.field .req { color: var(--warn); }
.field .error { display: none; color: var(--warn); font-size: 13px; margin-top: 4px; }
.field.invalid .control { border-color: var(--warn); background: #fff8f5; }
.field.invalid .error { display: block; }
.ltr { direction: ltr; text-align: left; }
textarea.control { min-height: 110px; resize: vertical; }
.checks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.check {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #fff; font-size: 15px;
}
.check:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.check input { accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.upload { border: 2px dashed #d6cdb7; border-radius: 12px; padding: 18px; background: #fdfbf6; }
.upload input[type="file"] { width: 100%; }
.upload small { display: block; color: var(--ink-soft); margin-top: 6px; font-size: 12px; }
.consent { display: grid; gap: 10px; }
.consent .check { align-items: flex-start; }
.honeypot { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.alert { padding: 14px 16px; border-radius: 12px; font-size: 15px; margin-bottom: 16px; }
.alert.error { background: #fbeee8; color: var(--warn); border: 1px solid #f1cdbd; }
.alert.ok { background: #e8f4ee; color: var(--ok); border: 1px solid #bfe0cf; }
.success-box { text-align: center; padding: 40px 20px; }
.success-box .ref {
  display: inline-block; margin: 12px 0; padding: 10px 18px; background: var(--gold-soft);
  border-radius: 10px; font-weight: 800; letter-spacing: .05em; font-size: 18px; color: var(--brand); direction: ltr;
}
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); transition: width .3s ease; }

/* Footer */
.site-footer { background: var(--brand); color: rgba(255, 255, 255, .8); padding: 36px 0; margin-top: 64px; font-size: 14px; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--gold); }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 70px); }
.admin-side { background: #fff; border-inline-end: 1px solid var(--line); padding: 20px 14px; }
.admin-side button {
  display: block; width: 100%; text-align: start; background: transparent; border: 0; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; color: var(--ink); font-size: 15px; margin-bottom: 4px;
}
.admin-side button.active, .admin-side button:hover { background: var(--gold-soft); color: var(--brand); font-weight: 700; }
.admin-main { padding: 28px; min-width: 0; }
.admin-main h2 { margin: 0 0 16px; color: var(--brand); font-size: 22px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
th { background: #fbf9f4; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fcfaf5; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .control { width: auto; min-width: 180px; }
.login-box { max-width: 380px; margin: 80px auto; }
.detail-grid { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.detail-grid dl { margin: 0; display: grid; gap: 12px; }
.detail-grid dt { font-size: 13px; color: var(--ink-soft); }
.detail-grid dd { margin: 2px 0 0; white-space: pre-line; word-break: break-word; }
.file-link {
  display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; margin: 4px 4px 4px 0;
  border: 1px solid var(--line); border-radius: 10px; text-decoration: none; background: #fff; color: var(--brand);
}

@media (max-width: 900px) {
  .layout, .form-wrap, .detail-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; margin-top: -40px; }
  .sticky { position: static; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { display: flex; gap: 6px; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .admin-side button { white-space: nowrap; width: auto; margin: 0; }
}
@media (max-width: 640px) {
  .nav a.hide-sm { display: none; }
  .fields { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .form-card { padding: 20px; }
  .hero { padding: 48px 0 80px; }
  .brand-text span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* v3 additions: date picker, notices, wide checkboxes */
.datepicker { display: block; }
.datepicker .dp-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1.4fr 1fr 1fr; direction: rtl; }
.datepicker select.control { padding-inline: 10px; }
.check-wide { width: 100%; }
.notice {
  background: #fbf6e9; border: 1px solid #ecdcb0; color: #6b4f14; border-radius: 12px;
  padding: 12px 14px; font-size: 14px; line-height: 1.8; margin-bottom: 12px;
}
.teaching-block { border-top: 2px dashed var(--line); padding-top: 20px; }
@media (max-width: 640px) {
  .datepicker .dp-grid { grid-template-columns: 1fr 1fr; }
}

/* Admin login */
.login-box { max-width: 380px; margin: 72px auto; padding: 32px 28px; }
.login-title { margin: 0 0 22px; color: var(--brand); font-size: 22px; font-weight: 800; }
.login-field { margin-bottom: 16px; }
.login-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.login-submit { width: 100%; margin-top: 8px; padding: 13px; }

/* Print dialog */
.modal-backdrop { position: fixed; inset: 0; background: rgba(31, 26, 46, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border-radius: 18px; width: min(560px, 100%); padding: 26px 26px 22px; box-shadow: 0 24px 60px rgba(31, 26, 46, .25); border: 1px solid var(--line); }
.modal-card h3 { margin: 0; color: var(--brand); font-size: 20px; font-weight: 800; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
#print-groups .check { font-size: 14px; padding: 9px 11px; }
