/*
 * Terra Learning: staff area (/wp-admin) and WordPress login screens.
 * Colours come from admin-colors.css (Terra scheme). This file adds the
 * font, logos, shapes, and spacing so the admin matches the learner site.
 */

/* ---------- Tokens ---------- */
body.terra-admin,
body.login {
  --ink: #121114;
  --paper: #ffffff;
  --sand: #f5f5f5;
  --line: #e4e4e4;
  --muted: #5c5c60;
  --teal: #02a2b6;
  --radius: 12px;
  --wp-admin-theme-color: #121114;
  --wp-admin-theme-color--rgb: 18, 17, 20;
  --wp-admin-theme-color-darker-10: #000000;
  --wp-admin-theme-color-darker-10--rgb: 0, 0, 0;
  --wp-admin-theme-color-darker-20: #000000;
  --wp-admin-theme-color-darker-20--rgb: 0, 0, 0;
}

/* Tutor LMS admin screens print their default blue on :root; Terra ink instead. */
body.terra-admin {
  --tutor-color-primary: #121114;
  --tutor-color-primary-rgb: 18, 17, 20;
  --tutor-color-primary-hover: #2a2a2e;
  --tutor-color-primary-hover-rgb: 42, 42, 46;
  --tutor-body-color: #121114;
  --tutor-body-color-rgb: 18, 17, 20;
}
body.terra-admin .tutor-btn.tutor-btn-primary,
body.terra-admin .tutor-btn.tutor-btn-outline-primary {
  border-radius: 999px;
}

/* ---------- Type ---------- */
body.terra-admin,
body.terra-admin #wpadminbar *,
body.terra-admin #adminmenu,
body.terra-admin.wp-core-ui .button,
body.terra-admin input,
body.terra-admin select,
body.terra-admin textarea,
body.login {
  font-family: Outfit, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.terra-admin #wpadminbar .ab-icon,
body.terra-admin #wpadminbar .ab-icon:before,
body.terra-admin #wpadminbar .ab-item:before,
body.terra-admin .dashicons,
body.terra-admin .dashicons-before:before {
  font-family: dashicons;
}
body.terra-admin .wrap h1,
body.terra-admin .wrap h1.wp-heading-inline {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
body.terra-admin .wrap h2,
body.terra-admin .postbox .hndle,
body.terra-admin .postbox-header h2 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Toolbar ---------- */
body.terra-admin #wpadminbar {
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}
#wpadminbar #wp-admin-bar-terra-brand > .ab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  padding-right: 14px;
}
#wpadminbar #wp-admin-bar-terra-brand img {
  width: 20px;
  height: 20px;
}
#wpadminbar #wp-admin-bar-site-name > .ab-item:before {
  content: "\f504";
  top: 2px;
}
@media (max-width: 782px) {
  #wpadminbar #wp-admin-bar-terra-brand span { display: none; }
}

/* ---------- Sidebar ---------- */
body.terra-admin #adminmenuback,
body.terra-admin #adminmenuwrap {
  border-right: 1px solid var(--line);
}
body.terra-admin #adminmenuwrap::before {
  content: "";
  display: block;
  height: 72px;
  margin: 14px 14px 8px;
  background:
    var(--terra-logo) left top / auto 28px no-repeat,
    var(--terra-expo-logo) left bottom / auto 26px no-repeat;
}
body.terra-admin.folded #adminmenuwrap::before {
  height: 34px;
  margin: 10px 6px 4px;
  background: var(--terra-logo) center / contain no-repeat;
}
@media (max-width: 782px) {
  body.terra-admin #adminmenuwrap::before { display: none; }
}
body.terra-admin #adminmenu {
  margin-top: 4px;
}
body.terra-admin #adminmenu li.menu-top {
  margin: 2px 8px;
  width: auto;
  border-radius: 10px;
  overflow: hidden;
}
body.terra-admin.folded #adminmenu li.menu-top {
  margin: 2px 4px;
}
body.terra-admin #adminmenu li.menu-top > a.menu-top {
  border-radius: 10px;
}
body.terra-admin #adminmenu li.wp-menu-separator {
  height: 1px;
  margin: 8px 14px;
  background: var(--line);
}
body.terra-admin #adminmenu .wp-menu-name {
  font-weight: 600;
}
body.terra-admin #adminmenu .wp-submenu a {
  font-size: 13px;
}
body.terra-admin #adminmenu .wp-submenu li.current a,
body.terra-admin #adminmenu .wp-submenu li.current a:hover {
  font-weight: 700;
}
body.terra-admin #adminmenu .wp-has-current-submenu .wp-submenu {
  border-radius: 0 0 10px 10px;
  padding-bottom: 8px;
}
/* Hide the arrow pointer next to the current item */
body.terra-admin #adminmenu .wp-menu-arrow,
body.terra-admin #adminmenu li.current a.menu-top:after,
body.terra-admin #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu:after {
  display: none;
}
body.terra-admin #adminmenu .awaiting-mod,
body.terra-admin #adminmenu .update-plugins {
  font-weight: 700;
}

