/* ================================================================= */
/* E-MAIL MODAL STYLING - Aktivrente-Rechner */
/* Professionelles, responsives Modal mit Animationen */
/* ================================================================= */

/* Modal Overlay (Fullscreen Backdrop) */
.email-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Container */
.email-modal-container {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease-out;
}

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

/* Modal Header */
.email-modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.email-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
}

.email-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s ease;
  border-radius: 4px;
}

.email-modal-close:hover {
  color: #1f2937;
  background-color: #f3f4f6;
}

.email-modal-close:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Modal Body */
.email-modal-body {
  padding: 24px;
}

.email-modal-intro {
  margin: 0 0 24px;
  color: #4b5563;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Form Styles */
.email-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 0.9rem;
}

.form-input {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  color: #1f2937;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-input.error {
  border-color: #ef4444;
}

.form-error {
  color: #ef4444;
  font-size: 0.85rem;
  min-height: 1.2em;
  display: block;
}

/* Checkbox */
.form-checkbox {
  margin: 4px 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

.checkbox-text {
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Privacy Notice */
.email-modal-privacy {
  margin: 12px 0 24px;
  padding: 12px;
  background-color: #f9fafb;
  border-left: 3px solid #2563eb;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.6;
}

.email-modal-privacy a {
  color: #2563eb;
  text-decoration: underline;
}

.email-modal-privacy a:hover {
  color: #1d4ed8;
}

/* Buttons */
.btn-submit,
.btn-cancel {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  width: 100%;
  font-family: inherit;
}

.btn-submit {
  background-color: #2563eb;
  color: white;
  position: relative;
}

.btn-submit:hover:not(:disabled) {
  background-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.btn-submit:disabled {
  background-color: #93c5fd;
  cursor: not-allowed;
}

.btn-submit:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.btn-cancel {
  background-color: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.btn-cancel:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.btn-cancel:focus {
  outline: 2px solid #6b7280;
  outline-offset: 2px;
}

/* Button States */
.btn-submit .btn-spinner {
  display: none;
}

.btn-submit.loading .btn-text {
  display: none;
}

.btn-submit.loading .btn-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Spinner Animation */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Success/Error Messages */
.email-message {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.email-success {
  background-color: #d1fae5;
  border: 1px solid #10b981;
}

.email-error {
  background-color: #fee2e2;
  border: 1px solid #ef4444;
}

.message-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.email-success .message-icon {
  color: #10b981;
}

.email-error .message-icon {
  color: #ef4444;
}

.message-content h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.email-success .message-content h3 {
  color: #065f46;
}

.email-error .message-content h3 {
  color: #991b1b;
}

.message-content p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.email-success .message-content p {
  color: #047857;
}

.email-error .message-content p {
  color: #b91c1c;
}

/* Hidden State */
.email-form.hidden,
.email-message.hidden {
  display: none !important;
}

/* ================================================================= */
/* RESPONSIVE DESIGN */
/* ================================================================= */

/* Mobile (< 640px) */
@media (max-width: 640px) {
  .email-modal-overlay {
    padding: 10px;
  }

  .email-modal-container {
    border-radius: 8px;
  }

  .email-modal-header {
    padding: 20px 20px 12px;
  }

  .email-modal-header h2 {
    font-size: 1.25rem;
  }

  .email-modal-body {
    padding: 20px;
  }

  .btn-submit,
  .btn-cancel {
    padding: 14px 24px;
    font-size: 1rem;
  }

  /* Touch-friendly buttons */
  .email-modal-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Tablet (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
  .email-modal-container {
    max-width: 480px;
  }
}

/* ================================================================= */
/* ACCESSIBILITY */
/* ================================================================= */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .email-modal-overlay {
    background-color: rgba(0, 0, 0, 0.8);
  }

  .form-input:focus {
    border-width: 2px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .email-modal-overlay,
  .email-modal-container,
  .email-message {
    animation: none;
  }

  .btn-submit:hover:not(:disabled) {
    transform: none;
  }
}

/* Focus Visible (für Tastaturnavigation) */
.email-modal-close:focus-visible,
.btn-submit:focus-visible,
.btn-cancel:focus-visible,
.form-input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
