/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

.modal-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 9998;
}

.modal-blur.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

.newsletter-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  padding: 24px;
  display: none;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.newsletter-modal.active {
  display: block;
}

.newsletter-modal__content {
  background: var(--white);
  border-radius: 8px;
  max-width: 946px;
  width: 100%;
  display: none;
  overflow: hidden;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
}

.newsletter-modal__content.active {
  display: flex;
  animation: slideUp 0.3s ease-in-out forwards;
}

.newsletter-modal__image picture {
  display: block;
  height: 100%;
  width: 291px;
}

.newsletter-modal__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.newsletter-modal__form {
  flex: 1;
  padding: 32px 96px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  position: relative;
  width: 655px;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 0;
  align-items: flex-start;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.form-group label {
  color: var(--neutral-900);
}

.form-group input,
.form-group select {
  padding: 12px 16px;
  border: 1px solid var(--neutral-200);
  border-radius: 4px;
  font-family: "Inter", sans-serif;
  font-size: var(--font-size-16);
  line-height: 140%;
  color: var(--neutral-900);
  transition: border-color 0.3s ease;
  background-color: var(--white);
  width: 100%;
  box-sizing: border-box; /* Gwarantuje, że padding nie zwiększa szerokości */
}

.form-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 16px;
  width: 100%;
}

.form-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(50% - 8px);
  min-width: 0; /* Zapobiega wychodzeniu poza kontener */
}

.form-column input {
  width: 100%;
  box-sizing: border-box; /* Gwarantuje, że padding nie zwiększa szerokości */
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-500);
}

.form-group input::placeholder,
.form-group select::placeholder {
  color: var(--neutral-500);
}

.form-group input.error,
.form-group select.error {
  border-color: var(--error-500);
}

/* Usunięto style dla komunikatów błędów */

/* Form Submit Error */
.form-submit-error {
  width: 100%;
  padding: 12px 16px;
  background-color: rgba(239, 83, 80, 0.1);
  border-radius: 4px;
  margin-top: 16px;
  margin-bottom: 0px;
  border-left: 4px solid var(--error-500);
  transition: all 0.3s ease;
}

.form-submit-error p {
  color: var(--error-700);
  font-size: var(--font-size-14);
  line-height: 1.4;
  margin: 0;
}

.newsletter-modal .btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border: none;
  outline: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  margin-top: 16px;
}

.newsletter-modal .btn.close-modal {
  margin-top: 0;
}

.newsletter-modal .button-icons {
  position: relative;
  width: 16px;
  height: 16px;
}

.newsletter-modal .button-icons svg,
.newsletter-modal .button-icons .loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease;
}

.newsletter-modal .button-icons .loader {
  opacity: 0;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-top: 2px solid #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
}

.newsletter-modal .btn.loading .button-icons svg {
  opacity: 0;
}

.newsletter-modal .btn.loading .button-icons .loader {
  opacity: 1;
  display: block;
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  z-index: 1;
}

.modal-close svg {
  width: 24px;
  height: 24px;
}

.modal-close svg path {
  stroke: var(--neutral-900);
  transition: stroke 0.3s ease;
}

.modal-close:hover svg path {
  stroke: var(--primary-500);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .newsletter-modal {
    width: calc(100% - 48px);
    max-width: 946px;
  }

  .newsletter-modal__content {
    flex-direction: column-reverse;
  }

  .newsletter-modal__form {
    padding: 96px 24px 48px 24px;
    width: 100%;
  }

  .newsletter-modal__image picture {
    width: 100%;
    max-height: 334px;
  }
}

@media (max-width: 767px) {
  .newsletter-modal {
    padding: 16px;
    width: calc(100% - 32px);
  }

  /* Układaj pola firstname i lastname pionowo na urządzeniach mobilnych */
  .form-row {
    flex-direction: column;
    gap: 16px;
  }

  .form-column {
    width: 100%;
  }
}
