/**
 * Auth Modal Styles
 * Login / Register / Forgot Password modals
 * Based on Figma node: 637:81308, 2084:196166
 *
 * @package Momsides
 */

/* ===========================================
 * MODAL OVERLAY
 * =========================================== */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* Prevent body scroll when modal is open */
body.auth-modal-open {
  overflow: hidden;
}

/* ===========================================
 * MODAL CONTAINER
 * =========================================== */

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 448px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--color-white, #ffffff);
  border-radius: 16px;
  padding: 32px 24px;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.auth-modal-overlay.is-active .auth-modal {
  transform: translateY(0);
}

/* Hide non-active modals */
.auth-modal[style*="display: none"] {
  display: none !important;
}

/* ===========================================
 * CLOSE BUTTON
 * =========================================== */

.auth-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.auth-modal__close:hover {
  opacity: 0.7;
}

.auth-modal__close svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===========================================
 * MODAL CONTENT
 * =========================================== */

.auth-modal__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ===========================================
 * ILLUSTRATION
 * =========================================== */

.auth-modal__illustration {
  width: 154px;
  height: 171px;
  margin-bottom: 4px;
}

.auth-modal__illustration img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===========================================
 * TITLE & SUBTITLE
 * =========================================== */

.auth-modal__title {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 32px;
  font-weight: 500;
  line-height: 32px;
  color: var(--color-text, #303030);
  text-align: center;
  margin: 0;
}

.auth-modal__subtitle {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-text-secondary, #4D4D4D);
  text-align: center;
  margin: 0 0 8px;
}

/* ===========================================
 * FORM
 * =========================================== */

.auth-modal__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ===========================================
 * FORM FIELDS
 * =========================================== */

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field__label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-text, #303030);
}

.auth-field__input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field__input {
  width: 100%;
  height: 40px;
  padding: 10px 8px;
  background-color: var(--color-background-alt, #F6F6F6);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-text-secondary, #4D4D4D);
  outline: none;
  transition: border-color 0.2s ease;
}

.auth-field__input::placeholder {
  color: var(--color-placeholder, #878787);
}

.auth-field__input:focus {
  border-color: var(--color-primary, #6E4F95);
}

/* Input with icons */
.auth-field__input--with-icons {
  padding-left: 40px;
  padding-right: 40px;
}

/* Error state */
.auth-field.has-error .auth-field__input {
  border-color: var(--color-error, #FF5F57);
}

.auth-field__error {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
  color: var(--color-error, #FF5F57);
  min-height: 16px;
}

/* ===========================================
 * FIELD ICONS
 * =========================================== */

.auth-field__icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
}

.auth-field__icon--left {
  left: 8px;
  pointer-events: none;
}

.auth-field__icon--right {
  right: 8px;
  cursor: pointer;
}

.auth-field__icon--right:hover svg path {
  stroke: var(--color-text-secondary, #4D4D4D);
}

.auth-field__icon svg {
  width: 24px;
  height: 24px;
}

/* ===========================================
 * FORGOT PASSWORD LINK
 * =========================================== */

.auth-modal__link {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: transparent;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-accent, #8FB56C);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.auth-modal__link:hover {
  opacity: 0.8;
}

/* ===========================================
 * SUBMIT BUTTON
 * =========================================== */

.auth-modal__submit {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: var(--color-accent, #8FB56C);
  border: none;
  border-radius: 10px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  color: var(--color-white, #ffffff);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.auth-modal__submit:hover {
  background-color: var(--color-accent-hover, #7DA35A);
}

.auth-modal__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loader */
.auth-modal__submit-loader {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

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

/* ===========================================
 * FORM MESSAGES
 * =========================================== */

.auth-modal__error {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-error, #FF5F57);
  text-align: center;
  min-height: 0;
}

.auth-modal__error:not(:empty) {
  margin-top: -8px;
}

.auth-modal__success {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-accent, #8FB56C);
  text-align: center;
  padding: 12px;
  background-color: rgba(143, 181, 108, 0.1);
  border-radius: 8px;
}

/* ===========================================
 * SOCIAL LOGIN
 * =========================================== */

.auth-modal__social {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.auth-modal__social-divider {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-text, #000000);
  text-align: center;
}

.auth-modal__social-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.auth-modal__social-btn {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.auth-modal__social-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.auth-modal__social-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===========================================
 * SWITCH LINK
 * =========================================== */

.auth-modal__switch {
  padding: 0;
  border: none;
  background: transparent;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  color: var(--color-accent, #8FB56C);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.auth-modal__switch:hover {
  opacity: 0.8;
}

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

@media (max-width: 480px) {
  .auth-modal {
    padding: 24px 16px;
    border-radius: 12px;
  }
  
  .auth-modal__illustration {
    width: 120px;
    height: 133px;
  }
  
  .auth-modal__title {
    font-size: 26px;
    line-height: 28px;
  }
  
  .auth-modal__submit {
    height: 44px;
  }
}
