/**
 * iGlacier Portal Styles - Modal and UI Components
 * Styles for custom Ghost CMS member portal
 */

/* Screen Reader Only - Accessibility */
.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;
}

/* Modal Backdrop */
.ig-signin-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(315deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: ig-fadeIn 0.2s ease-in;
}

/* Modal Container */
.ig-signin-modal {
  background: white;
  border-radius: 8px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  position: relative;
  animation: ig-slideUp 0.3s ease-out;
}

/* Close Button */
.ig-signin-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  transition: color 0.15s ease;
}

.ig-signin-modal-close:hover {
  color: #333;
}

.ig-signin-modal-close:focus {
  outline: 2px solid #3EB0EF;
  outline-offset: 2px;
}

/* Modal Title */
.ig-signin-modal-title {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 600;
  color: #15171A;
}

/* Form Input */
.ig-signin-modal-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #E1E8ED;
  border-radius: 4px;
  font-size: 16px;
  margin-bottom: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.ig-signin-modal-input:focus {
  outline: none;
  border-color: #3EB0EF;
}

/* Submit Button */
.ig-signin-modal-button {
  width: 100%;
  padding: 12px;
  background: #3EB0EF;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.ig-signin-modal-button:hover {
  background: #2697D0;
}

.ig-signin-modal-button:disabled {
  background: #B8C2CC;
  cursor: not-allowed;
  opacity: 0.6;
}

.ig-signin-modal-button:focus {
  outline: 2px solid #3EB0EF;
  outline-offset: 2px;
}

/* Error Message */
.ig-signin-modal-error {
  color: #F50B23;
  font-size: 14px;
  margin-top: 8px;
  display: none;
}

.ig-signin-modal-error.visible {
  display: block;
}

/* Success State */
.ig-signin-modal-success {
  display: none;
}

.ig-signin-modal-success.visible {
  display: block;
}

.ig-signin-modal-success-text {
  color: #15171A;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Prevent focus-visible styling on view-only forms */
[member-form="view"] input.gl-field:focus-visible,
[member-form="view"] textarea.gl-field:focus-visible,
[member-form="view"] select.gl-field:focus-visible {
  outline: 0;
  box-shadow: none;
}

/* Prevent any interaction with view-only fields */
[member-form="view"] input,
[member-form="view"] textarea,
[member-form="view"] select,
[member-form="view"] .gl-checkbox {
  pointer-events: none;
  cursor: default;
}

/* Animations */
@keyframes ig-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ig-slideUp {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  1% {
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ig-slideUpMobile {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Mobile Responsive Styles */
@media (max-width: 480px) {
  .ig-signin-modal {
    width: 100% !important;
    max-width: 100%;
    border-radius: 0;
    padding: 28px;
    box-shadow: none;
    animation: ig-slideUpMobile 0.25s ease-in-out;
  }

  .ig-signin-modal-input,
  .ig-signin-modal-button {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }

  .ig-signin-modal-title {
    font-size: 20px;
  }
}

/* Tablet Styles */
@media (max-width: 768px) and (min-width: 481px) {
  .ig-signin-modal {
    max-width: 400px;
    padding: 28px;
  }
}

/* Keyboard Focus Indicators */
@media (prefers-reduced-motion: reduce) {
  .ig-signin-modal-backdrop,
  .ig-signin-modal {
    animation: none;
  }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
  .ig-signin-modal {
    background: #1a1a1a;
    color: #e0e0e0;
  }

  .ig-signin-modal-title {
    color: #ffffff;
  }

  .ig-signin-modal-input {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #e0e0e0;
  }

  .ig-signin-modal-input:focus {
    border-color: #3EB0EF;
  }

  .ig-signin-modal-close {
    color: #999;
  }

  .ig-signin-modal-close:hover {
    color: #ccc;
  }

  .ig-signin-modal-success-text {
    color: #e0e0e0;
  }
}
