/* QIM Platform — minimalistic styling */

:root {
  --color-bg: #f4f5f7;
  --color-card: #ffffff;
  --color-border: #e3e6ea;
  --color-text: #1a1f27;
  --color-muted: #747474;
  --color-accent: #FC7323;
  --color-accent-hover: #fd8a4a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-display: "Comfortaa", var(--font);
}

* {
  box-sizing: border-box;
}

/* Base typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
  margin: 1.6rem 0 0.75rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
  margin-top: 0;
}

p {
  margin: 0 0 1rem;
  line-height: 1.65;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Interactive components keep their own hover styling (no underline) */
.button:hover,
.button:active,
.button.secondary:hover,
.button-text:hover,
.button-text:active,
.submit-btn:hover,
.submit-btn:active,
.dropdown a:hover,
.link:hover,
.nav-link:hover,
.brand:hover {
  text-decoration: none;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
}

.stage {
  margin-top: 1.5rem;
}

/* Top bar, shown only once authenticated */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 2rem;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
}

.brand img {
  height: 26px;
  width: auto;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Primary navigation with dropdown menus */
.mainnav {
  margin-right: auto;
  margin-left: 1.5rem;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border: none;
  background: none;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 550;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-item:focus-within > .nav-link {
  background: var(--color-bg);
  color: var(--color-accent);
}

.dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 200px;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
  z-index: 20;
}

.nav-item:focus-within > .dropdown,
.nav-item:hover > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dropdown a,
.dropdown .is-soon > span:first-child {
  display: block;
  flex: 1;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.dropdown a:hover,
.dropdown a:focus-visible {
  background: var(--color-bg);
  color: var(--color-accent);
}

.dropdown .is-soon {
  cursor: not-allowed;
  opacity: 0.55;
}

.dropdown .is-soon > span:first-child {
  color: var(--color-muted);
}

.badge {
  flex: 0 0 auto;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.link {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.link:hover {
  color: var(--color-text);
}

/* Cards */
.card {
  width: 100%;
  max-width: 380px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 3.5rem 2.5rem;
  text-align: center;
}

.stage {
  padding: 2rem 1rem;
}

.login-logo {
  display: block;
  margin: 0 auto 1.25rem;
  max-width: 100%;
  height: auto;
}

.login-title {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 650;
}

.login-subtitle {
  margin: 0 0 1.75rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* Buttons: outline by default, filled on hover/active */
.button {
  display: inline-block;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--color-accent);
  border-radius: 8px;
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.button:hover,
.button:active {
  background: var(--color-accent);
  color: #fff;
}

.button.secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.button.secondary:hover {
  background: var(--color-bg);
}

.button-text {
  width: auto;
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--color-accent);
  border-radius: 8px;
  background: transparent;
  color: var(--color-accent);
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.button-text:hover,
.button-text:active {
  background: var(--color-accent);
  color: #fff;
}

/* Logout in the top bar */
.logout-form {
  margin: 0;
}

.logout-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
}

.logout-btn:hover {
  background: var(--color-bg);
}

/* Generic content page */
.content {
  max-width: 640px;
  margin: 0 auto;
}

.content h2 {
  margin-top: 0;
}

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

.dev-hint {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------------
   Forms (shared across apps)
   --------------------------------------------------------------------------- */
.field {
  display: block;
  margin-bottom: 1rem;
}

.field > span {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  color: var(--color-text);
  background: var(--color-card);
}

.field textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Form rows: lay fields out side-by-side, compact */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row > .field {
  flex: 1 1 0;
  min-width: 160px;
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

/* Sliders (e.g. memory / walltime in the job-submit form) */
.field input[type="range"] {
  width: 100%;
  padding: 0;
}


/* Consistent focus ring for form fields (replaces the browser default) */
.field input:focus,
.field textarea:focus {
  outline: 1px solid rgba(0, 0, 0, 0.25);
  outline-offset: 0px;
}

.range-value {
  font-weight: 600;
}

/* Combobox (queue selector): prefilled input + toggleable full list */
.combobox {
  position: relative;
}

.combobox input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem;
  padding-right: 2.4rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  color: var(--color-text);
  background: var(--color-card);
}

.combobox-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  border: none;
  background: none;
  font-size: 0.9rem;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  line-height: 1;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 30;
  max-height: 220px;
  overflow-y: auto;
}

.combobox-list li {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

.combobox-list li:hover,
.combobox-list li:focus {
  background: var(--color-bg);
  color: var(--color-accent);
}

/* Primary / secondary action buttons used inside forms and modals.
   Outline by default, filled on hover/active — matches .button. */
.submit-btn {
  display: inline-block;
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.submit-btn:hover,
.submit-btn:active {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

.submit-btn.secondary {
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.submit-btn.secondary:hover,
.submit-btn.secondary:active {
  background: var(--color-bg);
  color: var(--color-text);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Inline result / error text */
#result {
  margin-top: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

#result .ok { color: #14622b; }
#result .err { color: #9b1c1c; }
.error { color: #9b1c1c; }

/* ---------------------------------------------------------------------------
   Modal (password prompt)
   --------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 40, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal[hidden] {
  display: none;
}

.modal-box {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}

.modal-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  color: var(--color-text);
  background: var(--color-card);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ---------------------------------------------------------------------------
   Login screen: stack of sign-in cards (incl. developer card)
   --------------------------------------------------------------------------- */
.login-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 380px;
}

.dev-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}

.dev-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  width: 100%;
}

.dev-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  color: var(--color-text);
  background: var(--color-card);
}