/* ---------- Content ---------- */
body.terra-admin #wpcontent {
  padding-left: 24px;
}
body.terra-admin .wrap {
  margin-top: 16px;
}
body.terra-admin .postbox,
body.terra-admin .card,
body.terra-admin .stuffbox,
body.terra-admin .welcome-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}
body.terra-admin .card { max-width: 720px; }
body.terra-admin .postbox-header {
  border-bottom: 1px solid var(--line);
}
body.terra-admin .postbox .inside {
  padding: 4px 16px 16px;
}

/* Buttons: black pills, white outline pills */
body.terra-admin.wp-core-ui .button,
body.terra-admin.wp-core-ui .button-secondary,
body.terra-admin .wrap .page-title-action,
body.login .wp-core-ui .button {
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 600;
}
body.terra-admin.wp-core-ui .button-small {
  padding: 0 10px;
}
body.terra-admin.wp-core-ui .button-secondary,
body.terra-admin.wp-core-ui .button:not(.button-primary):not(.button-link),
body.terra-admin .wrap .page-title-action {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--paper);
}
body.terra-admin.wp-core-ui .button:not(.button-primary):not(.button-link):hover,
body.terra-admin .wrap .page-title-action:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
body.terra-admin.wp-core-ui .button-primary,
body.login .wp-core-ui .button-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
body.terra-admin.wp-core-ui .button-primary:hover,
body.terra-admin.wp-core-ui .button-primary:focus,
body.login .wp-core-ui .button-primary:hover {
  background: #2a2a2e;
  border-color: #2a2a2e;
  color: #fff;
}
body.terra-admin.wp-core-ui .button-link,
body.terra-admin.wp-core-ui .button.button-link {
  border-radius: 0;
  padding: 0;
}

/* Inputs */
body.terra-admin input[type="text"],
body.terra-admin input[type="search"],
body.terra-admin input[type="email"],
body.terra-admin input[type="url"],
body.terra-admin input[type="password"],
body.terra-admin input[type="number"],
body.terra-admin select,
body.terra-admin textarea {
  border-color: #cfcfd3;
  border-radius: 8px;
}
body.terra-admin input:focus,
body.terra-admin select:focus,
body.terra-admin textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

/* List tables */
body.terra-admin .wp-list-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: none;
}
body.terra-admin .wp-list-table thead th,
body.terra-admin .wp-list-table thead td,
body.terra-admin .wp-list-table tfoot th,
body.terra-admin .wp-list-table tfoot td {
  background: var(--sand);
  font-weight: 700;
}
body.terra-admin .striped > tbody > :nth-child(odd) {
  background: #fafafa;
}
body.terra-admin .subsubsub a.current {
  font-weight: 700;
}

/* Notices */
body.terra-admin .notice,
body.terra-admin div.updated,
body.terra-admin div.error {
  border-radius: 10px;
  box-shadow: none;
  border: 1px solid var(--line);
  border-left-width: 4px;
}
body.terra-admin .notice-success,
body.terra-admin div.updated { border-left-color: #1f7a4d; }
body.terra-admin .notice-info { border-left-color: var(--teal); }

/* Footer */
body.terra-admin #wpfooter {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Dashboard ---------- */
body.terra-admin.index-php .wrap > h1 {
  display: none;
}
.terra-hero {
  position: relative;
  clear: both;
  margin: 20px 20px 4px 0;
  padding: 36px 36px 32px;
  border-radius: 16px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(100deg, rgba(8, 14, 12, 0.88) 0%, rgba(8, 14, 12, 0.55) 55%, rgba(8, 14, 12, 0.25) 100%),
    var(--terra-hero) center 40% / cover no-repeat;
}
.terra-hero-eyebrow {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.terra-hero h1 {
  margin: 0 0 8px;
  padding: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.terra-hero > p:not(.terra-hero-eyebrow) {
  max-width: 560px;
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
}
.terra-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.terra-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.terra-pill.is-light { background: #fff; color: var(--ink); }
.terra-pill.is-light:hover,
.terra-pill.is-light:focus { background: var(--sand); color: var(--ink); }
.terra-pill.is-ghost { border: 1px solid rgba(255, 255, 255, 0.7); color: #fff; }
.terra-pill.is-ghost:hover,
.terra-pill.is-ghost:focus { background: rgba(255, 255, 255, 0.14); color: #fff; }
@media (max-width: 782px) {
  .terra-hero { margin-right: 10px; padding: 24px; }
  .terra-hero h1 { font-size: 26px; }
}

/* Terra overview widget: stat tiles */
#terra_overview .terra-stats div {
  border-radius: 10px;
}
#terra_overview .terra-links .button {
  margin: 0;
}

/* Needs attention widget (terra-platform/admin-insights.php) */
#terra_attention .terra-attention {
  margin: 0;
  display: grid;
  gap: 8px;
}
#terra_attention .terra-attention li {
  margin: 0;
}
#terra_attention .terra-attention a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}
#terra_attention .terra-attention a:hover,
#terra_attention .terra-attention a:focus {
  background: var(--sand);
}
#terra_attention .terra-attention strong {
  min-width: 32px;
  font-size: 22px;
  line-height: 1;
}
#terra_attention .terra-caught-up {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--sand);
  color: var(--muted);
}

