/**
 * Styles for Pre-Authentication forms
 */

/* Hide all site elements on pre-auth pages */
body.pre-auth-fullpage-mode header,
body.pre-auth-fullpage-mode .region-header,
body.pre-auth-fullpage-mode nav,
body.pre-auth-fullpage-mode .region-navigation,
body.pre-auth-fullpage-mode .breadcrumb,
body.pre-auth-fullpage-mode aside,
body.pre-auth-fullpage-mode footer,
body.pre-auth-fullpage-mode .region-footer,
body.pre-auth-fullpage-mode .toolbar,
body.pre-auth-fullpage-mode #toolbar-administration,
body.pre-auth-fullpage-mode .region-sidebar-first,
body.pre-auth-fullpage-mode .region-sidebar-second,
body.pre-auth-fullpage-mode .site-branding,
body.pre-auth-fullpage-mode .site-logo,
body.pre-auth-fullpage-mode .menu--main,
body.pre-auth-fullpage-mode .menu--account {
  display: none !important;
}

/* Fullpage container */
.pre-auth-fullpage {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Form wrapper - clean white card */
.pre-auth-wrapper {
  max-width: 500px;
  width: 100%;
  padding: 40px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  margin: auto;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* Branding */
.pre-auth-branding {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.pre-auth-logo {
  font-size: 48px;
  margin-bottom: 10px;
  animation: lock-pulse 2s ease-in-out infinite;
}

@keyframes lock-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.pre-auth-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin: 0;
  padding: 0;
}

.pre-auth-description {
  text-align: center;
  margin-bottom: 30px;
}

.pre-auth-description h2 {
  color: #0066cc;
  font-size: 28px;
  margin-bottom: 15px;
}

.pre-auth-description p {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
}

.pre-auth-wrapper .form-item {
  margin-bottom: 20px;
}

.pre-auth-wrapper label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.pre-auth-wrapper input[type="email"],
.pre-auth-wrapper input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.pre-auth-wrapper input[type="email"]:focus,
.pre-auth-wrapper input[type="text"]:focus {
  outline: none;
  border-color: #0066cc;
}

.pre-auth-wrapper .form-actions {
  margin-top: 30px;
}

.pre-auth-wrapper button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: #0066cc;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.pre-auth-wrapper button[type="submit"]:hover {
  background: #0052a3;
}

.pre-auth-wrapper button[type="submit"]:active {
  transform: translateY(1px);
}

.resend-otp-link {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.resend-otp-link a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 600;
}

.resend-otp-link a:hover {
  text-decoration: underline;
}

/* Countdown timer styles */
.resend-otp-timer-link {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.resend-otp-timer-link p {
  margin-bottom: 10px;
  color: #666;
}

.countdown-message {
  font-size: 14px;
  color: #666;
}

.countdown-timer {
  font-weight: bold;
  color: #dc3545;
  font-size: 16px;
  display: inline-block;
  min-width: 40px;
  font-family: monospace;
}

.resend-otp-timer-link a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.3s;
}

.resend-otp-timer-link a:hover:not(.disabled) {
  text-decoration: underline;
  background: #f0f7ff;
}

.resend-otp-timer-link a.disabled {
  color: #999;
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.resend-otp-timer-link a.enabled-resend {
  animation: pulse-green 1s ease-in-out 3;
  background: #d4edda;
  color: #155724;
  font-weight: bold;
}

@keyframes pulse-green {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pre-auth-wrapper .messages {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
}

.pre-auth-wrapper .messages--status {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.pre-auth-wrapper .messages--error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.pre-auth-wrapper .messages--warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.pre-auth-wrapper .form-item--error-message {
  color: #dc3545;
  font-size: 13px;
  margin-top: 5px;
}

.pre-auth-wrapper input.error {
  border-color: #dc3545;
}

/* OTP specific styles */
.pre-auth-wrapper input[type="text"][name="otp"] {
  text-align: center;
  font-size: 24px;
  letter-spacing: 10px;
  font-weight: 600;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .pre-auth-fullpage {
    padding: 15px;
    align-items: flex-start;
    padding-top: 30px;
  }

  .pre-auth-wrapper {
    padding: 30px 20px;
    margin: 10px auto;
    max-height: none;
    border-radius: 8px;
  }

  .pre-auth-description h2 {
    font-size: 22px;
  }

  .pre-auth-description p {
    font-size: 14px;
  }

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

  .pre-auth-logo {
    font-size: 40px;
  }
}

@media (max-width: 480px) {
  .pre-auth-fullpage {
    padding: 10px;
    padding-top: 20px;
  }

  .pre-auth-wrapper {
    padding: 25px 15px;
    margin: 5px auto;
    border-radius: 8px;
  }

  .pre-auth-description h2 {
    font-size: 20px;
  }

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

  .pre-auth-logo {
    font-size: 36px;
  }

  .pre-auth-wrapper input[type="email"],
  .pre-auth-wrapper input[type="text"] {
    font-size: 16px;
    padding: 10px;
  }

  .pre-auth-wrapper button[type="submit"] {
    padding: 12px;
    font-size: 15px;
  }
}

@media (max-height: 700px) {
  .pre-auth-fullpage {
    align-items: flex-start;
    padding-top: 20px;
  }

  .pre-auth-wrapper {
    margin: 10px auto;
  }

  .pre-auth-branding {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }

  .pre-auth-description {
    margin-bottom: 20px;
  }

  .pre-auth-logo {
    font-size: 40px;
    margin-bottom: 8px;
  }
}

/* Loading state */
.pre-auth-wrapper button[type="submit"][disabled] {
  background: #ccc;
  cursor: not-allowed;
}

/* Description formatting */
.pre-auth-wrapper .description {
  font-size: 13px;
  color: #666;
  margin-top: 5px;
}

/* Footer */
.pre-auth-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center;
}

.pre-auth-footer p {
  font-size: 12px;
  color: #999;
  margin: 0;
}

/* Clean body on pre-auth pages */
body.pre-auth-fullpage-mode {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  height: 100vh;
  position: fixed;
  width: 100%;
}

body.pre-auth-fullpage-mode #main-content,
body.pre-auth-fullpage-mode .region-content {
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide Drupal messages container outside form */
body.pre-auth-fullpage-mode .messages-list:not(.pre-auth-wrapper .messages-list) {
  display: none !important;
}
