/* ========================================
   B2B Kontaktformular - Slide-up Panel
   ======================================== */

/* Overlay Hintergrund */
.contact-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.contact-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Kontaktformular Panel */
.contact-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(120vh) translateZ(0);
  width: 90%;
  max-width: 500px;
  max-height: 95vh;
  overflow-y: auto;
  background: rgba(10, 26, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  z-index: 9999;
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              opacity 0.3s ease;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.contact-panel.active {
  transform: translate(-50%, -50%) translateZ(0);
  opacity: 1;
  visibility: visible;
}

/* Schließen Animation - nach unten ausfahren */
.contact-panel.closing {
  transform: translate(-50%, -50%) translateY(120vh) translateZ(0);
  opacity: 0;
  visibility: visible;
  transition: transform 0.35s cubic-bezier(0.4, 0, 1, 1), 
              opacity 0.25s ease;
}

/* Scrollbar für Desktop */
.contact-panel::-webkit-scrollbar {
  width: 8px;
}

.contact-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

.contact-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 5px;
}

.contact-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
  .contact-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform: translateY(100%) translateZ(0);
    border-radius: 12px 12px 0 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 26, 10, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
    padding: 1.5rem 1rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    height: 90vh;
    height: 90svh;
    height: 90dvh;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.25s ease;
  }
  
  .contact-overlay {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background: rgba(0, 0, 0, 0.5);
  }

  .contact-panel.active {
    transform: translateY(0) translateZ(0);
  }

  .contact-panel.closing {
    transform: translateY(100%) translateZ(0);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 1, 1), 
                opacity 0.2s ease;
  }

  .contact-panel::-webkit-scrollbar {
    width: 8px;
  }

  .contact-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
  }

  .contact-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
  }

  .contact-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
  }
}

/* Drag Handle für Mobile */
.contact-drag-handle {
  display: none;
}

@media (max-width: 768px) {
  .contact-drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 auto 0.75rem;
    cursor: grab;
    touch-action: none;
  }
  
  .contact-drag-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.5);
  }
  
  .contact-panel {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }
}

/* Header */
.contact-panel h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
  text-align: center;
}

.contact-panel .subtitle {
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 1.25rem;
}

/* Schließen Button */
.contact-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.7);
}

.contact-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.contact-close-btn svg {
  width: 16px;
  height: 16px;
}

/* Formular Styles */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.form-group label .required {
  color: #ef5350;
  margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px; /* Mindestens 16px um iOS Auto-Zoom zu verhindern */
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(76, 175, 80, 0.6);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' fill-opacity='0.6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group select option {
  background: #1a2f1a;
  color: #fff;
}

.form-group textarea {
  resize: vertical;
  min-height: 150px;
  max-height: 300px;
}

/* Name-Felder - immer volle Breite */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Submit Button */
.contact-submit-btn {
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  background: linear-gradient(135deg, #2d5a2d 0%, #1a3a1a 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.contact-submit-btn:hover {
  background: linear-gradient(135deg, #3a6d3a 0%, #234723 100%);
  transform: translateY(-1px);
}

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

.contact-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.contact-submit-btn svg {
  width: 18px;
  height: 18px;
}

/* Loading Spinner */
.contact-submit-btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Erfolgs-/Fehlermeldung */
.contact-message {
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-size: 0.95rem;
  display: none;
}

.contact-message.success {
  display: block;
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid rgba(76, 175, 80, 0.4);
  color: #81c784;
}

.contact-message.error {
  display: block;
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid rgba(244, 67, 54, 0.4);
  color: #ef5350;
}

/* Erfolgsansicht */
.contact-success {
  text-align: center;
  padding: 2rem 1rem;
}

.contact-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: rgba(76, 175, 80, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #81c784;
}

.contact-success-icon svg {
  width: 32px;
  height: 32px;
}

.contact-success h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  color: #81c784;
}

.contact-success p {
  margin: 0 0 1.5rem 0;
  opacity: 0.8;
  font-size: 0.95rem;
}

.contact-success-btn {
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.contact-success-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Datenschutz Checkbox */
.form-group-checkbox {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  position: relative;
  margin-top: 1px;
}

.checkbox-custom::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 7px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.2s ease;
}

/* Hover-Effekt auf Checkbox */
.checkbox-label:hover .checkbox-custom {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: linear-gradient(135deg, #2d5a2d 0%, #1a3a1a 100%);
  border-color: rgba(255, 255, 255, 0.25);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  transform: rotate(45deg) scale(1);
}

.checkbox-label input[type="checkbox"]:focus + .checkbox-custom {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.checkbox-text {
  flex: 1;
  padding-top: 2px;
}

.checkbox-text a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease;
}

.checkbox-text a:hover {
  opacity: 0.8;
}

.checkbox-text .required {
  color: rgba(255, 255, 255, 0.5);
  font-weight: normal;
}

/* Datenschutz Hinweis */
.privacy-note {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-top: 0.5rem;
}

.privacy-note a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
}

.privacy-note a:hover {
  color: white;
}
