/* =====================================================================
   public/css/admin.css — OSCAR-Junior CMS (super-admin) theme.
   Cleaner / more utilitarian than the student pages, same teal brand.
   ===================================================================== */
:root {
  --ad-ink: #1e293b;
  --ad-muted: #64748b;
  --ad-bg: #eef2f6;
  --ad-surface: #ffffff;
  --ad-line: #e2e8f0;
  --ad-teal: #15c2b1;
  --ad-teal-d: #0ea596;
  --ad-danger: #e11d48;
  --ad-shadow: 0 18px 40px -18px rgba(15, 40, 50, 0.35);
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
  --font-display: 'Fredoka', system-ui, -apple-system, sans-serif;
}
* {
  box-sizing: border-box;
}

.admin-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ad-ink);
  background: var(--ad-bg);
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ad-teal), #5cc7f2);
  flex: 0 0 auto;
}
.auth-mark svg {
  width: 23px;
  height: 23px;
}

/* ---- login ---- */
.admin-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--ad-surface);
  border: 1px solid var(--ad-line);
  border-radius: 18px;
  box-shadow: var(--ad-shadow);
  padding: 2rem 1.75rem;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.auth-brand b {
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.auth-brand b span {
  color: var(--ad-teal);
}
.auth-head {
  text-align: center;
  margin-bottom: 1.25rem;
}
.auth-head h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0.25rem 0;
}
.auth-head p {
  margin: 0;
  color: var(--ad-muted);
  font-size: 0.95rem;
}

.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--ad-line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.field input:focus {
  outline: none;
  border-color: var(--ad-teal);
  box-shadow: 0 0 0 3px rgba(21, 194, 177, 0.15);
}

.btn-primary {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 10px;
  background: var(--ad-teal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary:hover {
  background: var(--ad-teal-d);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.form-msg {
  display: none;
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.9rem;
}
.form-msg.show {
  display: block;
}
.form-msg.error {
  background: #fff1f3;
  color: var(--ad-danger);
  border: 1px solid #fecdd6;
}

.auth-foot {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}
.auth-foot a {
  color: var(--ad-muted);
}

/* ---- dashboard shell ---- */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: var(--ad-surface);
  border-bottom: 1px solid var(--ad-line);
}
.admin-topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ad-ink);
  text-decoration: none;
}
.admin-topbar .brand span {
  color: var(--ad-teal);
}
.admin-topbar .auth-mark {
  width: 32px;
  height: 32px;
}
.admin-topbar .auth-mark svg {
  width: 20px;
  height: 20px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-right .who {
  color: var(--ad-muted);
  font-weight: 700;
  font-size: 0.95rem;
}
.topbar-right .who b {
  color: var(--ad-ink);
}
.btn-logout {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--ad-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ad-ink);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
}
.btn-logout:hover {
  background: #fff5f7;
  color: var(--ad-danger);
  border-color: #fecdd6;
}

.admin-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}
.admin-main h1 {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
}
.admin-main .lead {
  color: var(--ad-muted);
  margin: 0 0 1.5rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.module-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--ad-surface);
  border: 1px solid var(--ad-line);
  border-radius: 14px;
  padding: 1.25rem;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ad-shadow);
}
.module-card .ico {
  font-size: 1.6rem;
}
.module-card h3 {
  font-family: var(--font-display);
  margin: 0.35rem 0 0.15rem;
}
.module-card p {
  margin: 0;
  color: var(--ad-muted);
  font-size: 0.9rem;
}
.module-card.is-soon {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 560px) {
  .admin-topbar {
    flex-wrap: wrap;
  }
}

/* ===================================================================
   CMS data tables (Institutions index, and future list pages)
   =================================================================== */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--ad-muted);
  text-decoration: none;
  font-weight: 600;
}
.back-link:hover {
  color: var(--ad-teal-d);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.muted {
  color: var(--ad-muted);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--ad-surface);
  border: 1px solid var(--ad-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--ad-shadow);
}
.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--ad-line);
  vertical-align: middle;
}
.data-table thead th {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ad-muted);
  background: #f8fafc;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover {
  background: #f8fafc;
}

.col-id {
  width: 64px;
  color: var(--ad-muted);
  font-variant-numeric: tabular-nums;
}
.col-logo {
  width: 72px;
}
.col-name {
  font-weight: 600;
}
.col-status {
  width: 110px;
}
.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* Logo thumbnail / initial fallback */
.inst-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: inline-flex;
  border: 1px solid var(--ad-line);
  background: #f1f5f9;
}
.inst-logo--placeholder {
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ad-teal-d);
  background: #e6fbf8;
  border-color: #bdf0ea;
}

/* Status pill */
.pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-display);
}
.pill--on {
  color: #0a7d54;
  background: #d8f6e7;
}
.pill--off {
  color: #9a3412;
  background: #fde6d5;
}

