/*
 * File: login.css
 * Version: mmdb-0.8.18-claude
 * Munich Musicians DB - Login Page Styles
 * Extends base.css and forms.css with login-specific styling
 * 0.6.38 FIX: another turnstile fix for logon and registration issues
 * 0.8.1 FIX: Turnstile race condition fix for login-process 
 */

/* ---------- Login Container ---------- */

.imm-login-container {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #e1e5e9;
}

.imm-login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.imm-login-header h2 {
  margin: 0 0 0.5rem 0;
  color: #1a202c;
  font-size: 1.75rem;
  font-weight: 600;
}

.imm-login-header p {
  margin: 0;
  color: #718096;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---------- Login Form ---------- */

.imm-login-form {
  /* Inherits base form styles from forms.css */
}

.imm-login-form .imm-field-group {
  margin-bottom: 1.5rem;
}

.imm-login-form .imm-field-label {
  display: block;
  margin-bottom: 0.5rem;
}

.imm-login-form .imm-label-text {
  display: block;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.imm-login-form .imm-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #fff;
  box-sizing: border-box;
}

.imm-login-form .imm-input:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.imm-login-form .imm-input.error {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.imm-login-form .imm-input::placeholder {
  color: #a0aec0;
}

/* ---------- Checkbox Styling ---------- */

.imm-checkbox-group {
  margin-bottom: 1rem !important;
}

.imm-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.imm-checkbox {
  margin: 0 !important;
  width: 18px;
  height: 18px;
  accent-color: #007cba;
}

.imm-checkbox-text {
  color: #4a5568;
  user-select: none;
}

/* ---------- Submit Button ---------- */

.imm-login-submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.imm-login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 124, 186, 0.4);
}

.imm-login-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.imm-login-submit.is-disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  background: #6c757d !important;
}

/* Ensure button text is visible when disabled */
.imm-login-submit:disabled .imm-button-text,
.imm-login-submit.is-disabled .imm-button-text {
  color: #ffffff !important;
  opacity: 1;
}

/* Turnstile container styles for registration */
#imm-turnstile-widget {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
}

/* Ensure Turnstile widget is visible on mobile */
#imm-turnstile-widget iframe {
  max-width: 100%;
}

/* Turnstile container styles for login */
#imm-login-turnstile {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
}

#imm-login-turnstile:empty::before {
  content: "Loading security check...";
  color: #666;
  font-size: 14px;
  font-style: italic;
}

/* Ensure Login Turnstile widget is visible on mobile */
#imm-login-turnstile iframe {
  max-width: 100%;
}

.imm-login-submit.loading {
  pointer-events: none;
}

/* ---------- Loading Spinner ---------- */

.imm-loading-spinner {
  display: inline-block;
  animation: imm-spin 1s linear infinite;
  font-size: 1.2em;
}

@keyframes imm-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Messages ---------- */

.imm-messages {
  margin-bottom: 1rem;
}

.imm-messages .notice {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  border-left: 4px solid;
}

.imm-messages .notice.success {
  background: #f0fff4;
  color: #22543d;
  border-left-color: #38a169;
}

.imm-messages .notice.error {
  background: #fed7d7;
  color: #742a2a;
  border-left-color: #e53e3e;
}

.imm-messages .notice.info {
  background: #ebf8ff;
  color: #2a4365;
  border-left-color: #3182ce;
}

/* ---------- Field Errors ---------- */

.imm-field-error {
  color: #e53e3e;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

/* ---------- Footer Links ---------- */

.imm-login-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.imm-login-links {
  text-align: center;
  font-size: 0.95rem;
}

.imm-link {
  color: #007cba;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.imm-link:hover {
  color: #005a87;
  text-decoration: underline;
}

.imm-link-separator {
  margin: 0 0.75rem;
  color: #a0aec0;
}

/* ---------- NoScript Notice ---------- */

.imm-noscript-notice {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fef5e7;
  border: 1px solid #f6ad55;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #744210;
}

/* ---------- Form Shake Animation ---------- */

.imm-login-form.shake {
  animation: imm-shake 0.6s ease-in-out;
}

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

/* ---------- Rate Limit Notice ---------- */

.imm-rate-limit-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.imm-rate-limit-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  max-width: 400px;
  margin: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.imm-rate-limit-content h3 {
  margin: 0 0 1rem 0;
  color: #e53e3e;
  font-size: 1.25rem;
}

.imm-rate-limit-content p {
  margin: 0 0 1.5rem 0;
  color: #4a5568;
}

.imm-rate-limit-timer {
  font-size: 1.5rem;
  font-weight: bold;
  color: #007cba;
}

/* ---------- Mobile Responsive ---------- */

@media (max-width: 480px) {
  .imm-login-container {
    margin: 1rem auto;
    padding: 1.5rem;
    border-radius: 8px;
  }
  
  .imm-login-header h2 {
    font-size: 1.5rem;
  }
  
  .imm-login-header p {
    font-size: 0.9rem;
  }
  
  .imm-login-form .imm-input {
    padding: 0.625rem 0.875rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .imm-login-submit {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }
  
  .imm-rate-limit-content {
    padding: 1.5rem;
    margin: 0.5rem;
  }
}