/* ==========================================================================
   StarTON v3.0.0 — Global Multilingual Language Selector & RTL Stylesheet
   Supports 20 World Languages, 3D Header Selector Button & Regional Modal
   ========================================================================== */

/* 1. Header 3D Language Selector Button */
.btn-lang-selector {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  background: #ffffff !important;
  color: #1e293b !important;
  padding: 9px 18px !important;
  border-radius: 9999px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  border: 1px solid #e2e8f0 !important;
  border-bottom: 2.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.08) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  outline: none !important;
  user-select: none !important;
}

.btn-lang-selector:hover {
  transform: translateY(-2px) !important;
  border-color: #38bdf8 !important;
  border-bottom-color: #0284c7 !important;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.18) !important;
  color: #0284c7 !important;
}

.btn-lang-selector:active {
  transform: translateY(1px) !important;
  border-bottom-width: 1px !important;
  box-shadow: 0 2px 5px rgba(14, 165, 233, 0.12) !important;
}

.btn-lang-selector .lang-flag {
  font-size: 16px;
  line-height: 1;
}

.btn-lang-selector .lang-globe-icon {
  font-size: 15px;
  color: #0ea5e9;
}

.btn-lang-selector .lang-current-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.2px;
}

.btn-lang-selector .lang-chevron {
  font-size: 10px;
  color: #64748b;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.btn-lang-selector:hover .lang-chevron {
  color: #0ea5e9;
  transform: translateY(1px);
}

/* 2. Modal Backdrop */
.lang-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lang-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* 3. Modal Dialog (3D Glassmorphic Card) */
.lang-modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  width: 92%;
  max-width: 740px;
  max-height: 86vh;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.8);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
  overflow: hidden;
}

.lang-modal-dialog.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Header */
.lang-modal-header {
  padding: 22px 26px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.lang-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-modal-icon {
  font-size: 28px;
  line-height: 1;
}

.lang-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.lang-modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: #64748b;
}

.lang-modal-close {
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lang-modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: rotate(90deg);
}

/* Body */
.lang-modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

/* Search Input */
.lang-search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.lang-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #94a3b8;
  pointer-events: none;
}

.lang-search-field {
  width: 100%;
  padding: 12px 18px 12px 46px;
  border-radius: 9999px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.92rem;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.lang-search-field:focus {
  background: #ffffff;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* Region Pills */
.lang-region-scroller {
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.lang-region-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.lang-region-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.lang-region-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.lang-region-pill.active {
  background: #0ea5e9;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

/* Languages Grid */
.lang-grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 640px) {
  .lang-grid-container {
    grid-template-columns: 1fr;
  }
}

/* Language Item Card */
.lang-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  outline: none;
}

.lang-item-card:hover {
  background: #ffffff;
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.1);
}

.lang-item-card.active {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #0ea5e9;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.18);
}

.lang-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-item-flag {
  font-size: 24px;
  line-height: 1;
}

.lang-item-names {
  display: flex;
  flex-direction: column;
}

.lang-native-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.lang-item-card.active .lang-native-name {
  color: #0284c7;
}

.lang-roman-name {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

.lang-rtl-badge {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
}

.lang-check-icon {
  color: #0ea5e9;
  font-weight: 800;
  font-size: 1.1rem;
}

.lang-no-results {
  text-align: center;
  padding: 30px 15px;
  color: #64748b;
  font-size: 0.95rem;
}

/* Footer */
.lang-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lang-footer-hint {
  font-size: 0.8rem;
  color: #64748b;
}

.lang-done-btn {
  padding: 8px 20px !important;
  border-radius: 9999px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

/* ==========================================================================
   RTL Layout Overrides (Arabic 'ar', Urdu 'ur', Persian 'fa')
   ========================================================================== */
html[dir="rtl"],
body.lang-rtl {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .row-top,
body.lang-rtl .row-top {
  justify-content: flex-start !important;
}

html[dir="rtl"] .btn-lang-selector .lang-chevron,
body.lang-rtl .btn-lang-selector .lang-chevron {
  margin-left: 0;
  margin-right: 4px;
}

html[dir="rtl"] .lang-modal-title-wrap,
body.lang-rtl .lang-modal-title-wrap {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .lang-search-icon,
body.lang-rtl .lang-search-icon {
  left: auto;
  right: 16px;
}

html[dir="rtl"] .lang-search-field,
body.lang-rtl .lang-search-field {
  padding: 12px 46px 12px 18px;
  text-align: right;
}

html[dir="rtl"] .lang-item-left,
body.lang-rtl .lang-item-left {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .lang-rtl-badge,
body.lang-rtl .lang-rtl-badge {
  margin-left: 0;
  margin-right: 6px;
}

html[dir="rtl"] .nav-bar,
body.lang-rtl .nav-bar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nav-item i,
body.lang-rtl .nav-item i {
  margin-right: 0;
  margin-left: 6px;
}

html[dir="rtl"] .hp-benefits-checklist .hp-check-icon,
body.lang-rtl .hp-benefits-checklist .hp-check-icon {
  margin-right: 0;
  margin-left: 10px;
}

html[dir="rtl"] .hp-plan-card,
body.lang-rtl .hp-plan-card {
  text-align: right;
}

html[dir="rtl"] .hp-plan-badge-pill,
body.lang-rtl .hp-plan-badge-pill {
  left: auto;
  right: 22px;
}
