/* اشتراک‌های راسا اکوسیستم — soft auth modal (Yekan via fonts.css) */

.rasa-auth-root {
  --ra-accent: #1e4fd6;
  --ra-secondary: #0b1b3a;
  --ra-ink: #0f172a;
  --ra-muted: #64748b;
  --ra-line: #e2e8f0;
  --ra-surface: #ffffff;
  --ra-bg: #f4f7fb;
  --ra-radius: 22px;
  --ra-danger: #dc2626;
  --ra-success: #059669;
  font-family: "RasaYekan", "IRANYekanX", Tahoma, sans-serif;
}

.rasa-auth-root[data-theme="dark"] {
  --ra-ink: #f8fafc;
  --ra-muted: #94a3b8;
  --ra-line: rgba(148, 163, 184, 0.22);
  --ra-surface: #0f172a;
  --ra-bg: #0b1220;
}

.rasa-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 12, 30, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  direction: rtl;
}

.rasa-auth-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.rasa-auth-card {
  position: relative;
  width: 100%;
  max-width: 900px;
  min-height: 520px;
  background: var(--ra-surface);
  color: var(--ra-ink);
  border-radius: calc(var(--ra-radius) + 6px);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  box-shadow:
    0 40px 100px rgba(6, 12, 30, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateY(22px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.36s ease;
  max-height: calc(100vh - 2.5rem);
}

.rasa-auth-overlay.is-open .rasa-auth-card {
  transform: none;
  opacity: 1;
}

.rasa-auth-cover {
  position: relative;
  padding: 2rem 1.75rem;
  color: #fff;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--ra-accent) 55%, transparent), transparent 55%),
    linear-gradient(160deg, var(--ra-secondary), var(--ra-accent));
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rasa-auth-cover.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(11, 27, 58, 0.72), rgba(30, 79, 214, 0.55));
}

.rasa-auth-cover > * {
  position: relative;
  z-index: 1;
}

.rasa-auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
}

.rasa-auth-brand img {
  max-height: 40px;
  width: auto;
}

.rasa-auth-cover h2 {
  margin: auto 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.5;
}

.rasa-auth-cover p {
  margin: 0;
  opacity: 0.88;
  font-size: 0.92rem;
  line-height: 1.8;
}

.rasa-auth-points {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.86rem;
  opacity: 0.92;
}

.rasa-auth-points li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  animation: rasa-auth-fade-up 0.5s ease both;
}

.rasa-auth-points li:nth-child(2) { animation-delay: 0.06s; }
.rasa-auth-points li:nth-child(3) { animation-delay: 0.12s; }

.rasa-auth-points li::before {
  content: "✓";
  width: 1.3rem;
  height: 1.3rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.rasa-auth-body {
  position: relative;
  padding: 1.75rem 1.6rem;
  padding-top: 3rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.rasa-auth-close {
  position: absolute;
  top: 0.85rem;
  inset-inline-end: 0.85rem;
  z-index: 5;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 0;
  background: rgba(15, 23, 42, 0.08);
  color: var(--ra-ink);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.rasa-auth-close:hover {
  background: rgba(15, 23, 42, 0.14);
  transform: rotate(90deg);
}

.rasa-auth-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--ra-bg);
  border-radius: 16px;
  padding: 0.3rem;
  margin-bottom: 1.1rem;
  flex-shrink: 0;
  border: 1px solid var(--ra-line);
}

.rasa-auth-tab {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ra-muted);
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.65rem 0.4rem;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.rasa-auth-tab.is-active {
  background: var(--ra-surface);
  color: var(--ra-accent);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}

.rasa-auth-tab:not(.is-active):hover {
  color: var(--ra-ink);
}

/* Fixed panel height prevents jump when switching mobile ↔ email / OTP */
.rasa-auth-panel {
  position: relative;
  flex: 1;
  min-height: 320px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.rasa-auth-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.rasa-auth-stage.is-exit {
  opacity: 0;
  transform: translateY(6px);
}

.rasa-auth-stage.is-enter {
  opacity: 0;
  transform: translateY(-6px);
}

.rasa-auth-stage.is-ready {
  opacity: 1;
  transform: none;
}

.rasa-auth-view {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.rasa-auth-step-title {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
  font-weight: 800;
}

.rasa-auth-step-desc {
  margin: 0 0 1.1rem;
  color: var(--ra-muted);
  font-size: 0.88rem;
  min-height: 1.4em;
}

.rasa-auth-field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  min-width: 0;
  max-width: 100%;
}

.rasa-auth-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ra-muted);
}

