/* =========================================================
   IEEE Jordan Section · Website Award 2026 — Judging Portal
   Stylesheet (single file)
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --ieee-blue:        #00629B;
  --ieee-blue-dark:   #003B5C;
  --ieee-blue-light:  #0077C8;
  --ieee-accent:      #FFC72C;

  --bg:               #F5F7FA;
  --surface:          #FFFFFF;
  --surface-2:        #F9FAFC;
  --border:           #E1E6ED;
  --border-strong:    #C9D1DC;

  --text:             #1A2533;
  --text-muted:       #5C6878;
  --text-soft:        #8895A5;

  --success:          #1F8A4C;
  --success-bg:       #E6F4EC;
  --warning:          #B45309;
  --warning-bg:       #FEF3C7;
  --danger:           #B42318;
  --danger-bg:        #FEE4E2;
  --info-bg:          #E0EEF8;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-2: 0 4px 6px -1px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-3: 0 10px 15px -3px rgba(16, 24, 40, .10), 0 4px 6px -4px rgba(16, 24, 40, .05);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-arabic: "Segoe UI", "Tahoma", "Cairo", "Tajawal", "Noto Sans Arabic", "Arial", sans-serif;
}

/* Arabic / RTL adjustments */
html[lang="ar"], html[dir="rtl"] body { font-family: var(--font-arabic); }
html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .truncate { direction: rtl; }
html[dir="rtl"] .url-line,
html[dir="rtl"] .mono { direction: ltr; text-align: left; unicode-bidi: embed; }

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--text); margin: 0 0 .35em; line-height: 1.25; }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p  { margin: 0 0 .75em; }
a  { color: var(--ieee-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted     { color: var(--text-muted); }
.soft      { color: var(--text-soft); }
.mono      { font-family: var(--font-mono); }
.center    { text-align: center; }
.right     { text-align: right; }
.nowrap    { white-space: nowrap; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden    { display: none !important; }

/* ---------- Layout ---------- */
.page {
  max-width: 1180px;
  margin: 24px auto 56px;
  padding: 0 20px;
}
.page-head {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: end; justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: .95rem; margin-top: 4px; }

.row   { display: flex; flex-wrap: wrap; gap: 16px; }
.col   { flex: 1 1 0; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.gap-sm { gap: 8px; }
.gap-lg { gap: 20px; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-1);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
  padding-inline-end: 10px;
  border-inline-end: 1px solid var(--border);
}
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 36px; width: auto; display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .98rem; color: var(--ieee-blue-dark); font-weight: 700; }
.brand-text small  { font-size: .76rem; color: var(--text-muted); }

.nav { display: flex; gap: 4px; margin-inline-start: 12px; }
.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500; font-size: .92rem;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ieee-blue);
  text-decoration: none;
}
.nav-link.active {
  color: var(--ieee-blue);
  background: var(--info-bg);
}

.user-menu { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }

.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .82rem; font-weight: 600;
  text-decoration: none;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.lang-toggle:hover {
  background: var(--info-bg); color: var(--ieee-blue-dark);
  border-color: var(--ieee-blue-light); text-decoration: none;
}
.lang-toggle-floating {
  position: fixed; top: 18px;
  inset-inline-end: 18px;
  z-index: 50;
  box-shadow: var(--shadow-1);
}
.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .9rem;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ieee-blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; user-select: none;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 3px solid #B0CFE4; outline-offset: 1px; }

.btn-primary { background: var(--ieee-blue); color: #fff; }
.btn-primary:hover { background: var(--ieee-blue-dark); color: #fff; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #166e3c; color: #fff; }

.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #93231a; color: #fff; }

.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn-lg { padding: 12px 20px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn[disabled], .btn.is-disabled {
  opacity: .55; cursor: not-allowed; pointer-events: none;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; color: var(--text); }
input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ieee-blue);
  box-shadow: 0 0 0 3px rgba(0, 98, 155, .15);
}
textarea { min-height: 84px; resize: vertical; font-family: inherit; }

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.card-body   { padding: 18px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Alerts ---------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin-bottom: 14px;
  font-size: .92rem;
}
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: #FECDC9; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #BFE2CC; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #FCD9A2; }
.alert-info    { background: var(--info-bg);    color: var(--ieee-blue-dark); border-color: #BFDCEF; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .01em;
  border: 1px solid transparent;
  vertical-align: middle;
}
.badge.gray   { background: #EEF1F5; color: #5C6878; }
.badge.amber  { background: var(--warning-bg); color: var(--warning); }
.badge.green  { background: var(--success-bg); color: var(--success); }
.badge.blue   { background: var(--info-bg);    color: var(--ieee-blue-dark); }

/* ---------- Auth (login) ---------- */
.auth-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0,119,200,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(0,59,92,.18), transparent 60%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 32px 28px;
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { font-size: 1.25rem; margin: 14px 0 6px; color: var(--ieee-blue-dark); line-height: 1.3; }
.auth-sub { color: var(--text-muted); font-size: .88rem; margin: 0; }
.auth-logo { height: 64px; width: auto; }
.auth-form { margin-top: 12px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--text-soft); }

/* ---------- Dashboard list ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-1);
}
.kpi .label { color: var(--text-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.55rem; font-weight: 700; color: var(--ieee-blue-dark); }
.kpi .hint  { color: var(--text-soft); font-size: .82rem; }

.applicant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.app-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}
.app-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.app-card-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #FBFCFE, #fff);
}
.app-card-head .ou { font-weight: 700; color: var(--ieee-blue-dark); font-size: 1rem; }
.app-card-head .nominator { color: var(--text-muted); font-size: .82rem; margin-top: 2px; }
.app-card-body { padding: 12px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.app-card-body .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--text-muted); }
.app-card-body .url-line {
  font-family: var(--font-mono); font-size: .82rem;
  background: var(--surface-2); padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  word-break: break-all;
}
.app-card-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.score-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--info-bg);
  color: var(--ieee-blue-dark);
  border-radius: 999px;
  font-weight: 700; font-size: .85rem;
}
.score-pill .max { color: var(--text-muted); font-weight: 500; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
.table th, .table td {
  padding: 10px 14px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table .num { text-align: end; }
.table th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #FAFCFE; }
.table .num { font-variant-numeric: tabular-nums; }
.table .rank-1 td:first-child::before { content: "🥇 "; }
.table .rank-2 td:first-child::before { content: "🥈 "; }
.table .rank-3 td:first-child::before { content: "🥉 "; }

/* ---------- Evaluate page ---------- */
.eval-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .eval-layout { grid-template-columns: 1fr; } }

