/* =============================================
   KImatiX Auth Gate – auth.css
   ============================================= */

/* ── Overlay ─────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

/* ── Card ────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: fadeIn 0.25s ease;
}

/* ── Logo ────────────────────────────────────── */
.auth-logo {
  margin-bottom: 0.75rem;
}

.auth-logo-img {
  height: 36px;
  width: auto;
}

/* ── Titel ───────────────────────────────────── */
.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin: 0;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 1.25rem;
}

/* ── Formular ────────────────────────────────── */
.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.auth-field input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.auth-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 213, 173, 0.12);
  background: var(--surface);
}

.auth-field input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ── Passwort-Toggle ─────────────────────────── */
.auth-pw-wrap {
  position: relative;
}

.auth-pw-wrap input {
  padding-right: 2.6rem;
}

.auth-pw-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0.2rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.auth-pw-toggle:hover { color: var(--teal-dark); }

/* ── Fehlermeldung ───────────────────────────── */
.auth-error {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
  line-height: 1.5;
}

/* ── Submit-Button ───────────────────────────── */
.auth-submit {
  width: 100%;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, transform 0.1s;
  margin-top: 0.25rem;
}

.auth-submit:hover:not(:disabled) {
  background: var(--teal-dark);
  transform: scale(1.01);
}

.auth-submit:disabled {
  background: var(--border);
  cursor: not-allowed;
  transform: none;
}

/* ── Spinner ─────────────────────────────────── */
.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Logout-Button im Header ─────────────────── */
.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  margin-left: 0.4rem;
}

.logout-btn:hover {
  color: #ef4444;
  background: #fff5f5;
}

/* ── Hidden-Zustände ─────────────────────────── */
#appHeader[hidden],
#appMain[hidden],
.auth-overlay[hidden] {
  display: none !important;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.25rem;
  }
}
