/*
 * Identity screens for Οπτικά Σταύρακας — the storefront's design system applied to
 * Keycloak's flows, so signing in never feels like leaving the shop.
 *
 * Tokens are copied from storefront/app/globals.css (both themes), which stays the single
 * source of truth for the palette. This is the only stylesheet on the page: the theme
 * inherits base templates rather than PatternFly, so nothing here needs !important.
 */

:root {
  /* Eye icons for the password toggle, inlined so the page pulls no external asset. */
  --eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --eye-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20C5 20 1 12 1 12a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");

  --ink: #14222d;
  --ink-soft: #3d5265;
  --paper: #ffffff;
  --tint: #eff5f9;
  --line: #d9e4ec;
  --accent: #0b91d2;
  --accent-ink: #076d9f;
  --accent-soft: #e1f2fa;
  --sun: #e4572e;
  --sun-soft: #fceae3;
  --ok: #1e8e68;
  --ok-soft: #e3f3ec;
  --card: #ffffff;
  --radius: 10px;
  --radius-lg: 14px;
  --display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4eef5;
    --ink-soft: #93a9ba;
    --paper: #0d161e;
    --tint: #121f2a;
    --line: #24384a;
    --accent: #38b6f0;
    --accent-ink: #5fc5f4;
    --accent-soft: #0e2938;
    --sun: #ff7a50;
    --sun-soft: #33180e;
    --ok: #3fbf8f;
    --ok-soft: #0d2a1f;
    --card: #14222d;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.auth {
  margin: 0;
  min-height: 100vh;
  background: var(--tint);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-shell {
  width: 100%;
  max-width: 430px;
}

/* ── brand ──────────────────────────────────────────────────────────────── */
.auth-brand {
  display: block;
  text-align: center;
  margin-bottom: 22px;
  line-height: 0;
}
.auth-brand img {
  height: 62px;
  width: auto;
  max-width: 100%;
  border-radius: 8px;
}
@media (prefers-color-scheme: dark) {
  /* The logo asset has an opaque white ground — give it a chip on dark surfaces. */
  .auth-brand img {
    background: #fff;
    padding: 4px 9px;
  }
}

/* ── card ───────────────────────────────────────────────────────────────── */
.auth-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -34px color-mix(in srgb, var(--ink) 40%, transparent);
  padding: 28px 28px 24px;
}

/* Signature: the lens rings from the storefront hero, kept faint and used once. */
.auth-rings {
  position: absolute;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, transparent 78px,
      color-mix(in srgb, var(--accent) 16%, transparent) 79px, transparent 81px),
    radial-gradient(circle at 50% 50%, transparent 112px,
      color-mix(in srgb, var(--accent) 11%, transparent) 113px, transparent 115px),
    radial-gradient(circle at 50% 50%, transparent 146px,
      color-mix(in srgb, var(--accent) 7%, transparent) 147px, transparent 149px);
}

.auth-head {
  position: relative;
  margin-bottom: 18px;
}
.auth-title {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}
.auth-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.auth-note .req,
.required {
  color: var(--sun);
}
.auth-user {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink-soft);
}
.auth-user a {
  font-size: 12.5px;
}

/* ── form ───────────────────────────────────────────────────────────────── */
.auth-form,
form#kc-form-login,
form.auth-form {
  display: grid;
  gap: 14px;
  position: relative;
}
#kc-form-wrapper {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 5px;
}
.field-label,
label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field-input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.field-input:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[aria-invalid="true"],
/* Password field: the input and its show/hide button share one box. */
.field-group {
  position: relative;
  display: block;
}
.field-group .field-input {
  /* Room for the button, so a long password never runs underneath it. */
  padding-right: 44px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.pw-toggle:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.pw-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Drawn as masks rather than a webfont: this theme ships no icon font, and the script swaps only
   the class on the <i>, so each state needs its own picture. currentColor keeps it on the button. */
.pw-eye,
.pw-eye-off {
  display: block;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 18px 18px;
  mask-size: 18px 18px;
}
.pw-eye {
  -webkit-mask-image: var(--eye);
  mask-image: var(--eye);
}
.pw-eye-off {
  -webkit-mask-image: var(--eye-off);
  mask-image: var(--eye-off);
}

.field-input[aria-invalid="true"] {
  border-color: var(--sun);
}
.field-error,
#input-error,
span.field-error {
  display: block;
  font-size: 12.5px;
  color: var(--sun);
}

/* Password fields carry Keycloak's show/hide toggle button. */
.field-wrap {
  position: relative;
}
.field-wrap button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 6px 8px;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 8px;
}
.field-wrap button:hover {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ── options row (remember me / forgot password) ─────────────────────────── */
.auth-options,
#kc-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}
.auth-options label,
#kc-form-options label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.check-input,
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn,
input[type="submit"],
button[type="submit"] {
  font: inherit;
  font-weight: 600;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  padding: 12px 24px;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary,
input[type="submit"].btn-primary,
button.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}
.btn:not(.btn-primary):hover {
  border-color: var(--ink);
}
.btn-block,
.btn-lg {
  width: 100%;
}
.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

/* ── social providers (Google / Apple, once configured) ─────────────────── */
.social-section,
#kc-social-providers {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
#kc-social-providers > h2,
.social-section h2 {
  font-family: var(--body);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px;
  text-align: center;
}
.social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.social-item a,
.social-list a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 11px 18px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.social-item a:hover {
  border-color: var(--ink);
  text-decoration: none;
}

/* ── links, info, alerts ────────────────────────────────────────────────── */
a {
  color: var(--accent-ink);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.auth-info,
#kc-info {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: center;
}
.auth-alert {
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.auth-alert-error {
  background: var(--sun-soft);
  color: var(--sun);
  border-color: color-mix(in srgb, var(--sun) 35%, transparent);
}
.auth-alert-success {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 32%, transparent);
}
.auth-alert-warning,
.auth-alert-info {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

/* ── footer ─────────────────────────────────────────────────────────────── */
.auth-foot {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.auth-locale {
  display: flex;
  gap: 6px;
}
.auth-locale a {
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid transparent;
  color: var(--ink-soft);
}
.auth-locale a.on {
  border-color: var(--line);
  background: var(--card);
  color: var(--ink);
}

/* Keycloak's inherited wrappers shouldn't introduce stray boxes in our grid. */
#kc-content,
#kc-content-wrapper,
#kc-form,
.auth-settings {
  display: contents;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 22px 20px 20px;
  }
  .auth-title {
    font-size: 21px;
  }
}
