/* ─── Contact Form Plugin Frontend Styles ──────────────────────────────────
   Alle Farben orientieren sich an den Theme-Variablen (--theme-*), damit
   das Formular in jedem Theme konsistent aussieht. Fallbacks nur für den
   Fall, dass ein Theme die Variablen nicht definiert. */

.icms-cf-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
  width: 100%;
  font-family: var(--theme-font-family, inherit);
  color: var(--theme-text, #111827);
}

/* Style variants */
.icms-cf-style-default {
  padding: 1.5rem;
  border: 1px solid var(--theme-border, rgba(0, 0, 0, 0.08));
  border-radius: var(--theme-radius, 0.875rem);
  background: var(--theme-card-bg, #fff);
}

.icms-cf-style-boxed {
  padding: 2rem;
  border: 1px solid var(--theme-border, rgba(0, 0, 0, 0.06));
  border-radius: var(--theme-radius, 1rem);
  background: var(--theme-card-bg, #fff);
  box-shadow: var(--theme-card-shadow, 0 4px 24px -8px rgba(0, 0, 0, 0.12));
}

.icms-cf-style-minimal {
  padding: 0;
  border: none;
  background: transparent;
}

/* Honeypot – hidden from users */
.icms-cf-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.icms-cf-title {
  font-size: 1.25rem;
  font-weight: var(--theme-heading-font-weight, 700);
  font-family: var(--theme-heading-font-family, inherit);
  color: var(--theme-text, #111827);
  margin: 0 0 0.25rem;
}

/* Fields */
.icms-cf-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.icms-cf-field-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
}

.icms-cf-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--theme-text, #334155);
}

.icms-cf-required {
  color: #ef4444;
}

.icms-cf-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--theme-border, rgba(0, 0, 0, 0.15));
  border-radius: var(--theme-radius, 0.5rem);
  background: var(--theme-card-bg, #fff);
  color: var(--theme-text, #1e293b);
  font-size: 0.9375rem;
  font-family: var(--theme-font-family, inherit);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.icms-cf-input:focus {
  border-color: var(--theme-primary, #6366f1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary, #6366f1) 18%, transparent);
}

.icms-cf-input::placeholder {
  color: var(--theme-text-muted, #94a3b8);
}

.icms-cf-textarea {
  resize: vertical;
  min-height: 120px;
}

.icms-cf-input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

.icms-cf-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--theme-text, #334155);
  cursor: pointer;
}

.icms-cf-checkbox-input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.125rem;
  cursor: pointer;
  accent-color: var(--theme-primary, #6366f1);
}

/* Field error messages */
.icms-cf-field-error {
  font-size: 0.8125rem;
  color: #ef4444;
  margin-top: 0.125rem;
}

/* Actions */
.icms-cf-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.icms-cf-submit {
  padding: 0.625rem 1.5rem;
  border: none;
  border-radius: var(--theme-radius, 0.5rem);
  background: var(--theme-primary, #6366f1);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--theme-font-family, inherit);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.icms-cf-submit:hover:not(:disabled) {
  background: var(--theme-primary-hover, #4f46e5);
}

.icms-cf-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.icms-cf-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.icms-cf-submitting {
  opacity: 0.7;
}

/* Success / Error messages */
.icms-cf-success,
.icms-cf-error {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.icms-cf-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.icms-cf-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ─── Confirmation dialog (modal) ─────────────────────────────────── */

.icms-cf-modal-open {
  overflow: hidden;
}

.icms-cf-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  animation: icms-cf-fade-in 0.18s ease-out;
}

.icms-cf-confirm-dialog {
  width: 100%;
  max-width: 440px;
  background: var(--theme-card-bg, #fff);
  border-radius: var(--theme-radius, 1rem);
  box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.3);
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  font-family: var(--theme-font-family, inherit);
  color: var(--theme-text, #1e293b);
  animation: icms-cf-pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.icms-cf-confirm-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ecfdf5;
  color: #059669;
}

.icms-cf-confirm-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: var(--theme-heading-font-weight, 700);
  color: var(--theme-text, #1e293b);
}

.icms-cf-confirm-message {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--theme-text, #334155);
}

.icms-cf-confirm-hint {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--theme-text-muted, #64748b);
  background: color-mix(in srgb, var(--theme-border, #f1f5f9) 30%, transparent);
  border-radius: var(--theme-radius, 0.5rem);
  padding: 0.625rem 0.875rem;
}

.icms-cf-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.icms-cf-confirm-close {
  padding: 0.625rem 1.75rem;
  border: none;
  border-radius: var(--theme-radius, 0.5rem);
  background: var(--theme-primary, #6366f1);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--theme-font-family, inherit);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.icms-cf-confirm-close:hover {
  background: var(--theme-primary-hover, #4f46e5);
}

.icms-cf-confirm-close:active {
  transform: scale(0.98);
}

.icms-cf-confirm-close:focus-visible {
  outline: 2px solid var(--theme-primary, #6366f1);
  outline-offset: 2px;
}

@keyframes icms-cf-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes icms-cf-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Dark mode support – nur aktiv wenn Theme selbst keine Dark-Variablen
   definiert (Theme-Variablen haben Vorrang). */
@media (prefers-color-scheme: dark) {
  .icms-cf-style-default,
  .icms-cf-style-boxed {
    background: var(--theme-card-bg, #1e293b);
    border-color: var(--theme-border, rgba(255, 255, 255, 0.1));
  }
  .icms-cf-input {
    background: var(--theme-card-bg, #1e293b);
    border-color: var(--theme-border, rgba(255, 255, 255, 0.15));
    color: var(--theme-text, #f1f5f9);
  }
  .icms-cf-success {
    background: rgba(6, 95, 70, 0.2);
    border-color: rgba(167, 243, 208, 0.3);
  }
  .icms-cf-error {
    background: rgba(153, 27, 27, 0.2);
    border-color: rgba(254, 202, 202, 0.3);
  }
  .icms-cf-confirm-overlay {
    background: rgba(0, 0, 0, 0.65);
  }
  .icms-cf-confirm-dialog {
    background: var(--theme-card-bg, #1e293b);
  }
  .icms-cf-confirm-title {
    color: var(--theme-text, #f1f5f9);
  }
  .icms-cf-confirm-message {
    color: var(--theme-text, #cbd5e1);
  }
  .icms-cf-confirm-hint {
    background: rgba(255, 255, 255, 0.06);
    color: var(--theme-text-muted, #94a3b8);
  }
  .icms-cf-confirm-icon {
    background: rgba(5, 150, 105, 0.18);
  }
}
