/**
 * ZahnZauber Landingpage - Custom Styles
 * Phase 3: Formular-Styles, Loading-Spinner, Konfetti, Error-Shake, Custom-Checkbox
 * Phase 2: 3D-Tilt-Effect (migriert aus inline-styles)
 */

/* ====================================
   3D-Tilt-Effect (Phase 2 Migration)
   ==================================== */

@media (min-width: 768px) {
  .team-card-3d {
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out;
  }
}

/* ====================================
   Formular-Container
   ==================================== */

.form-container {
  max-width: 640px;
  margin: 0 auto;
  background: white;
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

@media (max-width: 640px) {
  .form-container {
    padding: 1.5rem;
  }
}

/* ====================================
   Form-Felder
   ==================================== */

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #14B8A6; /* turquoise-dark */
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #E2E8F0; /* slate-200 */
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
  transition: all 0.2s ease;
  min-height: 48px; /* Touch-Target */
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: #2DD4BF; /* turquoise */
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: #EF4444; /* red-500 */
}

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

/* ====================================
   Error-Messages
   ==================================== */

.error-message {
  display: none;
  color: #EF4444; /* red-500 */
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

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

/* ====================================
   Custom-Checkbox (DSGVO)
   ==================================== */

.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.checkbox-input {
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid #CBD5E1; /* slate-300 */
  border-radius: 0.25rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  margin-top: 0.125rem; /* Align with first line of text */
}

.checkbox-input:checked {
  background-color: #2DD4BF; /* turquoise */
  border-color: #2DD4BF;
}

.checkbox-input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.checkbox-label {
  font-size: 0.875rem;
  color: #475569; /* slate-600 */
  line-height: 1.5;
}

.checkbox-label a {
  color: #14B8A6; /* turquoise-dark */
  text-decoration: underline;
  text-underline-offset: 2px;
}

.checkbox-label a:hover {
  color: #2DD4BF; /* turquoise */
}

/* ====================================
   Honeypot (versteckt)
   ==================================== */

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ====================================
   Submit-Button States
   ==================================== */

.submit-button {
  width: 100%;
  padding: 1rem 2rem;
  background-color: #FB7185; /* coral */
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 56px;
}

.submit-button:hover:not(:disabled) {
  background-color: #F43F5E; /* coral darker */
  transform: scale(1.02);
}

.submit-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ====================================
   Loading-Spinner
   ==================================== */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

.spinner.hidden {
  display: none;
}

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

/* ====================================
   Error-Banner
   ==================================== */

.error-banner {
  display: none;
  background-color: #FEE2E2; /* red-100 */
  border: 2px solid #EF4444; /* red-500 */
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: #991B1B; /* red-800 */
}

.error-banner.visible {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-banner-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: #EF4444;
}

.error-banner-text {
  font-size: 0.875rem;
  line-height: 1.5;
}

.error-banner-text a {
  color: #991B1B;
  font-weight: 600;
  text-decoration: underline;
}

/* ====================================
   Success-Panel
   ==================================== */

.success-panel {
  display: none;
  text-align: center;
  padding: 3rem 2rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.success-panel.visible {
  display: block;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: #10B981; /* green-500 */
}

.success-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: #0F172A; /* slate-900 */
  margin-bottom: 1rem;
}

.success-text {
  font-size: 1rem;
  color: #64748B; /* slate-500 */
  margin-bottom: 2rem;
}

.success-link {
  display: inline-block;
  color: #14B8A6; /* turquoise-dark */
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 500;
}

.success-link:hover {
  color: #2DD4BF; /* turquoise */
}

/* ====================================
   Shake-Animation (bei Validation-Error)
   ==================================== */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* ====================================
   Fade-Transitions
   ==================================== */

.fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================================
   Konfetti-Canvas
   ==================================== */

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ====================================
   PHASE 4: ANIMATIONS & MICRO-INTERACTIONS
   ==================================== */

/* ====================================
   Scroll-Reveal Animations
   ==================================== */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger-Variante für Cards */
.reveal-stagger > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > *:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger > *:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger > *:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger > *:nth-child(5) { transition-delay: 400ms; }
.reveal-stagger > *:nth-child(6) { transition-delay: 500ms; }

/* ====================================
   Morphing Gradient-Blobs
   ==================================== */

.blob-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  will-change: transform;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: #2DD4BF; /* turquoise */
  top: -100px;
  left: -50px;
  animation: blob-morph 18s ease-in-out infinite;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background: #FB7185; /* coral */
  top: 100px;
  right: -100px;
  animation: blob-morph 18s ease-in-out infinite;
  animation-delay: -9s; /* Versetzt */
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: #14B8A6; /* turquoise-dark */
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  animation: blob-morph 18s ease-in-out infinite;
  animation-delay: -4.5s;
}

@keyframes blob-morph {
  0%, 100% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) scale(1.15) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.95) rotate(240deg);
  }
}

/* Mobile: kleinere Blobs */
@media (max-width: 768px) {
  .blob-1 {
    width: 250px;
    height: 250px;
  }
  .blob-2 {
    width: 200px;
    height: 200px;
  }
  .blob-3 {
    display: none; /* Reduziere auf 2 Blobs auf Mobile */
  }
}

/* ====================================
   Hover-Effects & Micro-Interactions
   ==================================== */

/* Primary-CTA-Button Hover */
.btn-primary {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(251, 113, 133, 0.4), 0 8px 10px -6px rgba(251, 113, 133, 0.3);
}

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

/* Leistungen-Cards Hover */
.service-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.service-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Navigation-Links animierter Underline */
.nav-link {
  position: relative;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #2DD4BF; /* turquoise */
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

/* ====================================
   Dekorative SVG-Animationen
   ==================================== */

.hero-decoration {
  position: absolute;
  pointer-events: none;
}

.hero-star {
  animation: float 3s ease-in-out infinite alternate;
}

.hero-sparkle {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  100% {
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

/* Verschiedene Delays für natürlicheren Look */
.hero-star:nth-child(1) { animation-delay: 0s; }
.hero-star:nth-child(2) { animation-delay: 0.5s; }
.hero-sparkle:nth-child(1) { animation-delay: 0.3s; }
.hero-sparkle:nth-child(2) { animation-delay: 0.8s; }

/* ====================================
   Mobile-Menu
   ==================================== */

/* Mobile-Menu-Panel */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80%;
  max-width: 320px;
  background: #FFFBF5; /* warm-white */
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease-out;
  overflow-y: auto;
  box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.1);
}

.mobile-menu.open {
  transform: translateX(0);
}

/* Mobile-Menu-Backdrop */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.mobile-menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger-Icon → X Morph */
.hamburger-icon {
  width: 24px;
  height: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-icon.open .hamburger-line:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamburger-icon.open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-icon.open .hamburger-line:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ====================================
   Prefers-Reduced-Motion
   ==================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Blob-Animationen deaktivieren */
  .blob {
    animation: none !important;
  }

  /* Reveal-Transitions instant */
  .reveal {
    transition-duration: 0.01ms !important;
  }
}

/* ====================================
   PHASE 5: MOBILE-POLISH
   ==================================== */

/* Touch-Devices: Tilt-Effect deaktivieren */
@media (hover: none) {
  .team-card-3d {
    transform: none !important;
  }
}

/* Mobile: Form-Inputs min 16px (verhindert iOS-Zoom) */
@media (max-width: 768px) {
  .form-input,
  .form-textarea,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  textarea,
  select {
    font-size: 16px !important;
  }
}