/* Activity trend widget */
#terra_trend .terra-trend-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
#terra_trend .terra-trend-totals div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
#terra_trend .terra-trend-totals span {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  font-weight: 600;
}
#terra_trend .terra-trend-totals strong {
  font-size: 20px;
  line-height: 1.2;
}
#terra_trend .terra-trend-totals em {
  color: var(--muted);
  font-style: normal;
}
#terra_trend .terra-trend-totals .is-signups span::before,
#terra_trend .terra-trend-legend .is-signups::before,
#terra_trend .terra-trend-totals .is-enrolments span::before,
#terra_trend .terra-trend-legend .is-enrolments::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--ink);
}
#terra_trend .is-enrolments span::before,
#terra_trend .terra-trend-legend .is-enrolments::before {
  background: var(--teal);
}
#terra_trend .terra-trend-chart {
  display: block;
  width: 100%;
  height: 120px;
}
#terra_trend .terra-trend-chart line {
  stroke: var(--line);
  stroke-width: 1;
}
#terra_trend .terra-trend-chart rect.is-signups { fill: var(--ink); }
#terra_trend .terra-trend-chart rect.is-enrolments { fill: var(--teal); }
#terra_trend .terra-trend-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
#terra_trend .terra-trend-legend {
  display: flex;
  gap: 16px;
  margin: 8px 0 0;
  color: var(--muted);
}

/* Site health widget */
#terra_health .terra-health {
  margin: 0;
}
#terra_health .terra-health li {
  margin: 0;
  padding: 8px 0 8px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--line);
  padding-left: 10px;
}
#terra_health .terra-health li.is-ok { border-left-color: #1a7f37; }
#terra_health .terra-health li.is-warn { border-left-color: #b26b00; }
#terra_health .terra-health li.is-bad { border-left-color: #c62828; }
#terra_health .terra-health li.is-info { border-left-color: var(--teal); }
#terra_health .terra-health strong {
  display: block;
}
#terra_health .terra-health span {
  color: var(--muted);
}

/* ---------- WordPress login screens (lost / reset password) ---------- */
body.login {
  background: var(--sand);
  color: var(--ink);
}
body.login h1 a {
  width: 220px;
  height: 64px;
  background: var(--terra-logo) center / contain no-repeat;
}
body.login form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}
body.login form .input,
body.login input[type="text"],
body.login input[type="password"],
body.login input[type="email"] {
  border-radius: 999px;
  background: var(--sand);
  padding: 4px 16px;
}
body.login form .input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
body.login #nav a,
body.login #backtoblog a {
  color: var(--ink);
}
body.login .message,
body.login .notice {
  border-left-color: var(--teal);
  border-radius: 10px;
}

/* Bulk-action and search submit buttons are <input class="button"> */
body.terra-admin.wp-core-ui input.button,
body.terra-admin.wp-core-ui input.button,
body.terra-admin .tablenav .button.action {
  border-radius: 999px;
  padding: 0 14px;
}

/* On login screens the .wp-core-ui class is on <body> itself */
body.login.wp-core-ui .button {
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 600;
}
body.login.wp-core-ui .button-primary {
  background: var(--ink);
  border-color: var(--ink);
}
body.login.wp-core-ui .button-primary:hover,
body.login.wp-core-ui .button-primary:focus {
  background: #2a2a2e;
  border-color: #2a2a2e;
}
