/* Antares associate portal. One stylesheet, no framework. */

:root {
  --navy: #14243b;
  --navy-light: #22385a;
  --accent: #e5732d;
  --accent-dark: #c65d1c;
  --danger: #b3261e;
  --text: #1d2430;
  --muted: #5d6675;
  --line: #dde2e9;
  --bg: #f5f7fa;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--navy-light); }

h1 { font-size: 1.6rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.05rem; margin: 0; }

/* Left menu */

.sidebar {
  flex: 0 0 15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.5rem 1rem;
  background: var(--navy);
  color: #fff;
}

.logo { display: block; margin: 0 0.5rem 2rem; }
.logo img { display: block; width: 100%; height: auto; }

.menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: #fff;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--navy-light); }
.menu-item.active { background: var(--navy-light); box-shadow: inset 3px 0 0 var(--accent); }

.menu { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-bottom { margin-top: auto; }
.sidebar-bottom form { margin: 0; }
.help { margin: 0 0.75rem 0.25rem; font-size: 0.85rem; color: #b9c4d4; }

/* Hamburger button, only on phones (see the media query below) */
.menu-toggle, .hamburger { display: none; }

/* Page */

main {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
}

.narrow { max-width: 34rem; }

.test-mode {
  margin: -1rem 0 1.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  background: #fff4d6;
  font-size: 0.85rem;
}

.message {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: #e6f2ea;
}
.message-error { background: #fbe4e2; }

.hint { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.count { font-size: 0.95rem; font-weight: normal; color: var(--muted); margin-left: 0.5rem; }
.organisation { margin: -0.5rem 0 0.75rem; color: var(--muted); }
.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; }

/* Buttons */

.button {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Waiting for Capsule after a click (set by portal.js): spinner before the label */
.busy { cursor: progress; pointer-events: none; opacity: 0.85; }
.busy::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.5em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy::before { animation-duration: 2s; } }

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  background: var(--line);
  font-size: 0.9rem;
}

/* Open/Closed toggle and tabs: plain links */

.toggle { display: inline-flex; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.toggle a { padding: 0.4rem 1.1rem; background: #fff; color: var(--text); text-decoration: none; }
.toggle a.selected { background: var(--navy); color: #fff; }

.tabs { display: flex; gap: 1.5rem; margin: 1.5rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: 0.5rem 0; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.selected { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* Case list */

.cases { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.cases th, .cases td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid var(--line); }
.cases th { font-size: 0.85rem; color: var(--muted); font-weight: 600; background: #fafbfc; }
.cases td:last-child { text-align: right; }

/* Case detail */

.case-header { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: 0.5rem; align-items: flex-start; }

.contact, .details { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.25rem; margin: 0; }
.contact dt, .details dt { color: var(--muted); }
.contact dd, .details dd { margin: 0; }
.details { max-width: 48rem; padding: 1.25rem; background: #fff; border-radius: var(--radius); }

.session { margin-bottom: 0.75rem; padding: 1rem 1.25rem; background: #fff; border-radius: var(--radius); }
.session header { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; align-items: baseline; color: var(--muted); }
.session h2 { color: var(--text); }
.session-actions { margin-left: auto; display: flex; gap: 1rem; }
.note { margin: 0.6rem 0 0; white-space: normal; }

/* Forms */

.form > div { margin-bottom: 1rem; }
.form label { display: block; margin-bottom: 0.25rem; font-weight: 600; }
.form input, .form textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}
.form input[type="date"], .form input[type="time"], .form input[type="number"] { width: auto; }
.errorlist { margin: 0.25rem 0; padding: 0; list-style: none; color: var(--danger); font-size: 0.9rem; }

code { font-size: 0.9em; background: #eef1f5; padding: 0.05rem 0.3rem; border-radius: 4px; }

@media (max-width: 720px) {
  body { flex-direction: column; }
  .sidebar { flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 0.75rem; }
  .logo { width: 9rem; margin: 0; }

  .menu-toggle { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 2.75rem; height: 2.75rem; border-radius: var(--radius); cursor: pointer;
  }
  .hamburger:hover, .menu-toggle:focus-visible + .hamburger { background: var(--navy-light); }
  .hamburger span, .hamburger span::before, .hamburger span::after {
    display: block; position: relative; width: 1.4rem; height: 2px; background: #fff; border-radius: 1px;
    transition: transform 0.15s, background 0.15s;
  }
  .hamburger span::before, .hamburger span::after { content: ""; position: absolute; left: 0; }
  .hamburger span::before { top: -7px; }
  .hamburger span::after { top: 7px; }
  /* Open: the three lines become a cross */
  .menu-toggle:checked + .hamburger span { background: transparent; }
  .menu-toggle:checked + .hamburger span::before { transform: translateY(7px) rotate(45deg); }
  .menu-toggle:checked + .hamburger span::after { transform: translateY(-7px) rotate(-45deg); }

  .menu { display: none; flex-basis: 100%; padding-top: 0.5rem; }
  .menu-toggle:checked ~ .menu { display: flex; }
  .sidebar-bottom { margin: 0.5rem 0 0; padding-top: 0.5rem; border-top: 1px solid var(--navy-light); }
  .menu-item { padding: 0.75rem; }
  main { padding: 1.25rem; }

  /* Tables become one card per row, each value with its label (data-label in the template) */
  .cases, .cases tbody, .cases tr { display: block; background: none; }
  .cases thead { display: none; }
  .cases tr { margin-bottom: 0.75rem; padding: 0.75rem 1rem; background: #fff; border-radius: var(--radius); }
  .cases td { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem; padding: 0.15rem 0; border: 0; overflow-wrap: anywhere; }
  .cases td::before { content: attr(data-label); color: var(--muted); }
  .cases td:last-child { display: block; margin-top: 0.5rem; text-align: left; }
  .cases td:last-child::before { content: none; }
  .cases td:last-child .button { display: block; text-align: center; }

  /* Case details: label above its value */
  .details { grid-template-columns: 1fr; gap: 0; padding: 1rem; }
  .details dt { margin-top: 0.75rem; }
  .details dt:first-child { margin-top: 0; }
}

/* Long email addresses and words wrap instead of widening the page */
.contact dd, .details dd { overflow-wrap: anywhere; }

/* Notice box, e.g. "check your spam folder" */

.notice {
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #fff1e6;
}
.notice p { margin: 0.25rem 0; }

/* A button that looks like a link */

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy-light);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Contact us pop-up (HTML popover, no JavaScript) */

.popup {
  width: min(32rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.popup::backdrop { background: rgba(20, 36, 59, 0.55); }
.popup h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.popup .button { margin-right: 0.25rem; }

/* Admin search */
.search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.search label { width: 100%; font-weight: 600; }
.search input { font: inherit; padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--radius); min-width: min(18rem, 100%); background: #fff; }
