/* ===========================================
   Access Gate - Email Verification Modal
   Modern, clean design matching landing page
   =========================================== */

/* Variables */
.access-gate {
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.access-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal, 9999);
  padding: 16px;
  animation: fadeIn 0.3s ease-out;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  overflow-y: auto;
}

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

.access-container {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  max-width: 380px;
  width: 100%;
  padding: 28px 24px;
  animation: slideUp 0.4s ease-out;
  border: 1px solid var(--gray-100);
  position: relative;
}

/* Close Button */
.access-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.2s ease;
  z-index: 10;
}

.access-close-btn:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.access-close-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-100);
}

.access-close-btn svg {
  width: 18px;
  height: 18px;
}

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

/* Logo */
.access-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.access-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.access-logo span {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* Header */
.access-header {
  text-align: center;
  margin-bottom: 20px;
}

/* Professional Badge */
.professional-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
  color: white;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.professional-badge svg {
  width: 12px;
  height: 12px;
}

.access-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 6px 0;
  letter-spacing: -0.025em;
}

.access-header .subtitle {
  color: var(--gray-500);
  font-size: 0.8125rem;
  margin: 0;
  line-height: 1.4;
}

/* Forms */
.access-form {
  animation: fadeIn 0.3s ease-in;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
  display: flex;
  flex-direction: row;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-900);
  transition: all 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.form-group input:hover {
  border-color: var(--gray-300);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-500);
  background: white;
  box-shadow: 0 0 0 3px var(--primary-50);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

.required {
  color: var(--color-error);
  margin-left: 2px;
}

.help-text {
  display: block;
  margin-top: 4px;
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* Code Input */
.code-input-container input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 10px;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  padding: 12px 16px;
  text-indent: 10px;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 11px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  background: var(--primary-500);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Button Loading State */
.btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Form Actions */
.form-actions {
  margin-top: 16px;
}

/* Privacy Note */
.privacy-note {
  text-align: center;
  margin-top: 14px;
  color: var(--gray-400);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.privacy-note svg {
  width: 12px;
  height: 12px;
}

/* Verification Info Box */
.verification-info {
  background: var(--primary-50);
  padding: 16px 20px;
  margin-bottom: 24px;
  border-radius: 12px;
  border: 1px solid var(--primary-100);
}

.verification-info p {
  margin: 4px 0;
  font-size: 0.875rem;
  color: var(--gray-600);
}

.verification-info .label {
  color: var(--gray-500);
}

.email-display {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 1rem;
}

/* Countdown */
.countdown-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.countdown-wrapper svg {
  width: 14px;
  height: 14px;
  color: var(--gray-400);
}

#countdown {
  font-weight: 600;
  color: var(--primary-600);
  font-size: 0.875rem;
}

#countdown.expiring {
  color: var(--color-error);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Form Footer Links */
.form-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-500);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-link:hover {
  color: var(--primary-600);
  background: var(--primary-50);
}

/* Success State */
.access-success {
  text-align: center;
  padding: 24px 0;
  animation: fadeIn 0.5s ease-in;
}

.success-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: scaleIn 0.5s ease-out;
  box-shadow: 0 8px 24px -8px rgba(16, 185, 129, 0.5);
}

.success-icon svg {
  width: 36px;
  height: 36px;
  color: white;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.access-success h2 {
  color: var(--gray-900);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.access-success p {
  color: var(--gray-500);
  font-size: 0.9375rem;
  margin: 0;
}

/* Messages */
.error-message {
  background: #fef2f2;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  border: 1px solid #fee2e2;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.error-message::before {
  content: "⚠";
  flex-shrink: 0;
}

.success-message {
  background: #ecfdf5;
  color: #065f46;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  border: 1px solid #d1fae5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.success-message::before {
  content: "✓";
  flex-shrink: 0;
  font-weight: 700;
}

/* Welcome Back Banner */
.welcome-back {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.welcome-back p {
  margin: 0;
  color: var(--gray-700);
  font-size: 0.875rem;
}

.welcome-back strong {
  color: var(--primary-600);
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--gray-400);
  font-size: 0.8125rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.divider span {
  padding: 0 16px;
}

/* Consent Checkbox */
.consent-group {
  margin-top: 4px;
}

.consent-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--gray-600);
  position: relative;
}

.consent-checkbox input[type="checkbox"] {
  /* Visually hidden but accessible */
  position: absolute;
  opacity: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.consent-checkbox .checkmark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
  background: white;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.consent-checkbox .checkmark::after {
  content: "";
  display: none;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.consent-checkbox input:checked + .checkmark {
  background: #3b82f6;
  border-color: #3b82f6;
}

.consent-checkbox input:checked + .checkmark::after {
  display: block;
}

.consent-checkbox input:focus + .checkmark {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.consent-checkbox:hover .checkmark {
  border-color: #3b82f6;
}

.consent-checkbox input:invalid + .checkmark {
  border-color: var(--color-error);
}

.consent-text {
  flex: 1;
}

.consent-text a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.consent-text a:hover {
  text-decoration: underline;
}

/* Mobile - Must fit 100vw x 100vh */
@media (max-width: 576px) {
  .access-gate {
    padding: 12px;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
  }

  .access-container {
    padding: 20px 16px;
    border-radius: 14px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .access-close-btn {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
  }

  .access-close-btn svg {
    width: 16px;
    height: 16px;
  }

  .access-logo {
    margin-bottom: 14px;
  }

  .access-logo img {
    width: 32px;
    height: 32px;
  }

  .access-header {
    margin-bottom: 16px;
  }

  .access-header h1 {
    font-size: 1.125rem;
  }

  .access-header .subtitle {
    font-size: 0.75rem;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .form-group label {
    font-size: 0.75rem;
    margin-bottom: 3px;
  }

  .form-group input {
    padding: 9px 10px;
    font-size: 0.8125rem;
    border-radius: 6px;
  }

  .help-text {
    font-size: 0.6875rem;
    margin-top: 3px;
  }

  .code-input-container input {
    font-size: 1.25rem;
    letter-spacing: 8px;
    text-indent: 8px;
    padding: 10px 12px;
  }

  .btn-primary {
    padding: 10px 16px;
    font-size: 0.8125rem;
    border-radius: 6px;
  }

  .form-actions {
    margin-top: 14px;
  }

  .privacy-note {
    margin-top: 12px;
    font-size: 0.6875rem;
  }

  .consent-group {
    margin-top: 2px;
  }

  .consent-checkbox {
    font-size: 0.6875rem;
    gap: 8px;
  }

  .consent-checkbox .checkmark {
    width: 16px;
    height: 16px;
  }

  .consent-checkbox .checkmark::after {
    width: 3px;
    height: 7px;
  }

  .consent-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  /* Verification form mobile */
  .verification-info {
    padding: 12px 14px;
    margin-bottom: 16px;
  }

  .verification-info p {
    font-size: 0.75rem;
  }

  .email-display {
    font-size: 0.875rem;
  }

  .form-footer {
    margin-top: 16px;
    padding-top: 16px;
    gap: 8px;
  }

  .btn-link {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* Success state mobile */
  .success-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
  }

  .success-icon svg {
    width: 28px;
    height: 28px;
  }

  .access-success h2 {
    font-size: 1.0625rem;
  }

  .access-success p {
    font-size: 0.8125rem;
  }
}