/* Small action buttons */
.btn-sm {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  margin-left: 0.35rem;
  border-radius: 9px;
  border: 1px solid var(--ad-teal);
  background: var(--ad-teal);
  color: #fff;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.4;
}
.btn-sm:hover {
  background: var(--ad-teal-d);
  border-color: var(--ad-teal-d);
}
.btn-sm.btn-ghost {
  background: #fff;
  color: var(--ad-ink);
  border-color: var(--ad-line);
}
.btn-sm.btn-ghost:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.btn-sm.btn-danger {
  background: #fff;
  color: var(--ad-danger);
  border-color: #fecdd6;
}
.btn-sm.btn-danger:hover {
  background: #fff5f7;
  border-color: #fda4b8;
}
.btn-sm:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 640px) {
  .col-id {
    display: none;
  }
  .data-table th,
  .data-table td {
    padding: 0.6rem 0.65rem;
  }
  .btn-sm {
    margin: 0.15rem 0 0 0.3rem;
  }
}

/* ===================================================================
   Institution details page
   =================================================================== */
.detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.inst-logo--lg {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  font-size: 1.6rem;
  flex: 0 0 auto;
}
.detail-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.detail-meta h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}
.detail-head .btn-sm {
  margin-left: auto;
  align-self: flex-start;
}

.detail-desc {
  margin: 0 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--ad-line);
  line-height: 1.6;
}

.detail-section {
  margin: 0 0 1.75rem;
}
.detail-section h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #e6fbf8;
  color: var(--ad-teal-d);
  font-size: 0.8rem;
  font-weight: 700;
}

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--ad-surface);
  border: 1px solid var(--ad-line);
  border-radius: 12px;
  overflow: hidden;
}
.people li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--ad-line);
}
.people li:last-child {
  border-bottom: 0;
}
.people .name {
  font-weight: 600;
}
.people .sub {
  color: var(--ad-muted);
  font-size: 0.88rem;
}
.people .empty-row {
  color: var(--ad-muted);
  font-style: italic;
}

/* ===================================================================
   Institution create / edit form
   =================================================================== */
.admin-main--narrow {
  max-width: 640px;
}
.btn-inline {
  align-self: center;
  white-space: nowrap;
}

.form-error {
  background: #fff5f7;
  border: 1px solid #fecdd6;
  color: var(--ad-danger);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin: 0 0 1rem;
  font-weight: 600;
}

.ad-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field-label {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ad-ink);
}
.field-hint {
  font-weight: 400;
  color: var(--ad-muted);
  font-size: 0.85rem;
}

.ad-form input[type='text'],
.ad-form input[type='email'],
.ad-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ad-line);
  border-radius: 10px;
  font: inherit;
  color: var(--ad-ink);
  background: var(--ad-surface);
}
.ad-form input[type='text']:focus,
.ad-form input[type='email']:focus,
.ad-form textarea:focus {
  outline: none;
  border-color: var(--ad-teal);
  box-shadow: 0 0 0 3px rgba(21, 194, 177, 0.15);
}
.ad-form textarea {
  resize: vertical;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}
.field--inline input[type='checkbox'] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--ad-teal);
}

.logo-field {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-field input[type='file'] {
  font: inherit;
  color: var(--ad-muted);
  flex: 1 1 auto;
}

.ad-fieldset {
  border: 1px solid var(--ad-line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.2rem;
  margin: 0.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.ad-fieldset legend {
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0 0.4rem;
  color: var(--ad-ink);
}
.ad-fieldset .field-hint {
  margin: -0.4rem 0 0.2rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.btn-ghost-lg {
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--ad-line);
  background: #fff;
  color: var(--ad-ink);
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-ghost-lg:hover {
  background: #f1f5f9;
}

/* ===================================================================
   Section "add" buttons + modal dialogs (institution details)
   =================================================================== */
.section-add {
  margin-left: auto;
}

.modal {
  border: none;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 460px;
  width: calc(100% - 2rem);
  color: var(--ad-ink);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}
.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.modal h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
}
.modal .ad-form {
  gap: 1rem;
}

/* Clickable list rows (e.g. classrooms -> classroom detail) */
.people li.row-link {
  padding: 0;
}
.people li.row-link .row-link-a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  color: inherit;
}
.people li.row-link .row-link-a:hover {
  background: #f1f5f9;
}
.people li.row-link .row-link-a::after {
  content: '\203A';
  margin-left: auto;
  color: var(--ad-muted);
  font-size: 1.15rem;
  line-height: 1;
}

/* Per-row action button (e.g. unassign) + multi-select checklist */
.people li .row-action {
  margin-left: auto;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--ad-line);
  border-radius: 10px;
  padding: 0.4rem;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}
.check-row:hover {
  background: #f1f5f9;
}
.check-row input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--ad-teal);
}
