/* EvalDash dashboard styles. Plain CSS, no framework, no build step.
 * Styled to the Lawrence brand palette: cobalt blue, golden yellow, coral,
 * teal, and lavender, with a bold geometric display type treatment. */

:root {
  /* Lawrence brand palette */
  --blue: #0030cc;
  --blue-deep: #0033a0;
  --blue-dark: #0026a3;
  --yellow: #ffce00;
  --coral: #ff543f;
  --teal: #078572;
  --teal-deep: #008375;
  --lavender: #debdea;
  --lavender-soft: #f1e6f6;

  /* Neutrals */
  --ink: #272726;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f4;
  --border: #e6e7e8;
  --text: #272726;
  --text-soft: #56565a;
  --text-faint: #7d7d7d;

  /* Roles */
  --brand: var(--blue);
  --brand-dark: var(--blue-dark);
  --accent: var(--teal);

  --ok-text: #066b5c;
  --ok-bg: #e2f2ef;
  --warn-text: #8a6d00;
  --warn-bg: #fff4d1;
  --danger: #e0402b;
  --danger-text: #c0341f;
  --danger-bg: #ffe7e2;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.06), 0 6px 18px rgba(20, 20, 40, 0.06);
  --maxw: 920px;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Sharp Sans is the Lawrence display face. Named first so machines that have
   * it licensed use it; everyone else falls back to a geometric sans. */
  --font-display: "Sharp Sans", "Avenir Next", Avenir, "Century Gothic", "Poppins", var(--font);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header: bold cobalt band with a thin multicolor brand stripe on top */
.site-header {
  position: relative;
  background: var(--blue);
  color: #fff;
}
.site-header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg,
    var(--yellow) 0 25%,
    var(--coral) 25% 50%,
    var(--teal) 50% 75%,
    var(--lavender) 75% 100%);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}
.brand { display: flex; align-items: center; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.2px;
  color: #fff;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  min-width: 0;
}
.account-name { font-weight: 600; font-size: 14px; color: #fff; }
.account-email { color: rgba(255, 255, 255, 0.72); font-size: 13px; }

/* Main + views */
main.wrap { padding-top: 28px; padding-bottom: 64px; }
.view { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.notice h1 { margin: 0 0 8px; font-size: 20px; font-family: var(--font-display); letter-spacing: 0.2px; }
.notice p { margin: 0 0 4px; color: var(--text-soft); }
.notice.error { border-left: 4px solid var(--coral); }
.notice.error h1 { color: var(--danger-text); }
.notice .btn { margin-top: 14px; }

/* Email login form (no-token view) */
.login-form {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.login-form input {
  flex: 1 1 220px;
  min-width: 0;
  font: inherit;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.login-form input:focus-visible {
  outline: 3px solid rgba(0, 48, 204, 0.35);
  outline-offset: 1px;
  border-color: var(--blue);
}
.login-form .btn { margin-top: 0; }
.login-message { margin: 14px 0 0; color: var(--text-soft); font-size: 14px; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-soft);
  padding: 48px 4px;
  justify-content: center;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline response quota, sitting in the top action row */
.quota-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 13px;
  color: var(--text-soft);
}
.quota-inline-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  white-space: nowrap;
}
.quota-inline-detail { white-space: nowrap; }

.quota-bar {
  width: 110px;
  height: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.quota-bar-fill.is-warn { background: var(--yellow); }
.quota-bar-fill.is-danger { background: var(--coral); }

/* Quiet subscription note at the bottom of the dashboard, near the footer */
.subscription-note {
  margin: 36px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}
.subscription-note.is-warn { color: var(--warn-text); }
.subscription-note.is-danger { color: var(--danger-text); }

/* Section heading + refresh */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.1px;
}

/* Survey list */
.survey-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.survey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-left: 4px solid var(--blue);
}
.survey-main { min-width: 0; }
.survey-name {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1px;
  overflow-wrap: anywhere;
}
.survey-name > a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0, 48, 204, 0.35);
}
.survey-name > a:hover,
.survey-name > a:focus-visible {
  color: var(--blue-dark);
  text-decoration-color: currentColor;
}
.survey-name-suffix {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-soft);
}
.survey-name-suffix a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: rgba(0, 48, 204, 0.35);
}
.survey-name-suffix a:hover,
.survey-name-suffix a:focus-visible { color: var(--blue-dark); text-decoration-color: currentColor; }
.survey-meta { margin: 0; font-size: 13px; color: var(--text-soft); }
.survey-responses.is-unknown { color: var(--text-faint); font-style: italic; }
.survey-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Buttons */
.btn {
  appearance: none;
  border: 1.5px solid var(--blue);
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn:focus-visible { outline: 3px solid rgba(0, 48, 204, 0.4); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }

/* Get CSV: outline secondary */
.btn-csv {
  background: var(--surface);
  color: var(--blue);
}
.btn-csv:hover { background: var(--lavender-soft); color: var(--blue-dark); }

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

/* Top action bar: create survey + learn more */
.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.dashboard-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn-cta {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}
.btn-cta:hover { background: #e5442f; border-color: #e5442f; }
.btn-outline {
  background: transparent;
  border-color: var(--blue);
  color: var(--blue);
}
.btn-outline:hover { background: var(--lavender-soft); color: var(--blue-dark); }

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  background: var(--surface-2);
  color: var(--text-faint);
  border-color: var(--border);
}
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-csv.is-busy::after { border-color: rgba(0, 48, 204, 0.3); border-top-color: var(--blue); }

/* Toasts */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(20, 20, 40, 0.22);
  font-size: 14px;
  border-left: 4px solid var(--blue);
  cursor: pointer;
  animation: toast-in 0.18s ease;
}
.toast.is-ok { background: var(--teal-deep); border-left-color: var(--yellow); }
.toast.is-error { background: #8c1d12; border-left-color: var(--coral); }
.toast strong { display: block; margin-bottom: 2px; font-size: 14px; font-family: var(--font-display); }
.toast span { color: rgba(255, 255, 255, 0.85); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.is-leaving { opacity: 0; transition: opacity 0.25s ease; }

/* Footer */
.site-footer {
  background: var(--blue);
  color: #fff;
  margin-top: 56px;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 44px;
  min-height: 200px;
  padding: 36px 20px;
  flex-wrap: wrap;
}
.footer-logo {
  height: 150px;
  width: auto;
  display: block;
}
.footer-info { display: flex; flex-direction: column; gap: 12px; }
.footer-address { margin: 0; color: rgba(255, 255, 255, 0.85); font-size: 14px; line-height: 1.55; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: #fff; text-decoration: underline; font-size: 14px; }
.footer-links a:hover { color: var(--yellow); }
.footer-copyright { margin: 0; color: rgba(255, 255, 255, 0.7); font-size: 13px; }
@media (max-width: 720px) {
  .footer-logo { height: 116px; }
  .footer-inner { gap: 24px; }
}

/* Responsive */
@media (max-width: 720px) {
  .quota-inline { margin-left: 0; width: 100%; }
  .survey-row { flex-direction: column; align-items: stretch; }
  .survey-actions { justify-content: stretch; }
  .survey-actions .btn { flex: 1; }
  .header-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition: none !important; }
}
