/**
 * LifeEasy Staffing Company — Enterprise Internationalization & RTL Stylesheet
 * Supports all 23 Indian Locales, Searchable Language Modal, RTL Mirroring, and Script Typography
 */

/* ==========================================================================
   1. Language Trigger Button in Header & Mobile Drawer
   ========================================================================== */

.lang-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-navy, #0c2340);
  background: rgba(12, 35, 64, 0.05);
  border: 1px solid rgba(12, 35, 64, 0.15);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.lang-selector-btn:hover,
.lang-selector-btn:focus-visible {
  background: rgba(12, 35, 64, 0.1);
  border-color: var(--color-gold, #c5a059);
  color: var(--color-navy, #0c2340);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}

.lang-selector-btn .globe-icon {
  font-size: 1rem;
  line-height: 1;
}

.lang-selector-btn .chevron-icon {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  color: rgba(12, 35, 64, 0.6);
}

.lang-selector-btn[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

/* ==========================================================================
   2. Searchable Language Modal Dialog
   ========================================================================== */

.lang-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 35, 64, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100001 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lang-modal-backdrop.is-open,
.lang-modal-backdrop.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.lang-modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(12, 35, 64, 0.25), 0 0 0 1px rgba(12, 35, 64, 0.08);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.lang-modal-backdrop.is-open .lang-modal-dialog,
.lang-modal-backdrop.active .lang-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Dialog Header */
.lang-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(12, 35, 64, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.lang-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-navy, #0c2340);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.lang-modal-close:hover {
  background: rgba(12, 35, 64, 0.06);
  color: var(--color-navy, #0c2340);
}

/* Search Bar */
.lang-modal-search {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(12, 35, 64, 0.06);
  background: #ffffff;
  position: relative;
}

.lang-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.lang-search-input:focus {
  background: #ffffff;
  border-color: var(--color-gold, #c5a059);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}

.lang-search-icon {
  position: absolute;
  left: 2.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  font-size: 1rem;
}

/* Language List Grid */
.lang-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 0.75rem;
}

.lang-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  font-family: inherit;
}

.lang-item:hover,
.lang-item:focus-visible {
  border-color: var(--color-gold, #c5a059);
  background: #fefcf9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.12);
  outline: none;
}

.lang-item.is-selected {
  border-color: var(--color-gold, #c5a059);
  background: #faf4e8;
  box-shadow: 0 0 0 1px var(--color-gold, #c5a059);
}

.lang-item-native {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-navy, #0c2340);
  line-height: 1.3;
}

.lang-item-english {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.lang-item-region {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.lang-item-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
}

.lang-item.is-selected .lang-item-badge {
  background: var(--color-gold, #c5a059);
  color: #ffffff;
}

/* Modal Footer */
.lang-modal-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid rgba(12, 35, 64, 0.08);
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #64748b;
}

.lang-modal-footer a {
  color: var(--color-gold, #c5a059);
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   3. Mobile Sheet Layout
   ========================================================================== */

@media (max-width: 640px) {
  .lang-modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .lang-modal-dialog {
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .lang-modal-backdrop.is-open .lang-modal-dialog {
    transform: translateY(0);
  }

  .lang-modal-body {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* ==========================================================================
   4. Right-to-Left (RTL) Layout System for Urdu, Kashmiri, Sindhi
   ========================================================================== */

html[dir="rtl"] body {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .hero-inner,
html[dir="rtl"] .section-header,
html[dir="rtl"] .card,
html[dir="rtl"] .footer-col {
  text-align: right;
}

/* Reverse directional flex and navigation */
html[dir="rtl"] .nav-links {
  flex-direction: row;
}

html[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .btn .btn-arrow,
html[dir="rtl"] .role-sketch-arrow {
  transform: rotate(180deg);
}

/* Logical spacing mirrors */
html[dir="rtl"] .mr-auto {
  margin-left: auto;
  margin-right: 0;
}

html[dir="rtl"] .ml-auto {
  margin-right: auto;
  margin-left: 0;
}

/* Bidirectional protection for numbers, phone numbers, and currencies */
[dir="ltr"],
a[href^="tel:"],
a[href^="mailto:"],
.calc-amount-value,
.currency-val,
.stat-number,
.stat-item h3 {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-block;
}

/* ==========================================================================
   5. Complex Script Typography Scaling (Urdu Nastaliq)
   ========================================================================== */

.script-urdu-nastaliq,
html[lang="ur"] body,
html[lang="ks-Arab"] body,
html[lang="sd-Arab"] body {
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  --line-height-base: 1.85 !important;
  --leading-normal: 1.85 !important;
}

.script-urdu-nastaliq body {
  line-height: 1.85 !important;
}

.script-urdu-nastaliq h1,
.script-urdu-nastaliq h2,
.script-urdu-nastaliq h3,
.script-urdu-nastaliq .hero-headline,
.script-urdu-nastaliq .section-title {
  line-height: 1.65 !important;
  padding-bottom: 0.25rem;
}

.script-urdu-nastaliq .btn {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  line-height: 1.6;
}
