/*
 * Auth Modal Styles
 *
 * This stylesheet defines the look and feel of the login/registration modal.
 * It reuses the design tokens defined in :root (primary, accent, spacing, etc.)
 * and applies a consistent card‑like appearance.  The social login section
 * present in the original Kimi design has been removed per requirements.
 */

/* Modal Base */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.auth-modal.active {
  opacity: 1;
  visibility: visible;
}

/* Overlay */
.auth-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Make the overlay a light translucent white so the auth window stands out clearly */
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
}

/* Container */
.auth-container {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  /* Use a slightly larger shadow for more depth */
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  /* Add a subtle border */
  border: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-xl);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

/* Gradient border around the auth container */
.auth-container::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  /*
   * Remove the opacity property from the decorative gradient border.
   * Previously the pseudo-element used a 10% alpha colour and a 0.5
   * opacity, resulting in a combined 5% opacity.  This used
   * opacity outside of an animation context.  Instead, reduce the
   * alpha of the gradient itself and eliminate the separate opacity
   * property to avoid any unintended contrast issues.
   */
  background: linear-gradient(135deg, rgba(237, 137, 54, 0.05), transparent 50%);
  border-radius: var(--radius-xl);
  z-index: -1;
}

.auth-modal.active .auth-container {
  transform: translateY(0);
}

/* Close Button */
.auth-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.auth-close:hover {
  background: var(--border);
  color: var(--text);
}

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

.auth-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-lg);
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg);
  padding: var(--space-xs);
  border-radius: var(--radius-md);
}

.auth-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-light);
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-form.hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select {
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.2s;
  background: var(--surface);
}

/* Placeholder styling: ensure placeholder text remains clearly readable.  Use
 * the same muted text colour as other secondary labels instead of relying
 * on browser defaults, which can be excessively light on light backgrounds. */
.form-group input::placeholder,
.form-group select::placeholder,
.password-input input::placeholder {
  color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* Password Input */
.password-input {
  position: relative;
}

.password-input input {
  width: 100%;
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  /*
   * Use a muted colour for the password toggle icon instead of reducing
   * opacity.  Low opacity lowers contrast and is discouraged for
   * interactive controls.  Colour transitions provide a clear visual
   * cue without compromising readability.
   */
  color: var(--text-light);
  transition: color 0.2s;
}

.toggle-password:hover {
  /* On hover, switch to the primary text colour for improved
   * visibility instead of altering opacity. */
  color: var(--text);
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--text-light);
  cursor: pointer;
}

.checkbox-label input {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.checkbox-label input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
}

/* Links */
.forgot-password {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  align-self: flex-end;
  margin-top: var(--space-xs);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

.btn-full {
  width: 100%;
  padding: var(--space-md);
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: var(--space-lg) 0;
  color: var(--text-light);
  font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  padding: 0 var(--space-md);
}

/* Footer */
.auth-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  text-align: center;
}

.security-badges-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .auth-container {
    margin: var(--space-md);
    padding: var(--space-lg);
  }

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

/* Password criteria list for the registration form in the modal.  Each
 * rule is represented as an <li>.  The .valid and .invalid classes
 * control colouring based on whether the rule is met.  Ensure the
 * list is unstyled and spaced closely below the password field. */
.password-criteria {
  list-style: none;
  margin-top: var(--space-xs);
  padding: 0;
  font-size: 0.875rem;
}

.password-criteria li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.3;
}

.password-criteria li.valid {
  color: #4caf87; /* green for satisfied rules */
}

.password-criteria li.invalid {
  color: #e05c4b; /* red for unsatisfied rules */
}