/* Shared layout of the login and account pages. A program's /css/auth.css (loaded after this) sets the colours and
   the background pattern (body background, see the end of auth.css) through the variables below — light ones on :root, dark ones under the two dark selectors.
   Dark applies when the person picked it (html[data-theme="dark"], see js/theme.js) or, without a choice, when the
   system is dark. Plain CSS, no external resources. */

:root {
  color-scheme: light;
  --accent: #3f51b5;          /* buttons, heading */
  --accent-hover: #303f9f;
  --accent-text: #ffffff;
  --heading: var(--accent);
  --text: #1d2433;
  --muted: #5b6475;
  --page: #eef0f4;            /* under the pattern */
  --wash: rgba(238, 240, 244, .85);   /* over the pattern: how strongly it shows through */
  --surface: #ffffff;
  --field: #ffffff;
  --border: #d6d9e0;
  --field-border: #c3c8d2;
  --soft: rgba(0, 0, 0, .035);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 12px 32px rgba(20, 30, 60, .12);
  --error-bg: #fdecea;
  --error-text: #8a1c12;
  --info-bg: #e8f0fe;
  --info-text: #174ea6;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* dark defaults (a program overrides these in the same two places) */
html[data-theme="dark"] {
  color-scheme: dark;
  --text: #e6e9f0;
  --muted: #a2a9b8;
  --page: #10141e;
  --wash: rgba(14, 18, 28, .9);
  --surface: #252d3d;
  --field: rgba(0, 0, 0, .22);
  --border: #343c4e;
  --field-border: #4a5468;
  --soft: rgba(255, 255, 255, .05);
  --card-shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 2px 4px rgba(0, 0, 0, .4), 0 18px 48px rgba(0, 0, 0, .65);
  --error-bg: #4a1d18;
  --error-text: #ffb4a9;
  --info-bg: #1c2b4a;
  --info-text: #aecbfa;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --text: #e6e9f0;
    --muted: #a2a9b8;
    --page: #10141e;
    --wash: rgba(14, 18, 28, .9);
    --surface: #252d3d;
    --field: rgba(0, 0, 0, .22);
    --border: #343c4e;
    --field-border: #4a5468;
    --soft: rgba(255, 255, 255, .05);
    --card-shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 2px 4px rgba(0, 0, 0, .4), 0 18px 48px rgba(0, 0, 0, .65);
    --error-bg: #4a1d18;
    --error-text: #ffb4a9;
    --info-bg: #1c2b4a;
    --info-text: #aecbfa;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 15px/1.5 var(--font);
  background-color: var(--page);
  background-image: linear-gradient(var(--wash), var(--wash));
  background-size: auto, 240px 240px;   /* the program adds its pattern as the second layer */
  background-repeat: repeat;
}

main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 72px 16px 32px;
}

/* The card keeps its size: a fixed width, not stretched or squeezed by the window — only a phone narrower than the
   card gets it at the screen's width. */
.card {
  width: 420px;
  max-width: 100%;
  padding: 36px 36px 28px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

/* ── header ── */
.head { text-align: center; }
.logo { display: block; width: 56px; height: 56px; margin: 0 auto 10px; object-fit: contain; }
.head h1 { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 700; color: var(--heading); text-wrap: balance; }
.app-name { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--heading); text-wrap: balance; }
.app-name + h1 { color: var(--text); font-size: 19px; }
.tagline { margin: 6px 0 0; font-size: 14px; color: var(--muted); text-wrap: balance; }
.subtitle { margin: 6px 0 4px; color: var(--muted); font-size: 14px; }
.service { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--soft); color: var(--muted);
  font-size: 13.5px; line-height: 1.45; }
.service b { color: var(--text); font-weight: 600; }

/* ── form ── */
form { margin-top: 8px; }
label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 13px; }
input, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  width: 100%;
  min-height: 44px;
  margin-top: 20px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }

.alert { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert.info { background: var(--info-bg); color: var(--info-text); }
.text { margin: 14px 0; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.field-error { margin: 6px 0 0; color: var(--error-text); font-size: 13.5px; }

/* ── "Prihláste sa cez" · providers · "alebo e-mailom a heslom" ── */
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.divider + form { margin-top: 0; }
.providers { display: grid; gap: 10px; }
.providers.pair { grid-template-columns: 1fr 1fr; }
.provider-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.provider-button img { width: 22px; height: 22px; }
.provider-button:hover { background: var(--soft); border-color: var(--field-border); }

/* ── links under the form ── */
.links { list-style: none; margin: 22px 0 0; padding: 16px 0 0; border-top: 1px solid var(--border); display: grid;
  gap: 6px; font-size: 13.5px; color: var(--muted); }
.links a, .back a { color: var(--text); }
.back { margin: 20px 0 0; text-align: center; font-size: 14px; }

footer { padding: 16px; text-align: center; font-size: 13px; color: var(--muted); }

/* ── language and look menus, top right of the page ── */
.corner { position: absolute; top: 16px; right: 16px; z-index: 2; display: flex; gap: 8px; }
.menu { position: relative; }
.menu summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary svg { width: 16px; height: 16px; }
.menu summary .chevron { width: 14px; height: 14px; transition: transform .15s; }
.menu[open] summary .chevron { transform: rotate(180deg); }
.menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 170px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
.menu li a, .menu li button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
}
.menu li a:hover, .menu li button:hover { background: var(--soft); }
.menu li .active { font-weight: 700; }
.menu li .active::after { content: "✓"; margin-left: auto; color: var(--accent); }
.menu .code { font-size: 11px; font-weight: 700; opacity: .7; }

/* ── two-factor pages ── */
.qr { display: block; margin: 8px auto; width: 220px; height: 220px; image-rendering: pixelated; background: #fff; }
.secret { margin: 4px 0 12px; text-align: center; font-family: Consolas, "Courier New", monospace; font-size: 1rem;
  letter-spacing: .08em; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 12px 0; padding: 0; list-style: none;
  font-family: Consolas, "Courier New", monospace; font-size: 1.05rem; text-align: center; }
.button { display: block; margin-top: 20px; padding: 11px; border-radius: 10px; text-align: center; text-decoration: none;
  font-weight: 700; background: var(--accent); color: var(--accent-text); }
.button:hover { background: var(--accent-hover); }
.link-button { width: auto; min-height: 0; margin: 16px auto 0; display: block; padding: 4px; background: none;
  border: 0; color: var(--muted); font-weight: 400; font-size: 14px; text-decoration: underline; cursor: pointer; }
.link-button:hover { background: none; }

@media (max-width: 460px) {
  .card { padding: 28px 20px 22px; }
}
