/* ==== Import Design System Variables ==== */
@import url('../core/variables.css');

/* ==== Base Font Reset ==== */
.osac-register-wrap,
.osac-register-wrap * {
  font-family: var(--osb-font-primary);
}

.osac-register-wrap h2.osac-title {
  font-family: var(--osb-font-heading);
  font-size: var(--osb-text-3xl);
  font-weight: var(--osb-font-bold);
  color: var(--osb-text-dark);
  margin-bottom: var(--osb-space-6);
}

/* ==== Main Card Layout ==== */
.osac-card {
  max-width: 720px;
  margin: 40px auto;
  padding: 32px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
  .osac-card {
    padding: 24px;
    margin: 20px auto;
  }
}

/* ==== Grund-Styling für Formular-Elemente ==== */
/* ==== Flash Messages / Notices ==== */
.osac-flash {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid;
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.6;
}

.osac-flash--success {
  background-color: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.osac-flash--error {
  background-color: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.osac-flash--warning {
  background-color: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.osac-flash a {
  /* Wir heben den Link jetzt stärker hervor */
  font-weight: 600;
  text-decoration: underline;
  background-color: rgba(0, 0, 0, 0.07);
  /* Leichter Hintergrund */
  padding: 3px 8px;
  /* Etwas Innenabstand */
  border-radius: 5px;
  /* Runde Ecken */
  transition: background-color 0.2s ease;
  display: inline-block;
  /* Sorgt für korrektes Rendering */
  margin-left: 8px;
  /* Etwas Abstand zum Text */
}

.osac-flash a:hover {
  background-color: rgba(0, 0, 0, 0.12);
  /* Etwas dunkler beim Hovern */
  text-decoration: underline;
  /* Unterstreichung beibehalten */
}

#osac-register-form label {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
}

#osac-register-form input[type="text"],
#osac-register-form input[type="email"],
#osac-register-form input[type="password"],
#osac-register-form input[type="tel"],
#osac-register-form textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  box-sizing: border-box;
}

#osac-register-form input:focus,
#osac-register-form textarea:focus {
  outline: none;
  border-color: #5ca9ff;
  box-shadow: 0 0 0 3px rgba(92, 169, 255, .20);
}

#osac-register-form .osac-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

#osac-register-form .osac-agent-panel {
  background: #f6f9fc;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-top: 12px;
}

#osac-register-form [hidden] {
  display: none !important;
}

/* ==== Responsive Grid-Layout ==== */
@media (min-width: 768px) {
  #osac-register-form .osac-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
  }
}

/* ==== Real-time Validation States ==== */
#osac-register-form input.osac-field-valid {
  border-color: #10b981;
  box-shadow: 0 0 0 1px #10b981;
}

#osac-register-form input.osac-field-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}

#osac-register-form .osac-checkbox input.osac-field-invalid + span,
#osac-register-form .osac-checkbox input[aria-invalid="true"] + span {
  color: #dc2626;
}

/* ==== Fehler-Styling ==== */
.osac-error-message {
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
}

#osac-register-form input[aria-invalid="true"],
#osac-register-form textarea[aria-invalid="true"] {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}

/* ==== E-Mail Suggestion (Final Polished Version) ==== */
.osac-email-suggestion {
  margin-top: 8px;
  padding: 10px 14px;
  font-size: 14px;
  background-color: #f8fafc;
  /* Dezentes Hellgrau */
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  /* Sanfterer Text */
}

.osac-email-suggestion[hidden] {
  display: none !important;
}

.osac-email-suggestion button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: #2563eb;
  /* Klares Blau */
  text-decoration: none;
  cursor: pointer;
  border-radius: 4px;
}

.osac-email-suggestion button:hover {
  text-decoration: underline;
}

.osac-email-suggestion button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ==== Compact Password UI ==== */
.osac-pw-ui {
  margin-top: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
}

.osac-pw-strength {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  align-items: center;
}

.osac-pw-strength .bar {
  width: 28px;
  height: 6px;
  border-radius: 4px;
  background: #e5e7eb;
  transition: background .2s;
}

.osac-pw-strength .label {
  margin-left: 8px;
  font-size: 12px;
  color: #64748b;
}

.osac-pw-strength.level-1 .bar:nth-child(1) {
  background: #ef4444;
}

.osac-pw-strength.level-2 .bar:nth-child(-n+2) {
  background: #f59e0b;
}

.osac-pw-strength.level-3 .bar:nth-child(-n+3) {
  background: #10b981;
}

/* KORRIGIERT */
.osac-pw-strength.level-4 .bar {
  background: #10b981;
}

.osac-pw-toggle {
  background: none;
  border: 0;
  color: #475569;
  font-size: 12px;
  padding: 4px;
  cursor: pointer;
  text-decoration: underline;
}

.osac-pw-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 6px;
}

