/**
 * Internationalization Styles
 * RTL/LTR support and language switcher
 */

/* ══════════════════════════════════════════════════════════════
   LANGUAGE SWITCHER BUTTON
   ══════════════════════════════════════════════════════════════ */

.language-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;

  display: flex;
  align-items: center;
  gap: 7px;

  padding: 8px 14px 8px 10px;
  background: rgba(15, 22, 40, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 40px;

  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.82);

  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease,
              box-shadow 0.25s ease, transform 0.2s ease, color 0.2s ease;

  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.06);
}

.language-switcher:hover {
  background: rgba(8, 145, 178, 0.18);
  border-color: rgba(8, 145, 178, 0.5);
  color: #22d3ee;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12), 0 4px 20px rgba(8, 145, 178, 0.2);
  transform: translateY(-1px);
}

.language-switcher:active {
  transform: scale(0.96);
  box-shadow: none;
}

.language-switcher:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: 3px;
}

.language-switcher svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.9;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.language-switcher:hover svg {
  transform: rotate(20deg) scale(1.1);
  opacity: 1;
}

.language-switcher span {
  white-space: nowrap;
}

/* Light mode */
[data-theme="light"] .language-switcher {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(15, 23, 42, 0.8);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255,255,255,0.9);
}

[data-theme="light"] .language-switcher:hover {
  background: rgba(8, 145, 178, 0.1);
  border-color: rgba(8, 145, 178, 0.4);
  color: #0891b2;
}

/* RTL positioning */
[dir="rtl"] .language-switcher {
  right: auto;
  left: 16px;
}

/* Mobile: icon only */
@media (max-width: 520px) {
  .language-switcher {
    padding: 9px;
    gap: 0;
  }
  .language-switcher span {
    display: none;
  }
  .language-switcher svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 768px) {
  [dir="rtl"] .language-switcher {
    right: auto;
    left: 16px;
  }
}

/* ══════════════════════════════════════════════════════════════
   RTL SUPPORT
   ══════════════════════════════════════════════════════════════ */

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

[dir="rtl"] body {
  direction: rtl;
}

/* RTL font adjustments for Arabic */
[dir="rtl"] body {
  font-family: 'Inter', 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
  letter-spacing: 0;
}

[dir="rtl"] h1, 
[dir="rtl"] h2, 
[dir="rtl"] h3, 
[dir="rtl"] h4, 
[dir="rtl"] h5, 
[dir="rtl"] h6 {
  font-family: 'Outfit', 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
  letter-spacing: 0;
}

/* RTL flex direction adjustments */
[dir="rtl"] .welcome-features,
[dir="rtl"] .education-nav,
[dir="rtl"] .question-nav,
[dir="rtl"] .results-nav,
[dir="rtl"] .habits-nav,
[dir="rtl"] .guidance-nav,
[dir="rtl"] .reassess-actions {
  flex-direction: row-reverse;
}

/* RTL icon positioning */
[dir="rtl"] .btn i:first-child {
  margin-right: 0;
  margin-left: var(--space-sm);
}

[dir="rtl"] .btn i:last-child {
  margin-left: 0;
  margin-right: var(--space-sm);
}

/* RTL dimension badge */
[dir="rtl"] .question-dimension-badge {
  flex-direction: row-reverse;
}

[dir="rtl"] .question-dimension-badge i {
  margin-right: 0;
  margin-left: var(--space-sm);
}

/* RTL guidance cards */
[dir="rtl"] .guidance-card {
  text-align: right;
}

[dir="rtl"] .guidance-card-badge {
  direction: rtl;
}

/* RTL dimension bars */
[dir="rtl"] .dimension-bar-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .dimension-bar-label i {
  margin-right: 0;
  margin-left: var(--space-sm);
}

/* RTL insight items */
[dir="rtl"] .insight-item {
  flex-direction: row-reverse;
}

/* RTL warning signs */
[dir="rtl"] .warning-category-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .warning-category-header i {
  margin-right: 0;
  margin-left: var(--space-sm);
}

