/* Auth Modal Styles */
body.auth-modal-open {
  overflow: hidden;
}

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

.auth-modal-container {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  font-family: var(--font-sans);
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
  border-radius: 8px;
}

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

/* Auth Step */
.auth-step {
  animation: fadeIn 0.3s ease;
}

/* Auth Header */
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px;
  font-family: var(--font-sans);
}

.auth-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  font-family: inherit;
}

#otp-phone-display {
  color: #337ab7;
  font-weight: 600;
}

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

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  font-family: inherit;
}

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

.form-input:focus {
  outline: none;
  border-color: #337ab7;
  box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.1);
}

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

/* Field Error States */
.form-input.field-error,
.otp-input.field-error {
  border-color: #ef4444;
  animation: shake 0.5s;
}

.form-input.field-error:focus,
.otp-input.field-error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error-message {
  color: #ef4444;
  font-size: 12px;
  margin-top: 4px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-error-message::before {
  content: "⚠️";
  font-size: 14px;
}

/* Communication Toggle */
.communication-toggle {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 8px;
}

.toggle-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.toggle-option svg {
  width: 18px;
  height: 18px;
}

.toggle-option.active {
  background: #ffffff;
  color: #337ab7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-option:hover:not(.active) {
  color: #374151;
}

/* OTP Inputs */
.otp-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0;
}

.otp-input {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.otp-input:focus {
  outline: none;
  border-color: #337ab7;
  box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.1);
}

.otp-timer {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 20px;
  font-family: inherit;
}

#otp-countdown {
  color: #337ab7;
  font-weight: 600;
  transition: all 0.2s ease;
}

#otp-countdown.resend-active {
  color: #667eea;
  cursor: pointer;
  text-decoration: underline;
}

#otp-countdown.resend-active:hover {
  color: #5568d3;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
}

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

/* Buttons */
.auth-button {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-btn, 10px);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.auth-button.primary {
  background: #337ab7;
  color: #ffffff;
}

.auth-button.primary:hover {
  background: #2563a8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(51, 122, 183, 0.3);
}

.auth-button.primary:active {
  transform: translateY(0);
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.auth-button:disabled:hover {
  transform: none !important;
}

.auth-button.rate-limited {
  opacity: 0.7;
  cursor: not-allowed;
  background: #9ca3af !important;
}

/* Loading state for buttons */
.auth-button.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.auth-button.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.6s linear infinite;
}

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

/* Footer Links */
.auth-footer {
  text-align: center;
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  font-family: inherit;
}

.auth-link {
  color: #337ab7;
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}

.auth-link:hover {
  text-decoration: underline;
}

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

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

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Custom Notification Fallback */
.custom-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  min-width: 300px;
  max-width: 400px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease;
  overflow: hidden;
}

.custom-notification-error {
  border-left: 4px solid #ef4444;
}

.custom-notification-success {
  border-left: 4px solid #10b981;
}

.notification-content {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
}

.notification-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.5;
}

.notification-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

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

.notification-fadeout {
  animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .auth-modal-container {
    padding: 32px 24px;
  }

  .auth-title {
    font-size: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .otp-input {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .otp-inputs {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .auth-modal {
    padding: 12px;
  }

  .auth-modal-container {
    padding: 24px 20px;
  }

  .auth-title {
    font-size: 18px;
  }

  .otp-input {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .communication-toggle {
    flex-direction: column;
  }

  .toggle-option {
    width: 100%;
  }
}