.rasa-auth-field input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid var(--ra-line);
  background: var(--ra-surface);
  color: var(--ra-ink);
  padding: 0.8rem 0.95rem;
  font: inherit;
  direction: ltr;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rasa-auth-field input.rasa-auth-rtl {
  direction: rtl;
  text-align: right;
}

.rasa-auth-field input:focus {
  outline: none;
  border-color: var(--ra-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ra-accent) 20%, transparent);
}

/* Honeypot: never use left:-9999px — it creates horizontal scroll inside overflow containers */
.rasa-auth-hp {
  position: absolute !important;
  inset: 0 auto auto 0 !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.rasa-auth-otp {
  display: flex;
  gap: 0.5rem;
  direction: ltr;
  justify-content: center;
  margin-bottom: 0.9rem;
  min-height: 3.4rem;
}

.rasa-auth-otp input {
  width: 3rem;
  height: 3.4rem;
  border-radius: 14px;
  border: 1.5px solid var(--ra-line);
  background: var(--ra-surface);
  color: var(--ra-ink);
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.rasa-auth-otp input:focus {
  outline: none;
  border-color: var(--ra-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ra-accent) 20%, transparent);
  transform: translateY(-1px);
}

.rasa-auth-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.rasa-auth-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--ra-accent), color-mix(in srgb, var(--ra-accent) 70%, var(--ra-secondary)));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--ra-accent) 28%, transparent);
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  margin-top: auto;
}

.rasa-auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.rasa-auth-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px color-mix(in srgb, var(--ra-accent) 34%, transparent);
}

.rasa-auth-link {
  background: none;
  border: 0;
  color: var(--ra-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.35rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.rasa-auth-link:hover {
  opacity: 0.8;
}

.rasa-auth-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--ra-muted);
  min-height: 2rem;
}

.rasa-auth-alert {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
  background: color-mix(in srgb, var(--ra-danger) 12%, white);
  border: 1px solid color-mix(in srgb, var(--ra-danger) 30%, white);
  color: #991b1b;
  opacity: 0;
  transform: translateY(-4px);
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  margin-bottom: 0;
  transition: all 0.22s ease;
}

.rasa-auth-alert.is-show {
  opacity: 1;
  transform: none;
  max-height: 6rem;
  padding: 0.7rem 0.9rem;
  border-width: 1px;
  margin-bottom: 0.9rem;
}

.rasa-auth-root[data-theme="dark"] .rasa-auth-alert {
  background: rgba(220, 38, 38, 0.15);
  color: #fecaca;
}

.rasa-auth-spinner {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  display: inline-block;
  vertical-align: -2px;
  margin-inline-start: 0.4rem;
  animation: rasa-auth-spin 0.7s linear infinite;
}

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

@keyframes rasa-auth-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .rasa-auth-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .rasa-auth-card {
    grid-template-columns: 1fr;
    max-width: 100%;
    min-height: 0;
    max-height: 96vh;
    border-radius: 26px 26px 0 0;
    transform: translateY(100%);
    opacity: 1;
  }

  .rasa-auth-overlay.is-open .rasa-auth-card {
    transform: none;
  }

  .rasa-auth-cover {
    padding: 1.4rem 1.25rem 1.1rem;
    min-height: 0;
  }

  .rasa-auth-cover h2 {
    margin-top: 0.5rem;
    font-size: 1.2rem;
  }

  .rasa-auth-points {
    display: none;
  }

  .rasa-auth-body {
    padding: 1.35rem 1.2rem calc(1.35rem + env(safe-area-inset-bottom));
    padding-top: 3rem;
  }

  .rasa-auth-close {
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    background: rgba(15, 23, 42, 0.1);
  }

  .rasa-auth-panel {
    min-height: 280px;
  }

  .rasa-auth-view {
    min-height: 260px;
  }

  .rasa-auth-otp input {
    width: 100%;
    height: 3.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rasa-auth-overlay,
  .rasa-auth-card,
  .rasa-auth-stage,
  .rasa-auth-alert,
  .rasa-auth-btn,
  .rasa-auth-tab,
  .rasa-auth-close {
    transition: none !important;
    animation: none !important;
  }
}
