/* ================================================
   David-id – Auth Stylesheet (Login, Register, 2FA)
   Design: Professional Business Portal
   Phase 4 Facelift: 2026-03-17 | Agent: Kidd-FE
   ================================================ */

/* ────────────────────────────────────────────────
   DESIGN TOKENS (Auth hat kein Dark/Light Toggle –
   immer Dark, da erster Eindruck für externe User)
   ──────────────────────────────────────────────── */
:root {
  --auth-bg:          #0d1117;
  --auth-surface:     #161b25;
  --auth-surface-2:   #1e2535;
  --auth-border:      rgba(255, 255, 255, 0.08);
  --auth-border-soft: rgba(255, 255, 255, 0.05);

  --auth-accent:        #6366f1;
  --auth-accent-light:  #818cf8;
  --auth-accent-dim:    rgba(99, 102, 241, 0.12);
  --auth-accent-border: rgba(99, 102, 241, 0.3);

  --auth-success:     #22c55e;
  --auth-warning:     #f59e0b;
  --auth-danger:      #ef4444;

  --auth-text:        #e8edf5;
  --auth-text-muted:  #9aa5b8;
  --auth-text-dim:    #64748b;

  --auth-font:        'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --auth-radius:      12px;
  --auth-radius-sm:    6px;
}

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

body {
  font-family: var(--auth-font);
  min-height: 100vh;
  background: var(--auth-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--auth-text);
}

/* ── Hintergrund: subtiles Grid-Muster ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ── Sanfter Glow-Kreis oben rechts (visuelles Interesse) ── */
body::after {
  content: '';
  position: fixed;
  top: -120px;
  right: -80px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* ────────────────────────────────────────────────
   AUTH CONTAINER
   ──────────────────────────────────────────────── */
.auth-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

/* ────────────────────────────────────────────────
   LOGO / BRANDING
   ──────────────────────────────────────────────── */
.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--auth-accent-dim);
  border: 1px solid var(--auth-accent-border);
  border-radius: 14px;
  margin-bottom: 0.85rem;
  font-size: 1.5rem;
  color: var(--auth-accent-light);
}

.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.025em;
  color: var(--auth-text);
}

.auth-logo p {
  margin: 0.35rem 0 0;
  color: var(--auth-text-dim);
  font-size: 0.875rem;
}

/* ────────────────────────────────────────────────
   AUTH CARD
   ──────────────────────────────────────────────── */
.auth-card {
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.auth-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--auth-border-soft);
}

.auth-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--auth-text);
  letter-spacing: -0.01em;
}

