/* ==== Base / Reset ======================================================= */
:root {
  /* Brand & surfaces (light) */
  --brand-1: #6a11cb;
  --brand-2: #2575fc;
  --brand-3: #4a6cf7;        /* hover/active mix */
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --text: #101418;
  --text-dim: #5b6675;
  --border: #e6e8ef;

  /* Effects */
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-1: 0 8px 24px rgba(16, 20, 24, 0.12);
  --shadow-2: 0 20px 40px rgba(16, 20, 24, 0.14);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: rgba(20, 24, 28, 0.7);
    --surface-2: #0e1116;
    --text: #eef1f6;
    --text-dim: #aab2bf;
    --border: rgba(255, 255, 255, 0.14);
    --shadow-1: 0 10px 28px rgba(0, 0, 0, 0.45);
    --shadow-2: 0 30px 60px rgba(0, 0, 0, 0.55);
  }
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(106,17,203,0.20), transparent 60%),
    radial-gradient(1200px 800px at 110% 110%, rgba(37,117,252,0.20), transparent 60%),
    linear-gradient(135deg, #0b1020, #0e1729);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Mobile tap highlight */
  -webkit-tap-highlight-color: transparent;
}

@supports (backdrop-filter: blur(10px)) {
  .has-blur { backdrop-filter: blur(12px); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ==== Layout ============================================================= */
.container {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  padding: 24px;
}

.login-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(10px);
}

.login-card h1,
.card h1 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem);
  margin: 4px 0 18px;
  letter-spacing: -0.02em;
}

.login-card p { color: var(--text-dim); }

/* ==== Form =============================================================== */
form { margin-top: 6px; }

.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 14px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.7);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

@media (prefers-color-scheme: dark) {
  .input-group input {
    background: rgba(255,255,255,0.04);
  }
}

.input-group input::placeholder { color: transparent; } /* for floating label */

.input-group input:focus {
  border-color: color-mix(in oklab, var(--brand-2) 60%, var(--brand-1));
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand-2) 18%, transparent);
  background: rgba(255,255,255,0.86);
}
@media (prefers-color-scheme: dark) {
  .input-group input:focus {
    background: rgba(255,255,255,0.08);
  }
}

.input-group label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--text-dim);
  pointer-events: none;
  padding: 0 6px;
  background: var(--surface);
  transition: transform .18s, top .18s, font-size .18s, color .18s, background .18s;
}

/* Float on focus or when there's content */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 0;
  transform: translateY(-50%) translateY(-8px);
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--brand-2) 70%, var(--text-dim));
}

/* Autofill (Chrome/Android) */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
  border: 1px solid var(--border);
}

input[type="email"],
input[type="password"] {
  font-variant-numeric: lining-nums tabular-nums;
}

/* ==== Buttons ============================================================ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;               /* große Touch-Ziele */
  padding: 12px 18px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .01em;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  background-image: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff;
  box-shadow: var(--shadow-1);
}

.button:hover {
  box-shadow: var(--shadow-2);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible {
  outline: 0;
  box-shadow:
    0 0 0 4px color-mix(in oklab, var(--brand-2) 20%, transparent),
    var(--shadow-2);
}

.button[disabled],
.button:disabled {
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Outline variant */
.button.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.button.outline:hover {
  background: color-mix(in oklab, var(--surface) 80%, var(--brand-2));
  border-color: color-mix(in oklab, var(--brand-2) 45%, var(--border));
}

/* Google button (neutral, works in dark & light) */
.button.google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  .button.google {
    background: #ffffff;
    color: #111;
    border-color: #e3e3e3;
  }
}
.button.google:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

/* Actions (logged-in view) */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

/* ==== Links & small UI =================================================== */
.signup-link {
  margin-top: 10px;
  font-size: .95rem;
}
.signup-link a {
  color: color-mix(in oklab, var(--brand-2) 75%, #fff);
  text-decoration: none;
  font-weight: 600;
}
.signup-link a:hover { text-decoration: underline; }

/* Divider with lines */
.divider {
  --line: color-mix(in oklab, var(--border) 80%, transparent);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 14px 0 8px;
  color: var(--text-dim);
  font-size: .9rem;
}
.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

/* Alerts (optional usage) */
.alert {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.alert.error {
  border-color: color-mix(in oklab, crimson 40%, var(--border));
  background: color-mix(in oklab, crimson 10%, var(--surface-2));
}

/* ==== Responsive tweaks ================================================== */
@media (min-width: 480px) {
  .login-card,
  .card { padding: 32px; }
}

@media (min-width: 768px) {
  .container { max-width: 460px; }
}

/* ==== Nice-to-have (optional utility) =================================== */
/* Subtle animated gradient sheen on primary button (keine Dauer-Animation) */
.button:not(.outline):not(.google):hover {
  background-image:
    linear-gradient(135deg, var(--brand-1), var(--brand-3) 40%, var(--brand-2));
}

/* Platz rechts im Feld für den Button schaffen */
.input-group input {
  padding-right: 48px; /* genug für Icon-Touch-Zone */
}

/* Toggle-Button im Feld */
.toggle-password {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  height: 36px;
  width: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: background .2s, border-color .2s, box-shadow .2s;
}

/* Fokus & Hover für gute Accessibility */
.toggle-password:hover {
  background: rgba(0,0,0,0.04);
}
@media (prefers-color-scheme: dark) {
  .toggle-password:hover { background: rgba(255,255,255,0.06); }
}
.toggle-password:focus-visible {
  border-color: color-mix(in oklab, var(--brand-2) 55%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand-2) 20%, transparent);
}

/* SVG-Icons */
.toggle-password .icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  color: var(--text-dim);
}

/* Standard: Auge sichtbar, Auge-durchgestrichen versteckt */
.toggle-password .eye-off { display: none; }

/* Wenn Passwort gerade sichtbar ist */
.toggle-password.is-visible .eye { display: none; }
.toggle-password.is-visible .eye-off { display: block; }

/* Größere Touch-Zone auf Touch-Geräten */
@media (pointer: coarse) {
  .toggle-password { height: 40px; width: 40px; right: 6px; }
  .input-group input { padding-right: 56px; }
}
