/* ============================================================
   SAMVIDHAN SARAL — Language Onboarding System
   First-visit popup + re-confirm bottom sheet
   ============================================================ */

/* ── Backdrop ────────────────────────────────────────────────── */

.lang-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 32, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lang-backdrop.visible { opacity: 1; }
.lang-backdrop.hidden  { pointer-events: none; opacity: 0; }

/* ── Main Modal ──────────────────────────────────────────────── */

.lang-modal {
  background: var(--surface);
  border-radius: var(--r-2xl);
  box-shadow: 0 32px 80px rgba(0,0,0,0.28);
  width: 100%;
  max-width: 740px;
  max-height: calc(100vh - 2rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  opacity: 0;
}

.lang-backdrop.visible .lang-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

@media (max-width: 640px) {
  .lang-modal {
    grid-template-columns: 1fr;
    max-height: 90vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    align-self: flex-end;
    margin: 0 0 0 0;
    max-width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .lang-backdrop {
    align-items: flex-end;
    padding: 0;
  }
}

/* ── Left panel — choices ────────────────────────────────────── */

.lang-panel-left {
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

@media (max-width: 640px) {
  .lang-panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 52vh;
  }
}

.lang-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.lang-modal-eyebrow {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--sp-1);
}

.lang-modal-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.lang-modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease-fast);
  margin-top: 2px;
}

.lang-modal-close:hover {
  background: var(--border);
  color: var(--ink);
}

/* Language option buttons */
.lang-options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.lang-option-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  cursor: pointer;
  transition: all var(--ease-fast);
  text-align: left;
  width: 100%;
}

.lang-option-btn:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.lang-option-btn.selected {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(26,39,68,0.08);
}

.lang-option-flag {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

.lang-option-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lang-option-name {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
}

.lang-option-native {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.lang-option-desc {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: 1.4;
}

.lang-option-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease-fast);
}

.lang-option-btn.selected .lang-option-check {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* Hinglish sub-options */
.hinglish-suboptions {
  display: none;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-alt);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-top: var(--sp-1);
}

.hinglish-suboptions.visible { display: flex; }

.hinglish-sub-btn {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--ease-fast);
  text-align: left;
}

.hinglish-sub-btn:hover { border-color: var(--ink); }
.hinglish-sub-btn.selected {
  border-color: var(--gold);
  background: var(--gold-pale);
  box-shadow: 0 0 0 2px rgba(184,134,26,0.1);
}

.hinglish-sub-name {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
}

.hinglish-sub-desc {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

.hinglish-sub-example {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--gold);
  margin-top: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  background: var(--gold-pale);
  border-radius: var(--r-sm);
  display: none;
}

.hinglish-sub-btn.selected .hinglish-sub-example { display: block; }

/* CTA */
.lang-modal-cta {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.lang-skip {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--sp-2);
  transition: color var(--ease-fast);
}

.lang-skip:hover { color: var(--text-muted); }

/* ── Right panel — live preview ──────────────────────────────── */

.lang-panel-right {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 640px) {
  .lang-panel-right { max-height: 38vh; }
}

.lang-preview-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lang-preview-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.lang-preview-badge {
  font-family: var(--font-ui);
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-pale);
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-full);
  border: 1px solid rgba(184,134,26,0.2);
}

.lang-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Mini article preview inside the popup */
.preview-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.preview-article-hero {
  background: var(--ink);
  padding: var(--sp-4) var(--sp-4);
}

.preview-art-number {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.preview-art-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.preview-section {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.preview-section:last-child { border-bottom: none; }

.preview-section-label {
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.preview-section-text {
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-muted);
}

.preview-section-text.hindi {
  font-family: var(--font-devanagari);
  font-size: 12px;
  line-height: 1.8;
}

/* ── Re-confirm bottom sheet (returning users) ───────────────── */

.reconfirm-sheet {
  position: fixed;
  bottom: var(--sp-4);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: var(--z-modal);
  width: min(420px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-5);
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.reconfirm-sheet.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.reconfirm-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.reconfirm-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.reconfirm-text strong {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
}

.reconfirm-text span {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.reconfirm-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}