.osac-pw-suggest {
  background: var(--osb-brand-primary-light, #e8f1f7);
  border: 1px solid var(--osb-brand-primary, #26577C);
  color: var(--osb-brand-primary, #26577C);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: 0;
}

.osac-pw-suggest:hover {
  background: var(--osb-brand-primary, #26577C);
  color: #ffffff;
}

.osac-pw-suggest:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.osac-pw-rules {
  flex-basis: 100%;
  margin-top: 4px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
}

.osac-pw-rules ul {
  margin: 0;
  padding-left: 0;
  columns: 2;
  column-gap: 24px;
}

.osac-pw-rules li {
  list-style: none;
  position: relative;
  margin: 6px 0 0;
  padding-left: 18px;
  color: #64748b;
}

.osac-pw-rules li::before {
  content: '✕';
  position: absolute;
  left: 0;
  top: 0;
  color: #ef4444;
}

.osac-pw-rules li.ok {
  color: #0f766e;
}

.osac-pw-rules li.ok::before {
  content: '✓';
  color: #0ea5e9;
}

@media (max-width: 720px) {
  .osac-pw-rules ul {
    columns: 1;
  }
}

/* ==== Actions Container ==== */
.osac-actions {
  display: flex;
  justify-content: center;
  margin-top: var(--osb-space-6);
}

/* Button Styling (outside .osb-container) */
.osac-register-wrap .osb-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 200px;
  padding: var(--osb-btn-padding);
  font-family: var(--osb-font-primary);
  font-size: var(--osb-btn-font-size);
  font-weight: var(--osb-btn-font-weight);
  text-decoration: none;
  border: none;
  border-radius: var(--osb-btn-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.osac-register-wrap .osb-btn.osb-btn-cta {
  background: linear-gradient(135deg, var(--osb-btn-cta-bg) 0%, var(--osb-btn-cta-bg-hover) 100%);
  color: var(--osb-btn-cta-text);
  box-shadow: 0 4px 6px var(--osb-btn-cta-shadow);
}

.osac-register-wrap .osb-btn.osb-btn-cta:hover {
  background: linear-gradient(135deg, var(--osb-btn-cta-bg-hover) 0%, #004d75 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--osb-btn-cta-shadow);
}

/* ==== Password Visibility Toggle ==== */
.osac-input-wrapper {
  position: relative;
}

/* Passt das Padding der Passwortfelder an, damit Text nicht unter dem Icon liegt */
.osac-input-wrapper input[type="password"],
.osac-input-wrapper input[type="text"] {
  padding-right: 48px;
  /* Platz für den Button schaffen */
}

.osac-pw-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);

  /* Button-Styling zurücksetzen */
  background: none;
  border: none;
  padding: 8px;
  margin: 0;
  cursor: pointer;

  /* Icon-Styling */
  width: 20px;
  height: 20px;
  opacity: 0.5;
  transition: opacity 0.2s ease;

  /* Das Auge-Icon (SVG als Data-URL) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23475569'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.osac-pw-visibility-toggle:hover {
  opacity: 0.8;
}

/* === OSAC Register – Layout Hotfix (defensiv) === */
.osac-register-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

/* Fallback-Grid für Felder/Spalten, falls Theme/Builder nichts liefert */
#osac-register-form .osac-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  #osac-register-form .osac-grid {
    grid-template-columns: 1fr 1fr;
  }
}

#osac-register-form .osac-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

/* Breite & Fokus verlässlich */
.osac-register-wrap input[type="text"],
.osac-register-wrap input[type="email"],
.osac-register-wrap input[type="password"] {
  width: 100%;
  box-sizing: border-box;
}

.osac-register-wrap :focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Passwort-Stärke-Anzeige – Tippfehler-Fix */
.osac-pw-strength.level-3 .bar:nth-child(-n+3) {
  background: #f59e0b;
}

/* ==== Social Login & Divider ==== */
.osac-social-login {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.osac-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: #64748b;
  font-size: 14px;
}

.osac-divider::before,
.osac-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.osac-divider span {
  padding: 0 16px;
  font-weight: 600;
  color: var(--osb-text-main, #333333);
}

/* ==== Terms & Conditions Checkbox ==== */
.osac-terms {
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.osac-terms a {
  color: #2563eb;
  text-decoration: underline;
}

.osac-terms a:hover {
  color: #1d4ed8;
}

/* ==== Centered Form Elements ==== */
.osac-title {
  text-align: center;
}

.osac-pw-ui {
  justify-content: space-between !important;
  width: 100% !important;
  padding: 0 40px !important;
  box-sizing: border-box;
}

.osac-terms {
  justify-content: center;
  text-align: center;
}

.osac-checkbox.osac-partner-toggle {
  justify-content: center;
  margin-top: 16px;
}

.osac-agent-panel .osac-terms {
  justify-content: center;
}

.osac-divider-partner {
  margin-top: 24px;
}

/* Partner Panel Centered Layout */
.osac-agent-panel .osac-actions {
  justify-content: center;
}

.osac-agent-panel .osac-partner-info {
  text-align: center;
  color: #64748b;
  margin-bottom: 16px;
}

/* Full-width field in partner panel */
.osac-field-full {
  grid-column: 1 / -1;
}

/* ==== Login Link ==== */
.osac-login-link {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  font-size: 14px;
  color: #64748b;
}

.osac-login-link a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.osac-login-link a:hover {
  text-decoration: underline;
}

/* Verify Pending Page */
.osac-verify-pending {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
  padding: 40px;
}

.osac-verify-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.osac-verify-pending .osac-title {
  margin-bottom: 24px;
}

.osac-verify-text {
  color: var(--osb-text-main, #333333);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.osac-verify-text strong {
  color: var(--osb-brand-primary, #26577C);
  word-break: break-all;
}

.osac-verify-actions {
  margin: 32px 0;
}

.osac-verify-help {
  font-size: 14px;
  color: #64748b;
  margin-top: 24px;
}

.osac-verify-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
  font-size: 14px;
}

.osac-verify-footer a {
  color: var(--osb-brand-primary, #26577C);
  text-decoration: none;
}

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