.eval-side {
  position: sticky; top: 84px;
  display: flex; flex-direction: column; gap: 12px;
}
.score-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-1);
}
.score-summary .total {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 2.1rem; font-weight: 700; color: var(--ieee-blue-dark);
}
.score-summary .total .of { font-size: 1rem; color: var(--text-muted); font-weight: 500; }
.score-summary .progress {
  height: 8px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin: 10px 0 8px;
}
.score-summary .progress > span { display:block; height: 100%; background: linear-gradient(90deg, var(--ieee-blue), var(--ieee-blue-light)); transition: width .25s ease; }
.score-summary .meta { font-size: .85rem; color: var(--text-muted); display: flex; justify-content: space-between; }

.criterion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}
.criterion + .criterion { margin-top: 14px; }
.criterion .crit-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 6px;
}
.criterion .crit-title { font-weight: 700; color: var(--text); }
.criterion .crit-num { color: var(--text-soft); font-weight: 600; margin-right: 6px; }
.criterion .crit-desc { color: var(--text-muted); font-size: .9rem; margin-bottom: 12px; }

.score-scale {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.score-opt {
  position: relative;
}
.score-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.score-opt label {
  display: block; padding: 10px 8px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: .82rem; font-weight: 600;
  color: var(--text-muted);
  transition: all .12s ease;
  user-select: none;
}
.score-opt label .n { display: block; font-size: 1.15rem; color: var(--text); margin-bottom: 1px; }
.score-opt label:hover { border-color: var(--ieee-blue-light); color: var(--ieee-blue-dark); }
.score-opt input:checked + label {
  border-color: var(--ieee-blue);
  background: var(--info-bg);
  color: var(--ieee-blue-dark);
  box-shadow: inset 0 0 0 1px var(--ieee-blue);
}
.score-opt input:focus-visible + label { outline: 3px solid #B0CFE4; outline-offset: 1px; }

.level-hint {
  font-size: .85rem; color: var(--text-muted);
  background: var(--surface-2); padding: 8px 10px; border-radius: var(--radius-sm);
  border-inline-start: 3px solid var(--ieee-blue-light);
  margin-bottom: 10px; min-height: 18px;
}
.level-hint strong { color: var(--ieee-blue-dark); }

.peer-scores {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 8px; font-size: .8rem; color: var(--text-muted);
}
.peer-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.peer-chip strong { color: var(--ieee-blue-dark); }

/* ---------- Applicant detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: .92rem; }
.dl dt { color: var(--text-muted); font-weight: 600; }
.dl dd { margin: 0; }

.pdf-frame {
  width: 100%; height: 720px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- Comments view ---------- */
.comment-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
}
.comment-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.comment-section { margin-top: 10px; }
.comment-list {
  list-style: none; padding: 0; margin: 6px 0 0;
  display: flex; flex-direction: column; gap: 8px;
}
.comment-list li {
  padding: 8px 10px;
  background: var(--surface-2);
  border-inline-start: 3px solid var(--ieee-blue-light);
  border-radius: var(--radius-sm);
  font-size: .92rem;
}

/* ---------- Compare ---------- */
.compare-pick {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: .88rem;
}
.compare-pick:hover { border-color: var(--ieee-blue-light); background: var(--surface-2); }
.compare-pick input { accent-color: var(--ieee-blue); }
.compare-pick input:checked + span { color: var(--ieee-blue-dark); font-weight: 600; }

.compare-table th { vertical-align: top; }
.bar-cell {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.bar {
  flex: 1; max-width: 120px;
  height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ieee-blue-light), var(--ieee-blue));
  border-radius: 999px;
}

/* ---------- Site footer ---------- */
.sitefoot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
}
.sitefoot-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex; justify-content: space-between; gap: 12px;
  color: var(--text-muted); font-size: .85rem;
  flex-wrap: wrap;
}

/* ---------- Save indicator ---------- */
.save-indicator {
  position: fixed; bottom: 20px;
  inset-inline-end: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px;
  box-shadow: var(--shadow-2); font-size: .85rem;
  display: none; align-items: center; gap: 8px;
  z-index: 100;
}
.save-indicator.show { display: inline-flex; }
.save-indicator .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
}
.save-indicator.saving .dot { background: var(--warning); animation: pulse 1s infinite; }
.save-indicator.error  .dot { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .78rem; color: var(--text-muted); margin-right: 4px;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; margin-left: 0; }
  .user-menu { margin-left: auto; }
  .brand-text small { display: none; }
  h1 { font-size: 1.4rem; }
  .page { margin-top: 16px; }
  .score-scale { grid-template-columns: repeat(5, 1fr); }
  .score-opt label { padding: 8px 4px; font-size: .72rem; }
}

/* ---------- Print (for results export) ---------- */
@media print {
  .topbar, .sitefoot, .btn, .nav { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; border-color: #999; }
}
