@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn-arabic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn-arabic-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #1c2836;
  --muted: #6b7785;
  --line: #e4ebf1;
  --card: #ffffff;
  --page: #eef3f6;
  --accent: #0f6e66;
  --accent-deep: #0b564f;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(28, 40, 54, .06);
  font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font-family: inherit; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  display: grid;
  justify-items: center;
  gap: 8px;
}
.login-card h1 { font-size: 26px; margin-bottom: 8px; }
.form-stack, .field { display: grid; gap: 8px; width: 100%; }
.form-stack label, .field, .form-grid label { position: relative; display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #f7fafb;
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8fcdc4; background: #fff; box-shadow: 0 0 0 3px rgba(15, 110, 102, .12); }
input[dir="ltr"] { text-align: left; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.button--primary { background: var(--accent); color: #fff; }
.button--primary:hover { background: var(--accent-deep); }
.button--ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.button--wide { width: 100%; }
.button--small { padding: 8px 12px; font-size: 13px; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.text-link {
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.form-error {
  background: #fff1f0;
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
}

.portal { padding-bottom: 28px; }
.topbar, .hero-banner, .catalog, .page-footer {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}
.topbar {
  margin-top: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  min-height: 74px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-user, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 18px; }
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7f5f2;
  color: var(--accent-deep);
  font-weight: 700;
  border: 1px solid #d5ebe6;
}

.hero-banner {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  min-height: 132px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.hero-banner h1 { font-size: clamp(22px, 3vw, 32px); font-weight: 800; }
.hero-copy { display: grid; gap: 8px; }
.hero-unit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #0c4f49;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.7;
}
.hero-unit strong { font-weight: 800; }
.hero-unit span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0f6e66;
  flex: none;
}
.org-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  flex: none;
  background: #fff;
  border-radius: 50%;
}

.catalog {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  min-height: 460px;
  box-shadow: var(--shadow);
}
.catalog-head, .panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.catalog-head h2, .panel-heading h2 { font-size: 20px; }
.toolbar { display: flex; gap: 8px; }
.toolbar input, .toolbar select { width: 160px; padding: 8px 12px; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.course-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  text-align: start;
}
.course-card:hover { border-color: #b7d9d3; box-shadow: var(--shadow); }
.card-visual, .popup-banner {
  background: #d9efe9;
}
.card-visual { height: 132px; overflow: hidden; }
.card-visual[data-tone="1"], .popup-banner[data-tone="1"] { background: linear-gradient(135deg, #d8f3ee, #7dcec3); }
.card-visual[data-tone="2"], .popup-banner[data-tone="2"] { background: linear-gradient(135deg, #e7eefc, #9eb6e6); }
.card-visual[data-tone="3"], .popup-banner[data-tone="3"] { background: linear-gradient(135deg, #f8eee4, #e3c4a4); }
.card-visual[data-tone="4"], .popup-banner[data-tone="4"] { background: linear-gradient(135deg, #e8f6e4, #a9d39a); }
.card-visual img { width: 100%; height: 132px; object-fit: cover; }
.popup-banner img { width: 100%; height: 100%; object-fit: cover; min-height: 100%; }
.card-copy { padding: 14px 16px 16px; display: grid; gap: 6px; }
.card-copy h3 { font-size: 18px; }
.card-copy p, .empty-inline, .muted { color: var(--muted); }
.card-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.card-stats strong { color: var(--ink); font-size: 16px; margin-inline-end: 4px; }
.card-full { margin-top: 8px; font-size: 13px; font-weight: 800; color: #3d2f86; }

.my-requests {
  margin-bottom: 22px;
  padding: 18px 18px 8px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, #f3fbf8 0%, #fff 42%),
    #fff;
  border: 1px solid #b7ddd4;
  box-shadow: 0 10px 28px rgba(15, 92, 86, .06);
}
.my-requests-head { display: grid; gap: 4px; margin-bottom: 14px; }
.my-requests-head h2 { font-size: 24px; font-weight: 800; color: #0c4f49; }
.my-requests-head p { font-size: 16px; font-weight: 700; color: #3d6f68; }
.request-list { display: grid; gap: 10px; }
.request-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #d5ebe6;
  border-inline-start: 6px solid #0f6e66;
  font-size: 16px;
}
.request-row strong { display: block; font-size: 18px; font-weight: 800; color: #16302c; }
.request-row p { color: #3d4b5c; margin-top: 6px; font-size: 16px; font-weight: 700; }
.request-row .request-note {
  margin-top: 8px;
  color: #0b4f49;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.7;
  white-space: pre-wrap;
}
.request-row[data-tone="approved"] { border-inline-start-color: #0f6e66; background: #f4fbf8; }
.request-row[data-tone="pending"] { border-inline-start-color: #b54708; background: #fffaf3; }
.request-row[data-tone="waitlist"] { border-inline-start-color: #7a4dff; background: #f7f4ff; }
.request-row[data-tone="rejected"] { border-inline-start-color: #d92d20; background: #fff6f5; }
.request-row[data-tone="moved"] { border-inline-start-color: #3538cd; background: #f5f6ff; }
.my-requests .empty-inline { font-size: 17px; font-weight: 800; color: #0c4f49; padding: 8px 0 16px; }
.tracking-code { direction: ltr; unicode-bidi: isolate; }
.track-row { display: flex; gap: 8px; margin-top: 12px; }
.track-row input { max-width: 220px; }
.tracking-result { margin-top: 8px; font-size: 14px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 800;
  background: #eef2f6;
  color: #475467;
}
.status--approved, .status--open { background: #e7f6f1; color: #0f6e66; }
.status--pending, .status--limited { background: #fff6e8; color: #b54708; }
.status--waitlist { background: #efeaff; color: #3d2f86; }
.status--rejected, .status--full { background: #fff1f0; color: var(--danger); }
.status--moved { background: #eef2ff; color: #3538cd; }

.page-footer {
  margin-top: 14px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.course-popup {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 28px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(20, 32, 44, .2);
}
.course-popup::backdrop { background: rgba(22, 34, 46, .45); }
.popup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 1fr);
  height: min(640px, calc(100vh - 28px));
  min-height: 520px;
}
.popup-info {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.popup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 24px 16px;
}
.popup-when { color: var(--muted); font-weight: 700; }
.popup-info h2 { font-size: 28px; line-height: 1.5; }
.popup-actions {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.capacity-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.capacity-pair div { background: #f4f7f8; border-radius: 16px; padding: 12px; }
.capacity-pair strong { display: block; font-size: 28px; }
.capacity-pair span { color: var(--muted); font-size: 13px; }
.capacity-pair .is-full strong { color: var(--danger); }
.reserve-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: #f7f4ff;
  border: 1px solid #d9d0ff;
}
.reserve-box h3 { font-size: 18px; font-weight: 800; color: #3d2f86; }
.reserve-box p { font-size: 15px; font-weight: 700; color: #3d4b5c; line-height: 1.8; }
.reserve-done { font-size: 16px; font-weight: 800; color: #3d2f86; }
.popup-facts { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.popup-facts h3 { font-size: 15px; }
.fact-lead { color: #3d4b5c; font-size: 14px; line-height: 1.9; white-space: pre-wrap; }
.fact-list { display: grid; gap: 8px; margin: 0; }
.fact-list div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.fact-list dt { color: var(--muted); font-size: 13px; }
.fact-list dd { margin: 0; font-weight: 700; }
.popup-banner { min-height: 100%; height: 100%; }
.popup-success {
  min-height: 320px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 32px;
}
.success-code {
  direction: ltr;
  font-size: 28px;
  font-weight: 700;
  background: #f4f7f8;
  border-radius: 14px;
  padding: 10px 16px;
}
.dialog-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
  font-size: 20px;
}

.toast {
  position: fixed;
  z-index: 50;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c2836;
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
}

@media (max-width: 800px) {
  .course-grid, .popup-layout, .capacity-pair { grid-template-columns: 1fr; }
  .course-popup {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    height: auto;
    overflow: auto;
  }
  .popup-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .popup-info { height: auto; overflow: visible; }
  .popup-body { overflow: visible; padding: 56px 16px 12px; }
  .popup-banner { min-height: 140px; height: 140px; order: -1; flex: 0 0 auto; }
  .popup-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .popup-info h2 { font-size: 22px; }
  .dialog-close { top: 10px; }
  .request-row { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar input, .toolbar select { width: 100%; }
  .catalog-head, .topbar { align-items: flex-start; flex-direction: column; }
  .catalog { padding: 14px; min-height: 0; }
}
