/* ==========================================================================
   StarTON v3.3.0 — Global Multilingual Language Selector & RTL Stylesheet
   Supports 136 International Languages, 3D Header Selector Button,
   Region-Wise Tabs, Live Search, Detect My Language, and Dynamic RTL Layout.
   ========================================================================== */

/* 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: 8px 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 12px 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 20px rgba(14, 165, 233, 0.16) !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-native-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  margin-left: 2px;
}

.btn-lang-selector .lang-chevron {
  font-size: 10px;
  color: #64748b;
  margin-left: 4px;
  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: 94%;
  max-width: 860px;
  max-height: 88vh;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(14, 165, 233, 0.1);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.lang-modal-dialog.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.lang-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  position: relative;
  gap: 16px;
}

.lang-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-modal-header-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(14, 165, 233, 0.15);
}

.lang-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.lang-modal-subtitle {
  margin: 2px 0 0 0;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
}

.lang-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* "Detect My Language" Button */
.btn-detect-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  color: #0284c7;
  border: 1px solid #bae6fd;
  border-radius: 9999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-detect-lang:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.lang-modal-close {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-modal-close:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Modal Body */
.lang-modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Search Bar Container */
.lang-search-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lang-search-wrap {
  position: relative;
  flex: 1;
}

.lang-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: #94a3b8;
  pointer-events: none;
}

.lang-search-field {
  width: 100%;
  padding: 10px 38px 10px 40px;
  font-size: 13.5px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  outline: none;
  background: #f8fafc;
  color: #0f172a;
  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);
}

.lang-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #e2e8f0;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lang-search-clear:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.lang-results-count {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
}

/* Recently Used Strip */
.lang-recents-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
}

.lang-recents-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.lang-recents-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.lang-recents-chips::-webkit-scrollbar {
  display: none;
}

.lang-recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lang-recent-chip:hover {
  border-color: #0ea5e9;
  background: #f0f9ff;
  color: #0284c7;
  transform: translateY(-1px);
}

.lang-recent-chip .chip-code {
  font-size: 10px;
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Regional Category Pills */
.lang-region-scroller {
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.lang-region-pills {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.lang-region-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.lang-region-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.lang-region-pill.active {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.3);
}

/* Grid of 136 Language Cards */
.lang-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
}

.lang-grid-container::-webkit-scrollbar {
  width: 6px;
}

.lang-grid-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Individual Language Card */
.lang-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #f1f5f9;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.lang-item-card:hover {
  border-color: #38bdf8;
  background: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
}

.lang-item-card.active {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.lang-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lang-item-flag {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.lang-item-names {
  min-width: 0;
}

.lang-native-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-roman-name {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-region-name {
  color: #0284c7;
}

.lang-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-iso-pill {
  font-size: 10.5px;
  font-weight: 800;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.lang-item-card.active .lang-iso-pill {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.lang-check-icon {
  color: #0284c7;
  font-weight: 900;
  font-size: 15px;
}

/* RTL / LTR Badges */
.lang-rtl-badge {
  display: inline-block;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border: 1px solid #fcd34d;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.lang-ltr-badge {
  display: none;
}

.lang-star-badge {
  font-size: 11px;
}

/* Empty Results */
.lang-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
}

.lang-no-results .no-results-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.lang-no-results h4 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.lang-no-results p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

/* Modal Footer */
.lang-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  gap: 12px;
}

.lang-footer-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}

.lang-footer-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.lang-done-btn {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 9999px !important;
  padding: 7px 22px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-done-btn:hover {
  background: #0369a1 !important;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

/* Floating Toast Notification */
.lang-modal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-modal-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.lang-modal-toast.success {
  background: #047857;
}

.lang-modal-toast.info {
  background: #0284c7;
}

/* ==========================================================================
   RTL Layout Overrides (Arabic, Urdu, Persian, Pashto, Dari, Sindhi, Hebrew)
   ========================================================================== */
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-header,
body.lang-rtl .lang-modal-header {
  flex-direction: row-reverse;
}

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-modal-header-actions,
body.lang-rtl .lang-modal-header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-search-icon,
body.lang-rtl .lang-search-icon {
  left: auto;
  right: 14px;
}

html[dir="rtl"] .lang-search-clear,
body.lang-rtl .lang-search-clear {
  right: auto;
  left: 12px;
}

html[dir="rtl"] .lang-search-field,
body.lang-rtl .lang-search-field {
  padding: 10px 42px 10px 38px;
  text-align: right;
}

html[dir="rtl"] .lang-recents-section,
body.lang-rtl .lang-recents-section {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-recents-chips,
body.lang-rtl .lang-recents-chips {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-item-card,
body.lang-rtl .lang-item-card {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-item-left,
body.lang-rtl .lang-item-left {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .lang-item-right,
body.lang-rtl .lang-item-right {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-modal-footer,
body.lang-rtl .lang-modal-footer {
  flex-direction: row-reverse;
}

html[dir="rtl"] .lang-footer-legend,
body.lang-rtl .lang-footer-legend {
  flex-direction: row-reverse;
}

/* Global Website Structural Mirroring under RTL */
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-nav-bar .left-section,
body.lang-rtl .hp-nav-bar .left-section {
  order: 2;
}

html[dir="rtl"] .hp-nav-bar .right-section,
body.lang-rtl .hp-nav-bar .right-section {
  order: 1;
}

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;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .lang-modal-dialog {
    width: 96%;
    max-height: 92vh;
    border-radius: 16px;
  }

  .lang-modal-header {
    padding: 14px 16px;
  }

  .lang-modal-body {
    padding: 12px 16px;
    gap: 10px;
  }

  .lang-grid-container {
    grid-template-columns: 1fr;
    max-height: 320px;
  }

  .btn-detect-lang span {
    display: none;
  }

  .lang-modal-footer {
    padding: 12px 16px;
  }

  .lang-footer-legend {
    display: none;
  }
}
