/* =============================================
   Energieausweis-Portal – Shared Styles
   RLA Solutions
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --primary: #1a56db;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --primary-50: #eff6ff;
  --accent: #0ea5e9;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --green-500: #22c55e;
  --red-500: #ef4444;
  --red-50: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.03);
  --radius: 16px;
  --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Auth Layout */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

.auth-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--accent) 100%);
  z-index: 0;
}

.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 480px;
}

.auth-card.wide { max-width: 560px; }

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: none;
  margin-bottom: 32px;
}

.auth-logo svg { width: 22px; height: 22px; color: var(--primary); }

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-card .auth-subtitle {
  text-align: center;
  font-size: 14.5px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label .required {
  color: var(--red-500);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input.error { border-color: var(--red-500); }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12.5px;
  color: var(--red-500);
  margin-top: 4px;
  display: none;
}

.form-error.visible { display: block; }

/* Account Type Toggle */
.account-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.account-toggle-btn {
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.account-toggle-btn:hover {
  border-color: var(--primary-light);
  background: var(--primary-50);
}

.account-toggle-btn.active {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.15);
}

.account-toggle-btn .toggle-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.account-toggle-btn .toggle-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.account-toggle-btn .toggle-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: block;
}

/* Conditional Fields */
.business-fields {
  display: none;
  padding: 20px;
  background: var(--primary-50);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid rgba(26, 86, 219, 0.1);
}

.business-fields.visible { display: block; }

.business-fields .form-group:last-child { margin-bottom: 0; }

/* Password Strength */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.password-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}

.password-strength-bar.weak { background: var(--red-500); }
.password-strength-bar.medium { background: #f59e0b; }
.password-strength-bar.strong { background: var(--green-500); }

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn-primary.loading .spinner { display: block; }
.btn-primary.loading .btn-text { display: none; }

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

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 20px;
  display: none;
  line-height: 1.5;
}

.alert.visible { display: block; }

.alert-error {
  background: var(--red-50);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Footer Link */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

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

/* Row layout */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}
