/* Toasts and OTP modal */
.toast-container {
  position: fixed;
  top: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  /* Ensure toasts are always above any other element (modals, reCAPTCHA, etc.) */
  z-index: 2147483647; /* max practical z-index */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  width: 98vw; /* 98% of viewport width */
  max-width: 98vw; /* prevent shrinking container to 420px */
  pointer-events: none;
}
.toast {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  padding: var(--space-3); /* slightly tighter padding */
  display: flex;
  align-items: center; /* center toast content vertically for better height alignment */
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(100%);
  animation: slideInRight .4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  width: 98%; /* toast itself stretches inside the wide container */
  min-height: 64px; /* reduce min-height for better proportion to width */
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast.hide {
  animation: slideOutRight .3s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.toast-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: grid; /* center glyph */
  place-items: center;
  position: relative;
}
/* draw a white glyph on top of the colored circle */
.toast-icon::before {
  /* prevent double icons by disabling CSS-drawn glyph; we keep only JS inline SVG */
  content: none; /* was: "" */
  width: 0;
  height: 0;
  background: none;
  -webkit-mask: none;
  mask: none;
}
/* neutralize type-specific glyph masks to avoid any accidental overlay */
.toast.success .toast-icon::before,
.toast.error .toast-icon::before,
.toast.warning .toast-icon::before,
.toast.info .toast-icon::before {
  content: none;
  -webkit-mask-image: none;
  mask-image: none;
}
/* keep colored circular backgrounds per type */
.toast.success .toast-icon {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
}
.toast.error .toast-icon {
  background: linear-gradient(135deg, var(--error-500), var(--error-600));
}
.toast.warning .toast-icon {
  background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
}
.toast.info .toast-icon {
  background: linear-gradient(135deg, var(--info-500), var(--info-600));
}
.toast-title {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}
.toast-message {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  /* clamp lines to keep height reasonable */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.toast-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: .15s;
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}
.toast-close:hover {
  color: var(--gray-600);
  background: var(--gray-100);
}
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gray-100);
  overflow: hidden;
}
.toast-progress-bar {
  height: 100%;
  width: 100%;
  transition: width linear;
  transform-origin: left;
}
.toast.success .toast-progress-bar {
  background: linear-gradient(90deg, var(--success-500), var(--success-600));
}
.toast.error .toast-progress-bar {
  background: linear-gradient(90deg, var(--error-500), var(--error-600));
}
.toast.warning .toast-progress-bar {
  background: linear-gradient(90deg, var(--warning-500), var(--warning-600));
}
.toast.info .toast-progress-bar {
  background: linear-gradient(90deg, var(--info-500), var(--info-600));
}

/* force white glyphs regardless of path using fill/stroke=currentColor */
.toast .toast-glyph {
  color: #fff;
}
.toast .toast-glyph [stroke="currentColor"] {
  stroke: #fff !important;
}
.toast .toast-glyph [fill="currentColor"] {
  fill: #fff !important;
}

@media (max-width: 768px) {
  /* keep same 98vw behavior on mobile, with smaller gap/padding */
  .toast-container {
    top: var(--space-4);
    width: 98vw;
    max-width: 98vw;
  }
  .toast {
    padding: var(--space-3);
    min-height: 56px; /* keep mobile height slightly smaller while centered */
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* OTP Modal */
.otp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.35); /* slightly softer/darker */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000; /* keep below toast-container */
}
.otp-modal-content {
  background: #ffffff;
  border-radius: 16px;
  padding: 28px 28px 22px;
  width: 92%;
  max-width: 520px; /* a bit wider like the screenshot */
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.08), 0 2px 10px rgba(2, 6, 23, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.otp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.otp-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-top: -16px;
  color: #0f172a;
  letter-spacing: 0.01em;
}
.otp-close-button {
  background: transparent;
  margin-top: -16px;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.otp-close-button:hover {
  color: #475569;
  background: #f1f5f9;
}
.otp-description {
  color: #475569;
  margin: 8px 0 22px;
  text-align: center;
  line-height: 1.6;
}
.otp-inputs {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 20px;
}
.otp-input {
  width: 45px;
  height: 45px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
  background: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02);
}
.otp-input:focus {
  outline: none;
  border-color: #6366f1; /* indigo-500 */
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
  background: #fff;
}
.otp-input.filled {
  border-color: #22c55e;
  background: #ecfdf5;
}
.otp-proceed-button {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #6366f1, #4f46e5); /* purple like the image */
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s ease;
}
.otp-proceed-button:hover:not(:disabled) {
  filter: brightness(0.98);
}
.otp-proceed-button:disabled {
  background: #e5e7eb;
  color: #94a3b8;
  cursor: not-allowed;
}

.otp-resend-row {
  margin-top: 12px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}
.otp-resend-text {
  margin-right: 6px;
}
.otp-resend-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: #4f46e5;
  font-weight: 600;
  cursor: pointer;
}
.otp-resend-link:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

/* Telegram Modal */
.telegram-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000; /* keep below toast-container */
}
.telegram-modal-content {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.98);
  transition: transform .2s ease;
}
.telegram-modal-overlay.show .telegram-modal-content {
  transform: scale(1);
}
.telegram-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.telegram-modal-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0088cc, #006699);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.telegram-modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}
.telegram-modal-message {
  color: var(--gray-600);
  margin-bottom: var(--space-6);
  line-height: 1.5;
}
.telegram-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}
.telegram-modal-button {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s ease;
  border: none;
  font-size: var(--font-size-sm);
}
.telegram-cancel-button {
  background: var(--gray-100);
  color: var(--gray-700);
}
.telegram-cancel-button:hover {
  background: var(--gray-200);
}
.telegram-redirect-button {
  background: var(--info-500);
  color: #fff;
}
.telegram-redirect-button:hover {
  background: var(--info-600);
}
