/**
 * CROWNATE GROUP (CROWNATE.COM)
 * Language System Stylesheet — Selector Modal, Triggers, Typography & RTL Readiness
 */

/* 1. Header & Drawer Language Triggers */
.lang-selector-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--crownate-white, #FFFFFF);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.lang-selector-trigger:hover,
.lang-selector-trigger:focus-visible {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--crownate-gold, #D4AF37);
  color: var(--crownate-gold, #D4AF37);
  outline: none;
}

.lang-selector-trigger svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* 2. Global Language Selector Modal */
.crownate-lang-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.crownate-lang-modal.open {
  opacity: 1;
  visibility: visible;
}

.lang-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lang-modal-content {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 1.5rem;
  background: #121418;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 8px;
  padding: 1.75rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.crownate-lang-modal.open .lang-modal-content {
  transform: translateY(0) scale(1);
}

.lang-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-modal-title {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.lang-modal-sub {
  font-size: 0.8rem;
  color: var(--crownate-muted-grey, #94A3B8);
  margin-top: 4px;
}

.lang-modal-close {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease;
}

.lang-modal-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

/* 3. Language Selector Option Grid */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.lang-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #CBD5E1;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-option-btn:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.4);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.lang-option-btn.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: #D4AF37;
  color: #D4AF37;
  font-weight: 600;
}

.lang-native {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-badge {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #94A3B8;
  letter-spacing: 0.05em;
}

.lang-option-btn.active .lang-badge {
  background: #D4AF37;
  color: #121418;
  font-weight: 700;
}

/* 4. Typography Overrides & Diacritics Support */
[lang="yo"], [lang="ig"] {
  font-feature-settings: "mark" 1, "mkmk" 1;
}

[lang="zh"], [lang="ja"] {
  word-break: break-all;
  line-height: 1.6;
}

/* 5. RTL Readiness */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .lang-option-btn {
  text-align: right;
  flex-direction: row-reverse;
}

/* Mobile Drawer Integration */
.drawer-lang-block {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-lang-title {
  font-size: 0.75rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
