/* Basic modern, responsive styles inspired by NextStep Fair */
:root {
    color-scheme: light;
    --brand:#ec4899; --brand2:#be185d;
    --ink:#111; --bg:#ffffff; --muted:#666;
    --btn-grad-start:#ec4899; --btn-grad-end:#be185d;
  }

* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
    margin: 0;
    font-family: 'Vazirmatn', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    color: #111;
    background: #ffffff;
}
img, video, iframe { max-width: 100%; height: auto; display: block; }

  /* Kurdish font continuity */
  html[lang="ku"] body,
  html[lang="ku"] input,
  html[lang="ku"] select,
  html[lang="ku"] textarea,
  html[lang="ku"] button {
    font-family: 'Vazirmatn', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

  /* Nav */
.nav { position: sticky; top: 0; z-index: 10; background: #111; border-bottom: 1px solid #222; direction: ltr; width: 100%; overflow-x: hidden; }
  .nav-inner { max-width: 1100px; margin: 0 auto; padding: 24px clamp(20px, 4vw, 32px); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
  .logo { display: flex; align-items: center; gap: 1rem; }
  .logo-img, .pdi-logo { height: clamp(28px, 2.8vw, 36px); width: auto; display: block; }
  .ksa-logo { height: clamp(48px, 5vw, 56px); width: auto; display: block; filter: brightness(0) invert(1); }
  .secondary-logos { display: flex; align-items: center; gap: 12px; }
  .lang-switch { display: flex; gap: 8px; margin-left: auto; }
  .lang-btn {
    background: #666; color: #fff; border: none;
    padding: 6px 10px; border-radius: 10px; cursor: pointer;
    font-weight: 800; letter-spacing: .5px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2);
    font-size: clamp(.78rem, 1.6vw, .9rem); line-height: 1; min-width: 44px; text-align: center;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  }
  .lang-btn[aria-current="true"] { background: #b04aa3; color: #fff; }
  html[lang="ku"] .lang-btn { font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; }
  
  /* Mobile nav stacking */
@media (max-width: 480px) {
    .nav-inner { padding: 12px 16px; justify-content: space-between; gap: 16px; }
    .logo { flex-direction: column; align-items: flex-start; gap: 8px; }
    .logo-img, .pdi-logo { height: 22px; }
    .ksa-logo { height: 36px; filter: brightness(0) invert(1); }
  .lang-switch { gap: 8px; }
  .lang-btn { padding: 6px 10px; min-width: auto; font-size: 0.8rem; }
}

  /* Banner / layout */
.banner { background: #f6a3d1 url('pink-gradient-background.jpg') center center / cover no-repeat; width: 100%; min-height: 50vh; border-bottom: 1px solid #e189bd; }
.page { max-width: min(960px, 100% - clamp(24px, 6vw, 64px)); margin: 0 auto; padding: clamp(16px, 3vw, 24px); }
  .card {
    background: #fff; color: #222; border: 1px solid #eee; border-radius: 20px;
    padding: clamp(16px, 3.5vw, 28px);
    box-shadow: 0 28px 70px rgba(186,68,152,.25), 0 16px 40px rgba(0,0,0,.12);
    margin-top: -20vh; position: relative; z-index: 2;
  }
@media (max-width: 600px) { .card { margin-top: -12vh; } }
@media (min-width: 1024px) and (max-width: 1366px) {
    .banner { width: 100%; margin: 96px 0 0; padding-top: 80px; min-height: 440px; background-position: center top; background-size: cover; border-radius: 0; }
  .page { max-width: 1100px; margin-inline: auto; padding: 24px; }
  .card { max-width: 1040px; margin-inline: auto; }
  }

  /* Heading utilities */
.register-heading { text-align: center; font-size: clamp(2rem, 3.6vw, 2.8rem); margin: 36px 0 clamp(72px, 9vw, 96px); font-weight: 800; letter-spacing: .5px; word-spacing: 2px; line-height: 1.25; }
html[dir="rtl"] .register-heading { letter-spacing: 0; word-spacing: 3px; }
  
  /* Institution header in form */
  .institution-header-form {
    display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0); border-radius: 12px; border: 2px solid #e5e7eb;
  }
  .institution-logo-form { width: 50px; height: 50px; object-fit: contain; border-radius: 8px; background: #ffffff; padding: 0.25rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); flex-shrink: 0; }
  .institution-info-form { flex: 1; }
  .institution-name-form { font-size: 1.5rem; font-weight: 800; color: #1f2937; margin: 0 0 0.25rem; line-height: 1.2; }
  .institution-type-form { display: inline-block; background: linear-gradient(135deg, #ec4899, #be185d); color: white; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.875rem; font-weight: 600; }
  .register-heading { text-align: left; color: #6b7280; margin-bottom: 0.125rem; font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
  
  /* Basic grids */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid.two-col { grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid.two-col { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.span-2 { grid-column: span 1; }
@media (min-width: 720px) { .span-2 { grid-column: span 2; } }

  /* Generic form styles */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 600; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
  .form-group input[type="number"],
  .form-group input[type="date"],
.form-group select,
.form-group textarea {
    appearance: none; border: 1px solid #ddd; background: #ffffff; color: #111;
    border-radius: 10px; padding: 12px 14px; font: inherit;
  }
  /* Dropdown arrow for select elements */
  .form-group select,
  select.select-with-arrow {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
  }
  html[dir="rtl"] .form-group select,
  html[dir="rtl"] select.select-with-arrow {
    background-position: left 12px center;
    padding-left: 36px;
    padding-right: 12px;
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: 2px solid color-mix(in oklab, var(--brand) 60%, transparent); outline-offset: 1px;
  }
  
  /* Checkbox helpers */
  .form-group.checkbox { display: inline-flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px; margin: 0; padding: 0; }
  .form-group.checkbox input[type="checkbox"] { margin: 0; }
  .form-group.checkbox span { flex: 1 1 auto; overflow-wrap: anywhere; }
  [dir="rtl"] .form-group.checkbox { flex-direction: row-reverse; }
  
  /* Application Form - compact layout */
  .application-form {
    --space-2: 6px; --space-3: 10px; --space-4: 14px;
    --space-5: 18px; --space-6: 22px; --space-8: 32px;
    --radius-8: 8px; --radius-10: 10px; --border: #e5e7eb;
    --muted: #6b7280; --fg: #1f2937; --brand: #ec4899; --brand-dark: #be185d;
    --field-h: 44px; --field-h-sm: 40px;
  }
  .application-form .section-title {
    margin: 0 0 var(--space-3) 0; font-weight: 700; color: var(--fg);
    font-size: 1.05rem; line-height: 1.3; position: relative;
  }
  .application-form .section-title::after {
    content: ""; display: block; width: 120px; height: 3px; margin-top: var(--space-2);
    border-radius: 2px; background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  }
  .application-form .form-section { padding-block: var(--space-4); border-top: 0; }
  .application-form .form-grid { display: grid; gap: var(--space-3); }
  
  /* Academic landscape layout */
  .application-form .form-section--academic { --label-w: 168px; }
  .application-form .form-section--academic .form-grid.two-col {
    /* grid columns defined by media query below */
  }
  @media (min-width: 768px) {
    .application-form .form-section--academic .form-grid.two-col {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: 18px;
      row-gap: 10px;
      align-items: start;
    }
  }
  .application-form .form-section--academic .form-field {
    display: grid;
    grid-template-columns: var(--label-w) minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-2);
  }
  .application-form .form-section--academic .form-field.span-2 { grid-column: 1 / -1; }
  @media (max-width: 640px) {
    .application-form .form-section--academic .form-grid.two-col { grid-template-columns: 1fr; }
    .application-form .form-section--academic .form-field {
      grid-template-columns: 1fr;
      row-gap: var(--space-2);
      align-items: start;
    }
  }
  .application-form input[type="text"],
  .application-form input[type="email"],
  .application-form input[type="tel"],
  .application-form input[type="number"],
  .application-form input[type="date"],
  .application-form select,
  .application-form textarea {
    height: var(--field-h); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-10);
    font-size: 0.95rem; line-height: 1.2;
  }
  .application-form textarea { min-height: 110px; padding: 10px 12px; }
  .application-form .form-section--academic input[type="text"],
  .application-form .form-section--academic input[type="number"],
  .application-form .form-section--academic select {
    height: var(--field-h-sm); font-size: 0.93rem;
  }
  
  /* Terms checkbox (LTR/RTL, professional layout) */
.application-form .form-group.checkbox.checkbox-row {
    display: grid !important;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
  }
  .application-form .form-group.checkbox.checkbox-row input[type="checkbox"] {
    grid-column: 1;
    width: 18px;
    height: 18px;
    margin: 2px 0 0 0;
    accent-color: var(--brand, #ec4899);
  }
  .application-form .form-group.checkbox.checkbox-row span {
    grid-column: 2;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.35;
    text-align: left;
  }
  
  /* RTL: put the tick-box at the right, at the start of the line */
  [dir="rtl"] .application-form .form-group.checkbox.checkbox-row {
    grid-template-columns: 1fr auto;
    text-align: right;
  }
  [dir="rtl"] .application-form .form-group.checkbox.checkbox-row input[type="checkbox"] {
    grid-column: 2;
  }
  [dir="rtl"] .application-form .form-group.checkbox.checkbox-row span {
    grid-column: 1;
    text-align: right;
  }
  
  /* Keep 48px targets on touch devices */
  @media (pointer: coarse) {
    .application-form input[type="text"],
    .application-form input[type="email"],
    .application-form input[type="tel"],
    .application-form input[type="number"],
    .application-form input[type="date"],
    .application-form select { height: 48px; }
  }
  
  /* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn { appearance: none; border: 1px solid color-mix(in oklab, var(--ink) 12%, transparent); background: var(--bg); color: var(--ink); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; text-decoration: none; }
  .btn.primary {
    background: linear-gradient(135deg, var(--btn-grad-start) 0%, color-mix(in oklab, var(--btn-grad-start) 80%, var(--btn-grad-end)) 75%, var(--btn-grad-end) 100%);
    color: #fff; border-color: color-mix(in oklab, #000 20%, transparent); box-shadow: 0 6px 18px rgba(111,61,233,.22);
  }
.btn.primary:hover { filter: brightness(1.02); box-shadow: 0 8px 22px rgba(111,61,233,.28); }
.btn.primary:active { filter: brightness(0.98); }
.btn.btn-secondary { background: #f4effa; color: #553c9a; border-color: #e2d3ec; }
.btn.btn-secondary:hover { background: #ebe3fb; }
  
  /* Admin, search, login, tables (preserved) */
.admin-wrap{max-width:1300px;margin:24px auto;padding:0 16px}
.table-wrap{width:100%;overflow:auto;border:1px solid #eee;border-radius:12px;background:#fff}
.admin-table{width:100%;border-collapse:separate;border-spacing:0;min-width:100%;font-size:13.5px;line-height:1.2}
.admin-table th,.admin-table td{border-bottom:1px solid #eee;padding:6px 8px;text-align:left;vertical-align:top}
.admin-table thead th{position:sticky;top:0;background:#fafafa;z-index:1}
.admin-table tbody tr:nth-child(odd){background:#fcfcfd}
.admin-table th:first-child,.admin-table td:first-child{border-top-left-radius:12px}
.admin-table th:last-child,.admin-table td:last-child{border-top-right-radius:12px}
.ellipsis{max-width:360px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;vertical-align:bottom}
.badge{display:inline-block;border-radius:9999px;padding:4px 10px;font-size:12px;font-weight:700}
.badge.approved{background:#e6f7ee;color:#1c7f4e}
.badge.denied{background:#fdecea;color:#9b1c1c}
.badge.pending{background:#f2f2f2;color:#444}
.unstyled-link{color:inherit;text-decoration:none}
.filter-box{display:flex;gap:8px;align-items:center;flex-wrap:wrap;background:#fafafa;border:1px solid #eee;border-radius:12px;padding:10px 12px}
.inline{display:inline}
.searchbar{position:relative;display:flex;align-items:center}
.searchbar .icon{position:absolute;left:12px;inset-block:auto;color:#777;pointer-events:none}
.searchbar input[type="search"]{padding:10px 12px 10px 36px;border:1px solid #ddd;border-radius:9999px;min-width:280px;width:100%;height:40px;box-shadow:0 1px 2px rgba(0,0,0,.04);transition:box-shadow .15s ease,border-color .15s ease}
.searchbar input[type="search"]:focus{outline:none;border-color:#c6b7d8;box-shadow:0 0 0 3px rgba(176,74,163,.12)}
.searchbar svg{width:18px;height:18px}
.login-container{max-width:400px;margin:60px auto;padding:32px;background:#fff;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,0.1)}
.login-title{text-align:center;margin-bottom:24px;color:#111;font-size:24px;font-weight:700}
.form-group input{width:100%;padding:12px;border:2px solid #ddd;border-radius:8px;font-size:16px;transition:border-color .2s}
.form-group input:focus{outline:none;border-color:#c02383}
.login .btn{width:100%}
.error{color:#dc3545;font-size:14px;margin-top:4px}
.back-link{text-align:center;margin-top:20px}
.back-link a{color:#666;text-decoration:none}
.back-link a:hover{color:#c02383}

  /* Tabs */
  .tab-list{display:flex;align-items:stretch;overflow-x:auto;overflow-y:hidden;white-space:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .tab-list::-webkit-scrollbar{display:none}
  .tab-list .tab{flex-shrink:0!important}
  @media (min-width:521px) and (max-width:768px){.tab-list{overflow-x:auto!important;overflow-y:hidden}.tab-list .tab{flex-shrink:0!important;min-width:max-content}}
  @media (min-width:768px) and (max-width:991px){.tab-list{white-space:nowrap!important;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch;scrollbar-width:none}.tab-list::-webkit-scrollbar{display:none}.tab-list .tab{flex:0 0 auto;min-height:52px;display:flex;align-items:center;justify-content:center;text-align:center;line-height:1.3;padding:8px 12px}}

/* --- Terms checkbox: robust LTR/RTL using CSS Grid --- */
label.form-group.checkbox.checkbox-row {
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}
label.form-group.checkbox.checkbox-row input[type="checkbox"] {
  grid-column: 1;
  width: 18px;
  height: 18px;
  margin: 2px 0 0 0;
  accent-color: var(--brand, #ec4899);
}
label.form-group.checkbox.checkbox-row span {
  grid-column: 2;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.35;
  text-align: left;
}

/* RTL: put the tick-box at the right, at the start of the line */
[dir="rtl"] label.form-group.checkbox.checkbox-row {
  grid-template-columns: 1fr auto !important;
  text-align: right;
}
[dir="rtl"] label.form-group.checkbox.checkbox-row input[type="checkbox"] {
  grid-column: 2 !important;
  justify-self: end;
}
[dir="rtl"] label.form-group.checkbox.checkbox-row span {
  grid-column: 1 !important;
  text-align: right;
}

/* Neutralize older RTL flex rule that might fight the grid */
[dir="rtl"] .form-group.checkbox { flex-direction: initial !important; }

/* --- Buttons: professional, consistent sizing and layout --- */
.actions {
    display: flex;
  align-items: center;
  justify-content: center;  /* center the group (no huge gaps) */
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;            /* consistent height */
  padding: 0 20px;         /* horizontal padding only */
  border-radius: 14px;
  font-weight: 700;
  line-height: 1;          /* crisp vertical alignment */
  min-width: 168px;        /* balanced width */
}
.actions .back-btn {
  background: #f3f4f6;
  color: #111;
  border: 1px solid #e5e7eb;
}
.actions .btn.primary {
  background: linear-gradient(135deg, var(--btn-grad-start, #ec4899), var(--btn-grad-end, #be185d));
  color: #fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 8px 22px rgba(236,72,153,.18);
}
.actions .btn.primary:hover { filter: brightness(1.02); box-shadow: 0 10px 26px rgba(236,72,153,.24); }
.actions .btn.primary:active { filter: brightness(0.98); }
.actions .btn:not(.primary):not(.back-btn) {
  background: #ffffff;
  color: #111;
  border: 1px solid #e5e7eb;
}

@media (max-width: 640px) {
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; min-width: 0; }
}

/* Terms row (LTR/RTL) — accessible, inline-flex, full-clickable */
#termsRow.consent-row {
  display: inline-flex !important;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  cursor: pointer;
  user-select: none;
}
#termsRow.consent-row input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0; accent-color: var(--brand, #ec4899);
}
#termsRow.consent-row span {
  font-weight: 600; color: #1f2937; line-height: 1.35; text-align: start;
}
html[dir="rtl"] #termsRow.consent-row { flex-direction: row-reverse; text-align: right; }
html[dir="ltr"] #termsRow.consent-row { flex-direction: row; }
#termsRow.consent-row:has(input[type="checkbox"]:focus-visible) { outline: 2px solid color-mix(in oklab, var(--brand, #ec4899) 55%, transparent); outline-offset: 2px; }

/* Safety: neutralize legacy checkbox row styles so they don't fight */
.form-group.checkbox.checkbox-row { display: initial !important; }

/* Keep text on the right of the checkbox in RTL too */
[dir="rtl"] .checkbox-row,
[dir="rtl"] .application-form .form-group.checkbox.checkbox-row,
[dir="rtl"] label.form-group.checkbox.checkbox-row {
  grid-template-columns: auto 1fr !important; /* don't flip columns */
}

[dir="rtl"] .checkbox-row input[type="checkbox"],
[dir="rtl"] .application-form .form-group.checkbox.checkbox-row input[type="checkbox"],
[dir="rtl"] label.form-group.checkbox.checkbox-row input[type="checkbox"] {
  grid-column: 1 !important; /* checkbox on the left */
  justify-self: start;
}

[dir="rtl"] .checkbox-row span,
[dir="rtl"] .application-form .form-group.checkbox.checkbox-row span,
[dir="rtl"] label.form-group.checkbox.checkbox-row span {
  grid-column: 2 !important; /* text on the right */
  text-align: right;
  direction: rtl;
}

/* Neutralize legacy flex rule just in case */
[dir="rtl"] .form-group.checkbox { flex-direction: initial !important; }

/* Remove right-edge gap for the checkbox in RTL */
html[dir="rtl"] #termsRow {
  padding-right: 0 !important; /* was 12–14px; align checkbox closer to border */
}
html[dir="rtl"] #termsRow input[type="checkbox"] {
  justify-self: end; /* ensure it sits at the far right */
}

/* Force checkbox to hug the right edge in RTL */
html[dir="rtl"] #termsRow {
  grid-template-columns: auto 1fr !important; /* checkbox cell then text */
  padding-right: 0 !important;
  justify-items: end; /* align contents to the right edge */
}
html[dir="rtl"] #termsRow input[type="checkbox"] {
  grid-column: 1 !important;
  justify-self: end !important;
  margin-right: 0 !important;
}

/* RTL: align text to the right and add small right padding + gap for checkbox */
html[dir="rtl"] #termsRow {
  padding-right: 6px !important; /* small inset from the edge */
}
html[dir="rtl"] #termsRow span {
  text-align: right !important;
}
html[dir="rtl"] #termsRow input[type="checkbox"] {
  margin-right: 6px !important; /* tiny gap from the right border */
}