/**
 * SignSafe Auth Styles
 * Shared styles for login, register, forgot-password, reset-password pages
 * Imports design-tokens.css for consistency
 */

/* Skip Link - WCAG 2.4.1 */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--card);
  padding: var(--space-sm) var(--space-md);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

/* Navigation */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.logo-img {
  height: 56px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-family: "Plus Jakarta Sans", var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2xl);
  border: 1px solid var(--border);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.auth-header p {
  color: var(--text-secondary);
}

/* Form Styles */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: var(--space-md);
  font-size: var(--text-base);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  font-family: inherit;
}

.form-input:hover {
  border-color: var(--border-strong);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input.error {
  border-color: var(--error);
}

.form-input::placeholder {
  color: #6b778c; /* WCAG 2.2 AA: 4.64:1 on white - placeholder text should be visible */
}

/* Password field */
.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* Form errors */
.form-error {
  color: var(--error);
  font-size: var(--text-sm);
  margin-top: var(--space-xs);
  display: none;
}

.form-error.visible {
  display: block;
}

/* Alert Box */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: none;
  align-items: flex-start;
  gap: var(--space-sm);
}

.alert.visible {
  display: flex;
}

.alert.error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error);
}

.alert.success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-message {
  flex: 1;
  font-size: var(--text-sm);
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  min-height: var(--touch-target);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(0, 102, 255, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  /* v18.0: Use explicit colors for WCAG 2.2 AA contrast */
  background: #93c5fd; /* lighter blue that maintains contrast */
  color: #1e3a5f; /* dark blue text - 4.5:1 contrast */
  box-shadow: none;
  cursor: not-allowed;
}

.btn-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Links */
.auth-links {
  margin-top: var(--space-lg);
  text-align: center;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-links a:hover {
  text-decoration: underline;
}

.forgot-password {
  display: block;
  text-align: right;
  margin-bottom: var(--space-lg);
  color: var(--primary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
}

.forgot-password:hover {
  text-decoration: underline;
}

/* Demo Section */
.demo-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
  text-align: center;
}

.demo-section p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.btn-demo {
  background: var(--bg-alt);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-demo:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

/* Security Badge */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
  color: #505f79; /* WCAG 2.2 AA: 7.6:1 on white - was var(--text-secondary) */
  font-size: 0.8125rem; /* 13px - slightly larger for readability */
}

.security-badge svg {
  width: 14px;
  height: 14px;
  color: var(--success);
}

/* Rate limit warning */
.rate-limit-warning {
  background: var(--warning-light);
  color: var(--warning);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  text-align: center;
  margin-top: var(--space-md);
  display: none;
}

.rate-limit-warning.visible {
  display: block;
}

/* Password requirements */
.password-requirements {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}

.password-requirements ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 0;
  color: var(--text-secondary);
}

.password-requirements li.valid {
  color: var(--success);
}

.password-requirements li svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Terms checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-group label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.checkbox-group a {
  color: var(--primary);
  text-decoration: none;
}

.checkbox-group a:hover {
  text-decoration: underline;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-lg);
}

.back-link:hover {
  color: var(--primary);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

/* Responsive */
@media (max-width: 480px) {
  .auth-card {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
  }

  .auth-header h1 {
    font-size: 1.5rem;
  }
}