.auth-header p {
  margin: 0.3rem 0 0;
  color: var(--auth-text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
}

.auth-body { padding: 1.75rem; }

.auth-footer {
  padding: 1rem 1.75rem;
  background: rgba(255, 255, 255, 0.018);
  border-top: 1px solid var(--auth-border-soft);
  text-align: center;
  font-size: 0.82rem;
  color: var(--auth-text-dim);
}

.auth-footer a {
  color: var(--auth-accent-light);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

/* ────────────────────────────────────────────────
   FORM ELEMENTS
   ──────────────────────────────────────────────── */
.form-label {
  font-weight: 500;
  font-size: 0.82rem;
  margin-bottom: 6px;
  color: var(--auth-text-muted);
  display: block;
}

.form-control {
  background: var(--auth-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--auth-radius-sm);
  padding: 0.72rem 1rem;
  font-size: 0.9rem;
  color: var(--auth-text);
  font-family: var(--auth-font);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  outline: none;
}

.form-control:focus {
  background: var(--auth-surface-2);
  border-color: var(--auth-accent-border);
  box-shadow: 0 0 0 3px var(--auth-accent-dim);
  color: var(--auth-text);
}

.form-control::placeholder { color: var(--auth-text-dim); }

.input-group-text {
  background: var(--auth-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--auth-text-dim);
  border-radius: var(--auth-radius-sm) 0 0 var(--auth-radius-sm);
}

.input-group .form-control { border-left: none; }

/* ── Submit Button ── */
.btn-primary {
  background: var(--auth-accent);
  border: none;
  border-radius: var(--auth-radius-sm);
  padding: 0.72rem 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  width: 100%;
  color: #ffffff;
  font-family: var(--auth-font);
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: var(--auth-accent-light);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border-soft);
}

.auth-divider span {
  padding: 0 1rem;
  color: var(--auth-text-dim);
  font-size: 0.78rem;
}

/* ────────────────────────────────────────────────
   ALERTS
   ──────────────────────────────────────────────── */
.alert {
  border-radius: var(--auth-radius-sm);
  border: 1px solid;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

.alert-info {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

/* ────────────────────────────────────────────────
   2FA CODE INPUT
   ──────────────────────────────────────────────── */
.code-input {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.code-input input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  background: var(--auth-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--auth-radius-sm);
  color: var(--auth-text);
  font-family: var(--auth-font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.code-input input:focus {
  border-color: var(--auth-accent-border);
  box-shadow: 0 0 0 3px var(--auth-accent-dim);
}

/* ────────────────────────────────────────────────
   PASSWORD STRENGTH
   ──────────────────────────────────────────────── */
.password-strength {
  height: 3px;
  border-radius: 99px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  transition: width 0.3s, background-color 0.3s;
}

.strength-weak   { width: 25%; background: var(--auth-danger); }
.strength-fair   { width: 50%; background: var(--auth-warning); }
.strength-good   { width: 75%; background: var(--auth-success); }
.strength-strong { width: 100%; background: #10b981; }

/* ────────────────────────────────────────────────
   PASSWORD TOGGLE
   ──────────────────────────────────────────────── */
.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--auth-text-dim);
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}

.password-toggle:hover { color: var(--auth-text-muted); }
.form-floating { position: relative; }

/* ────────────────────────────────────────────────
   CHECKBOX / FORM CHECK
   ──────────────────────────────────────────────── */
.form-check-input {
  background-color: var(--auth-surface-2);
  border-color: rgba(255, 255, 255, 0.15);
}

.form-check-input:checked {
  background-color: var(--auth-accent);
  border-color: var(--auth-accent);
}

.form-check-label {
  color: var(--auth-text-muted);
  font-size: 0.875rem;
}

/* ── Utility ── */
.text-muted { color: var(--auth-text-muted) !important; }

/* ────────────────────────────────────────────────
   RESPONSIVE – Mobile
   ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  body {
    padding: 0;
    align-items: flex-start;
    background: var(--auth-bg);
  }

  .auth-container {
    padding: 1.5rem 1rem 2rem;
    max-width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .auth-logo { margin-bottom: 1.25rem; }

  .auth-card { border-radius: 12px; }

  .auth-body { padding: 1.5rem 1.25rem; }

  /* iOS Auto-Zoom verhindern */
  .form-control {
    font-size: 16px;
    min-height: 46px;
  }

  .btn-primary { min-height: 46px; font-size: 1rem; }

  .code-input input {
    width: 44px;
    height: 52px;
    font-size: 1.25rem;
  }

  .code-input { gap: 0.35rem; }
}

/* ────────────────────────────────────────────────
   SPLIT LAYOUT (Facelift 2026-03-18)
   ──────────────────────────────────────────────── */

/* Split Wrapper: body kein Centering mehr auf Desktop */
body {
  display: block;
  padding: 0;
  align-items: unset;
  justify-content: unset;
}

.auth-split {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Linke Seite: Visual / Canvas ── */
.auth-visual {
  flex: 0 0 50%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #040b18 0%, #0a1628 40%, #060d1a 100%);
}

#particleCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Subtiler Vignette-Overlay rechts (Übergang zum Form-Panel) */
.auth-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 70%, rgba(13, 17, 23, 0.6) 100%);
  pointer-events: none;
}

/* Branding zentriert auf der linken Seite */
.auth-brand {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  width: 80%;
}

.auth-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 20px;
  font-size: 1.8rem;
  color: #06b6d4;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.15);
}

.auth-brand h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #e8edf5 30%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand > p {
  color: #6b8aad;
  font-size: 0.95rem;
  margin: 0 0 2rem;
  letter-spacing: 0.01em;
}

.auth-brand-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-brand-badges span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  font-size: 0.75rem;
  color: #8899b0;
}

.auth-brand-badges span i {
  font-size: 0.7rem;
  color: #06b6d4;
}

/* ── Rechte Seite: Formular ── */
.auth-form-panel {
  flex: 0 0 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: var(--auth-bg);
  position: relative;
}

/* Container innerhalb des Form-Panels */
.auth-form-panel .auth-container {
  max-width: 400px;
  width: 100%;
}

/* Glassmorphism-Karte */
.auth-form-panel .auth-card {
  background: rgba(22, 27, 37, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 40px rgba(99, 102, 241, 0.07),
    0 24px 64px rgba(0, 0, 0, 0.5);
  position: relative;
}

/* Cyan-Akzent-Linie oben an der Karte */
.auth-form-panel .auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #06b6d4 30%, #6366f1 70%, transparent);
  border-radius: 99px;
}

/* ── Responsive: Tablet / Mobile ── */
@media (max-width: 900px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
  }

  .auth-split {
    display: block;
    min-height: unset;
  }

  .auth-visual { display: none; }

  .auth-form-panel {
    flex: unset;
    display: block;
    padding: 0;
    background: transparent;
  }

  .auth-form-panel .auth-container {
    max-width: 420px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0;
    align-items: flex-start;
    display: block;
  }

  .auth-form-panel .auth-container {
    padding: 1.5rem 1rem 2rem;
    max-width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}