/* RTL risk cards */
[dir="rtl"] .risk-card {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .risk-card .icon-wrapper {
  margin-right: 0;
  margin-left: var(--space-md);
}

/* RTL habit cards */
[dir="rtl"] .habit-card {
  text-align: right;
}

/* RTL education sections */
[dir="rtl"] .section-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .section-header .icon-wrapper {
  margin-right: 0;
  margin-left: var(--space-md);
}

/* RTL disclaimer */
[dir="rtl"] .welcome-disclaimer,
[dir="rtl"] .disclaimer-footer {
  flex-direction: row-reverse;
}

[dir="rtl"] .welcome-disclaimer i,
[dir="rtl"] .disclaimer-footer i {
  margin-right: 0;
  margin-left: var(--space-sm);
}

/* RTL education warning */
[dir="rtl"] .education-warning {
  flex-direction: row-reverse;
}

[dir="rtl"] .education-warning i {
  margin-right: 0;
  margin-left: var(--space-md);
}

/* RTL guidance level summary */
[dir="rtl"] .guidance-level-summary {
  flex-direction: row-reverse;
}

[dir="rtl"] .guidance-level-summary .icon-wrapper {
  margin-right: 0;
  margin-left: var(--space-lg);
}

/* RTL guidance category header */
[dir="rtl"] .guidance-category-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .guidance-category-header i {
  margin-right: 0;
  margin-left: var(--space-sm);
}

/* RTL results level badge */
[dir="rtl"] .results-level-badge {
  flex-direction: row-reverse;
}

[dir="rtl"] .results-level-badge i {
  margin-right: 0;
  margin-left: var(--space-sm);
}

/* RTL welcome brand */
[dir="rtl"] .welcome-brand {
  flex-direction: row-reverse;
}

/* RTL lists */
[dir="rtl"] ul,
[dir="rtl"] ol {
  padding-right: var(--space-lg);
  padding-left: 0;
}

/* RTL tables */
[dir="rtl"] table {
  direction: rtl;
}

[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}

/* RTL progress bar (keep LTR for visual consistency) */
[dir="rtl"] .progress-bar-fill {
  /* Progress bars typically remain LTR for universal understanding */
}

/* RTL response options - keep centered */
[dir="rtl"] .response-options {
  /* Response options remain centered */
}

/* ══════════════════════════════════════════════════════════════
   ARABIC TYPOGRAPHY ENHANCEMENTS
   ══════════════════════════════════════════════════════════════ */

/* Better line height for Arabic */
.lang-ar {
  line-height: 1.8;
}

.lang-ar h1,
.lang-ar h2,
.lang-ar h3,
.lang-ar h4,
.lang-ar h5,
.lang-ar h6 {
  line-height: 1.6;
}

/* Better spacing for Arabic text */
.lang-ar p {
  word-spacing: 0.05em;
}

/* Adjust button padding for Arabic */
.lang-ar .btn {
  padding: 12px 24px;
}

/* Adjust card padding for Arabic */
.lang-ar .card-flat,
.lang-ar .question-card,
.lang-ar .guidance-card {
  padding: var(--space-lg);
}

/* ══════════════════════════════════════════════════════════════
   LANGUAGE-SPECIFIC ADJUSTMENTS
   ══════════════════════════════════════════════════════════════ */

/* English specific */
.lang-en {
  /* Default styles work well for English */
}

/* Arabic specific font sizes (slightly larger for readability) */
.lang-ar {
  font-size: 16px;
}

.lang-ar h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.lang-ar h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.lang-ar h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.lang-ar h4 {
  font-size: 1.125rem;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE RTL ADJUSTMENTS
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  [dir="rtl"] .welcome-features {
    flex-direction: column;
  }
  
  [dir="rtl"] .results-grid {
    flex-direction: column;
  }
  
  [dir="rtl"] .insights-grid {
    flex-direction: column;
  }
}

/* ══════════════════════════════════════════════════════════════
   PRINT STYLES (maintain readability in both directions)
   ══════════════════════════════════════════════════════════════ */

@media print {
  .language-switcher {
    display: none;
  }
  
  [dir="rtl"] * {
    direction: rtl;
    text-align: right;
  }
}
