/* Student portal.
   Uses the theme's design tokens where they exist, with fallbacks so the portal
   still looks right if the plugin is used with another theme. */

.portal {
  --p-green: var(--green, #8fbc1f);
  --p-green-800: var(--green-800, #567a0d);
  --p-green-050: var(--green-050, #f4f7ea);
  --p-ink: var(--ink, #24303a);
  --p-slate: var(--slate, #4a5763);
  --p-line: var(--line, #e4e8ec);
  --p-radius: var(--radius, 14px);
  max-width: 1100px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- header */
.portal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; padding-bottom: 1.2rem; border-bottom: 1px solid var(--p-line); margin-bottom: 1.4rem;
}
.portal-head h2 { margin: .2rem 0 .3rem; }
.portal-meta { margin: 0; color: var(--p-slate); font-size: .92rem; }
.portal-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------- tabs */
.portal-tabs {
  display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--p-line); padding-bottom: .8rem;
}
.portal-tab {
  background: none; border: 1px solid var(--p-line); border-radius: 999px;
  padding: .5rem 1rem; font: inherit; font-size: .9rem; font-weight: 700;
  color: var(--p-slate); cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.portal-tab:hover { background: var(--p-green-050); color: var(--p-green-800); }
.portal-tab.is-active { background: var(--p-green-800); color: #fff; border-color: transparent; }

.portal-panel { display: none; }
.portal-panel.is-active { display: block; }

/* ---------------------------------------------------------------- stats */
.portal-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.6rem;
}
.portal-stat {
  background: #fff; border: 1px solid var(--p-line); border-radius: var(--p-radius);
  padding: 1.2rem; text-align: center;
}
/* currency values are long, so let the number shrink rather than wrap */
.portal-stat b {
  display: block; font-size: clamp(1.15rem, 2.1vw, 1.9rem); line-height: 1.15;
  color: var(--p-green-800); white-space: nowrap;
}
.portal-stat span { display: block; margin-top: .35rem; font-size: .85rem; color: var(--p-slate); }
.portal-stat.is-due b { color: #c0392b; }

/* ---------------------------------------------------------------- alerts */
.portal-alert {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  background: var(--p-green-050); border: 1px solid var(--p-line);
  border-radius: var(--p-radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem; font-size: .95rem;
}
.portal-alert--warn { background: #fdf6e3; border-color: #f0e0b0; }
.portal-alert--ok { background: var(--p-green-050); }
.portal-alert .btn { margin-left: auto; }

.portal-note, .portal-empty {
  background: #fff; border: 1px dashed var(--p-line); border-radius: var(--p-radius);
  padding: 1.6rem; color: var(--p-slate); text-align: center;
}
.portal-lead { color: var(--p-slate); margin-bottom: 1rem; }
.portal-day { margin: 1.6rem 0 .7rem; font-size: 1.02rem; }
.portal-total { margin: .9rem 0 0; font-size: .95rem; }
.portal-total b { color: var(--p-ink); }

/* ------------------------------------------------------------ attendance */
.portal-bar {
  display: inline-block; vertical-align: middle; width: 90px; height: 8px;
  background: var(--p-line); border-radius: 999px; overflow: hidden; margin-right: .5rem;
}
.portal-bar span { display: block; height: 100%; background: var(--p-green); }
.portal-pc { font-weight: 700; font-size: .9rem; }
.portal-pc.is-low { color: #c0392b; }

/* ---------------------------------------------------------------- pills */
.pill--unpaid { background: #fdecea; color: #a02b1c; }
.pill--paid { background: #e8f3e2; color: #2f6a2a; }
.pill--waived, .pill--cancelled { background: #eef1f4; color: #56626e; }
.pill--issued { background: #e8eef7; color: #2c4a6a; }

/* ---------------------------------------------------------------- challan */
.tick-col { width: 40px; text-align: center; }
.portal-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-top: 1rem;
}
.portal-challan-form button[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- login */
.portal--login { max-width: 460px; }
.portal--login .form-card { padding: clamp(1.4rem, 3vw, 2.2rem); }
/* the sign-in form and the sign-up form share this styling */
.portal--login form label { display: block; font-weight: 700; margin-bottom: .35rem; font-size: .92rem; }
.portal--login form p { margin: 0 0 .9rem; }
.portal--login form input[type="text"],
.portal--login form input[type="email"],
.portal--login form input[type="password"] {
  display: block; width: 100%; padding: .75rem .9rem; border: 1px solid var(--p-line);
  border-radius: 9px; font: inherit;
}
.portal--login form input:focus { outline: none; border-color: var(--p-green); box-shadow: 0 0 0 3px rgba(143,188,31,.35); }
.portal--login form .muted { display: block; margin-top: .3rem; font-size: .82rem; color: var(--p-slate); }
.portal--login .data-table th { width: 42%; white-space: nowrap; }
.portal--login .data-table { min-width: 0; }
#acn-login .login-remember { margin-bottom: .8rem; font-size: .9rem; }
#acn-login .login-submit input[type="submit"] {
  background: var(--p-green); color: #1c2a08; border: 0; border-radius: 999px;
  padding: .8rem 1.6rem; font-weight: 700; font-size: 1rem; cursor: pointer;
}
#acn-login .login-submit input[type="submit"]:hover { background: var(--green-600, #7ca617); }

/* the theme supplies these; repeat them so the plugin stands alone */
.portal .table-wrap { overflow-x: auto; border: 1px solid var(--p-line); border-radius: var(--p-radius); background: #fff; }
.portal .data-table { width: 100%; border-collapse: collapse; min-width: 520px; font-size: .93rem; }
.portal .data-table th, .portal .data-table td { padding: .8rem 1rem; text-align: left; vertical-align: top; }
.portal .data-table thead th {
  background: var(--p-green-050); color: var(--p-green-800); font-size: .72rem;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.portal .data-table tbody tr + tr { border-top: 1px solid var(--p-line); }
.portal .data-table tfoot th { border-top: 2px solid var(--p-line); background: #fbfcf8; }

@media (max-width: 620px) {
  .portal-head { flex-direction: column; }
  .portal-tabs { gap: .3rem; }
  .portal-tab { padding: .45rem .8rem; font-size: .84rem; }
}

/* ---------------------------------------------------------- the staff side */
.portal-form, .portal-filter {
  background: #fff; border: 1px solid var(--p-line); border-radius: var(--p-radius);
  padding: clamp(1rem, 2.4vw, 1.5rem); margin: 0 0 1.2rem;
}
.portal-filter { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.portal-filter .field, .portal-filter .login-submit { margin: 0; flex: 1 1 220px; }
.portal-form-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.portal-form-row .field { flex: 1 1 200px; }
.portal-form .field, .portal-filter .field { margin: 0 0 1rem; }
.portal-form label, .portal-filter label {
  display: block; font-weight: 700; margin-bottom: .35rem; font-size: .92rem;
}
.portal-form input[type="text"], .portal-form input[type="url"],
.portal-form input[type="date"], .portal-form input[type="number"],
.portal-form select, .portal-filter input[type="text"], .portal-filter select {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--p-line);
  border-radius: 10px; font: inherit; background: #fff;
}
.portal-form input:focus, .portal-form select:focus,
.portal-filter input:focus, .portal-filter select:focus {
  outline: none; border-color: var(--p-green); box-shadow: 0 0 0 3px rgba(143,188,31,.35);
}
.portal-form .muted { display: block; margin-top: .3rem; font-size: .82rem; color: var(--p-slate); }
.portal-form .login-submit { margin: .4rem 0 0; }

.marks-input { max-width: 110px; text-align: right; }
.inline-form { display: inline; margin: 0; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: #a02b1c;
  text-decoration: underline; cursor: pointer;
}
.linklike:hover { color: #7d2015; }

.pill--approved { background: #e8f3e2; color: #2f6a2a; }
.pill--pending, .pill--processing { background: #fdf6e3; color: #8a6d1a; }
.pill--rejected { background: #fdecea; color: #a02b1c; }

.portal--staff .data-table { min-width: 620px; }
.portal-form .field-label { display: block; font-weight: 700; margin-bottom: .35rem; font-size: .92rem; }
.portal-form .field-static { display: block; padding: .7rem 0; font-size: 1rem; }
