/* Definet-Brand-Tokens — extrahiert aus definet.de-Logo & Theme:
   - Primary (Petrol/Teal):  #467a7e
   - Text near-black:        #1d1d1b
   - Soft background:        #f7f7f7
   - Light divider:          #e6e6e6
*/
:root {
  --teal-700: #2f5e62;
  --teal-600: #3a6e72;
  --teal-500: #467a7e;
  --teal-400: #5b9094;
  --teal-300: #8db4b7;
  --teal-50:  #eaf2f2;

  --ink-900:  #1d1d1b;
  --ink-700:  #3f3f3d;
  --ink-500:  #6b6b69;
  --ink-300:  #b6b6b3;

  --paper:    #ffffff;
  --bg:       #f7f7f7;
  --bg-soft:  #efefef;
  --line:     #e6e6e6;
  --line-strong: #d4d4d2;

  --error:     #b3261e;
  --error-bg:  #fdecea;
  --error-line:#f4b8b3;

  --shadow-xs: 0 1px 2px rgba(15, 23, 24, .06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 24, .06), 0 1px 2px rgba(15, 23, 24, .04);
  --shadow-md: 0 8px 24px rgba(15, 23, 24, .08), 0 2px 6px rgba(15, 23, 24, .05);
  --shadow-lg: 0 24px 60px rgba(15, 23, 24, .14), 0 8px 24px rgba(15, 23, 24, .08);
  --shadow-teal: 0 10px 28px rgba(70, 122, 126, .35);

  --radius-card: 20px;
  --radius-field: 12px;
  --radius-btn:   12px;

  --field-h: 52px;

  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

/* Das HTML-`hidden`-Attribut soll IMMER gewinnen, auch wenn das Element
   im CSS sonst `display: flex` o.ä. hätte. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: Poppins, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  font-size: 15px;
  color: var(--ink-900);
  line-height: 1.55;
  letter-spacing: -.005em;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 88% -8%, rgba(70, 122, 126, .14), transparent 60%),
    radial-gradient(900px 520px at -10% 105%, rgba(70, 122, 126, .10), transparent 60%),
    linear-gradient(180deg, #fafafa 0%, #f1f1f0 100%);
}

/* ---------- Layout ---------- */
.login-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 44px 40px 32px;
  position: relative;
  transition: filter .25s var(--ease), opacity .25s var(--ease);
}

/* dezenter "lift" oben am Card-Rand */
.login-card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 4px;
  border-top-left-radius: var(--radius-card);
  border-top-right-radius: var(--radius-card);
  background: linear-gradient(90deg, var(--teal-500), var(--teal-400));
  opacity: .85;
}

.login-shell.is-blurred .login-card {
  filter: blur(2px) saturate(.95);
  opacity: .55;
  pointer-events: none;
}

/* ---------- Header ---------- */
.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.logo {
  width: 62px;
  height: 62px;
  display: block;
  margin: 4px auto 18px;
  object-fit: contain;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  color: var(--ink-900);
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--ink-500);
}

/* ---------- Form ---------- */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  letter-spacing: .02em;
}

.field input {
  height: var(--field-h);
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink-900);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}

.field input::placeholder { color: var(--ink-300); }
.field input:hover { border-color: var(--ink-300); }

.field input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(70, 122, 126, .15);
  background: #fff;
}

.login-form.is-error .field input {
  border-color: var(--error);
  background: #fff;
}

.error-msg {
  margin: 0;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error-line);
  border-radius: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-msg::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  flex-shrink: 0;
}

/* ---------- Button ---------- */
.btn-primary {
  height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius-btn);
  background: linear-gradient(180deg, var(--teal-500) 0%, var(--teal-600) 100%);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: var(--shadow-teal);
  transition: transform .08s var(--ease), box-shadow .2s var(--ease), filter .15s var(--ease);
}

.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 14px 32px rgba(70, 122, 126, .42);
}

.btn-primary:active { transform: translateY(1px); }

.btn-primary:disabled {
  cursor: progress;
  filter: saturate(.7) brightness(.95);
  box-shadow: var(--shadow-sm);
}

/* ---------- Footer ---------- */
.login-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 11px;
  color: var(--ink-300);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- Shake ---------- */
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.login-form.shake { animation: shake .5s cubic-bezier(.36, .07, .19, .97) both; }

/* ---------- Erfolgs-Overlay ---------- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.success-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 24, .42);
  backdrop-filter: blur(8px) saturate(1.05);
  -webkit-backdrop-filter: blur(8px) saturate(1.05);
  z-index: 1100;
  animation: fadeIn .25s var(--ease) both;
  padding: 16px;
}

.success-overlay[hidden] { display: none; }

.success-card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 24px;
  padding: 44px 48px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: pop .42s cubic-bezier(.2, .9, .3, 1.4) both;
  position: relative;
  overflow: hidden;
}

.success-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-300), var(--teal-500));
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}

.success-emoji {
  font-size: 60px;
  line-height: 1;
  margin-bottom: 14px;
  display: inline-block;
  animation: wobble 1s var(--ease) both;
}

.success-title {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink-900);
}

.success-name {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 500;
  color: var(--teal-600);
}

.success-sub {
  margin: 0;
  font-size: 14px;
  color: var(--ink-500);
  line-height: 1.55;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pop {
  0%   { transform: scale(.86) translateY(8px); opacity: 0; }
  100% { transform: scale(1)    translateY(0);   opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes wobble {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(-8deg) scale(1.04); }
  50%  { transform: rotate(0deg);  scale: 1; }
  75%  { transform: rotate(6deg)  scale(1.04); }
  100% { transform: rotate(0deg); }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .login-card { padding: 32px 24px 22px; border-radius: 16px; }
  .login-header h1 { font-size: 22px; }
  .success-card { padding: 32px 26px; border-radius: 20px; }
  .success-title { font-size: 24px; }
  .success-emoji { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
