/* RTL (Right-to-Left) Layout Overrides for Hebrew
 * This stylesheet is dynamically loaded when Hebrew language is selected
 * Provides full RTL support including mirrored layouts, text alignment, and directional elements
 */

/* Prevent horizontal overflow in RTL */
html[dir="rtl"],
html[dir="rtl"] body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Typography - Hebrew Font Stack */
[dir="rtl"] body {
  font-family: 'Open Sans', 'Noto Sans Hebrew', 'Arial', sans-serif;
  text-align: right;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4 {
  font-family: 'Nunito', 'Noto Sans Hebrew', 'Arial', sans-serif;
  text-align: right;
}

/* Header - Mirror Layout */
[dir="rtl"] .header-container {
  flex-direction: row-reverse;
}

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

[dir="rtl"] nav {
  display: flex;
  flex-direction: row-reverse;
  gap: 1rem;
}

/* Hero Section - Mirror Layout */
[dir="rtl"] .hero-container {
  flex-direction: row-reverse;
}

[dir="rtl"] .hero-content {
  text-align: right;
}

[dir="rtl"] .hero-cta {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

/* Stats Section */
[dir="rtl"] .stats-container {
  flex-direction: row-reverse;
}

[dir="rtl"] .stat-item {
  text-align: center;
}

/* Value Props Cards */
[dir="rtl"] .cards-grid {
  direction: rtl;
}

[dir="rtl"] .card {
  text-align: right;
}

[dir="rtl"] .card h3,
[dir="rtl"] .card p {
  text-align: right;
}

/* Demo Section */
[dir="rtl"] .demo-cards-grid {
  direction: rtl;
}

[dir="rtl"] .demo-card {
  text-align: right;
}

[dir="rtl"] .demo-card-cta {
  flex-direction: row-reverse;
}

[dir="rtl"] .demo-card-cta svg {
  transform: scaleX(-1);
}

[dir="rtl"] .demo-back-link {
  flex-direction: row-reverse;
}

[dir="rtl"] .demo-back-link svg {
  transform: scaleX(-1);
}

[dir="rtl"] .demo-back-link:hover {
  transform: translateX(4px);
}

/* Patient Demo - Chat Interface */
[dir="rtl"] .demo-interface {
  direction: rtl;
}

[dir="rtl"] .chat-messages {
  direction: rtl;
}

[dir="rtl"] .message {
  text-align: right;
}

[dir="rtl"] .system-message {
  align-self: flex-end;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 2px;
}

[dir="rtl"] .user-message {
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 12px;
}

[dir="rtl"] .chat-input {
  text-align: right;
}

[dir="rtl"] .chat-input-wrapper {
  flex-direction: row-reverse;
}

[dir="rtl"] .chat-options {
  direction: rtl;
}

/* Provider Demo - Dashboard */
[dir="rtl"] .provider-header-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .provider-back-link {
  flex-direction: row-reverse;
}

[dir="rtl"] .provider-back-link svg {
  transform: scaleX(-1);
}

[dir="rtl"] .provider-back-link:hover {
  transform: translateX(4px);
}

[dir="rtl"] .dashboard-stats-grid {
  direction: rtl;
}

[dir="rtl"] .stat-card {
  text-align: right;
}

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

[dir="rtl"] .charts-row {
  direction: rtl;
}

[dir="rtl"] .chart-header {
  text-align: right;
}

[dir="rtl"] .bar-chart {
  flex-direction: row-reverse;
}

[dir="rtl"] .roi-label {
  flex-direction: row-reverse;
}

[dir="rtl"] .testimonial-box {
  border-left: none;
  border-right: 4px solid var(--color-sage-green);
  text-align: right;
}

/* Pricing Section */
[dir="rtl"] .pricing-card {
  text-align: right;
}

[dir="rtl"] .features-list {
  text-align: right;
  padding-right: 0;
  padding-left: 0;
}

[dir="rtl"] .features-list li {
  text-align: right;
  direction: rtl;
}

/* Form Section */
[dir="rtl"] .lead-gen-container {
  flex-direction: row-reverse;
}

[dir="rtl"] .lead-gen-content {
  text-align: right;
}

[dir="rtl"] .check-list {
  text-align: right;
  padding-right: 0;
  padding-left: 0;
}

[dir="rtl"] .check-list li {
  text-align: right;
  direction: rtl;
}

[dir="rtl"] .form-group {
  text-align: right;
}

[dir="rtl"] .form-group label {
  text-align: right;
  display: block;
}

[dir="rtl"] .form-group input,
[dir="rtl"] .form-group select {
  text-align: right;
  direction: rtl;
}

/* Footer */
[dir="rtl"] .footer-container {
  flex-direction: row-reverse;
}

[dir="rtl"] .footer-brand {
  text-align: right;
}

[dir="rtl"] .footer-links {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Language Switcher */
[dir="rtl"] .language-switcher {
  margin-right: 0;
  margin-left: 1.5rem;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

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

/* Cookie Consent Banner */
[dir="rtl"] .cookie-banner-content {
  flex-direction: row-reverse;
}

[dir="rtl"] .cookie-banner-text {
  text-align: right;
}

[dir="rtl"] .cookie-banner-text h3,
[dir="rtl"] .cookie-banner-text p {
  text-align: right;
}

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

[dir="rtl"] .opt-out-confirmation {
  right: auto;
  left: 2rem;
  text-align: right;
}

[dir="rtl"] .privacy-settings-link {
  text-align: right;
}

/* Privacy Modal RTL */
[dir="rtl"] .privacy-modal-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .privacy-modal-body {
  text-align: right;
}

[dir="rtl"] .privacy-toggle-row {
  flex-direction: row-reverse;
}

[dir="rtl"] .privacy-toggle-info {
  text-align: right;
}

[dir="rtl"] .privacy-modal-footer {
  justify-content: flex-start;
}

/* SVG Icons - Mirror Directional Icons */
[dir="rtl"] svg.arrow-right,
[dir="rtl"] .arrow-icon {
  transform: scaleX(-1);
}

/* Section Headers - Keep Centered (same as LTR) */
[dir="rtl"] .section-header {
  text-align: center;
}

[dir="rtl"] .section-header h2,
[dir="rtl"] .section-header p {
  text-align: center;
}

/* Demo Intro - Keep Centered (same as LTR) */
[dir="rtl"] .demo-intro {
  text-align: center;
}

[dir="rtl"] .demo-intro .eyebrow,
[dir="rtl"] .demo-intro h2,
[dir="rtl"] .demo-intro p {
  text-align: center;
}

/* Button Groups */
[dir="rtl"] .hero-cta,
[dir="rtl"] .cookie-banner-actions {
  flex-direction: row-reverse;
}

/* Grid Layouts */
[dir="rtl"] .demo-cards-grid,
[dir="rtl"] .cards-grid,
[dir="rtl"] .dashboard-stats-grid {
  direction: rtl;
}

/* Mobile Responsive RTL Adjustments */
@media (max-width: 768px) {
  [dir="rtl"] .header-container {
    flex-direction: row-reverse;
  }

  [dir="rtl"] .hero-container {
    flex-direction: column;
  }

  [dir="rtl"] .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  [dir="rtl"] .hero-cta .btn {
    text-align: center;
    justify-content: center;
  }

  [dir="rtl"] .lead-gen-container {
    flex-direction: column;
  }

  [dir="rtl"] .provider-header-bar {
    flex-direction: column;
    align-items: center;
  }

  [dir="rtl"] .provider-header-bar > div {
    text-align: center;
  }

  [dir="rtl"] .provider-header-bar .header-subtitle,
  [dir="rtl"] .provider-header-bar .provider-header-title {
    text-align: center;
  }

  [dir="rtl"] .cookie-banner-content {
    flex-direction: column;
    text-align: right;
  }

  [dir="rtl"] .cookie-banner-actions {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  [dir="rtl"] .opt-out-confirmation {
    right: auto;
    left: 1rem;
  }
}

/* Text Direction for Mixed Content */
[dir="rtl"] .eyebrow {
  text-align: right;
}

[dir="rtl"] .trust-badge {
  text-align: right;
}

/* Ensure Form Elements Display Correctly in RTL */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] select,
[dir="rtl"] textarea {
  text-align: right;
  direction: rtl;
}

/* Fix Flexbox Alignment in RTL */
[dir="rtl"] .demo-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .chart-card {
  text-align: right;
}

[dir="rtl"] .cta-banner {
  text-align: center;
}

[dir="rtl"] .cta-banner h3,
[dir="rtl"] .cta-banner p {
  text-align: center;
}

[dir="rtl"] .cta-banner-button {
  flex-direction: row-reverse;
}

/* Adjust Padding and Margins for RTL */
[dir="rtl"] .stat-card::before {
  left: auto;
  right: 0;
}

/* List Items in RTL */
[dir="rtl"] ul,
[dir="rtl"] ol {
  padding-right: 0;
  padding-left: 0;
}

[dir="rtl"] li {
  text-align: right;
}

/* Animations - Adjust for RTL */
[dir="rtl"] .btn-primary:hover,
[dir="rtl"] .btn-secondary:hover {
  transform: translateY(-2px);
}

/* Price Display */
[dir="rtl"] .price {
  direction: ltr;
  text-align: right;
}

[dir="rtl"] .price-period {
  direction: rtl;
}

/* Success Message */
[dir="rtl"] .success-content {
  text-align: right;
}

[dir="rtl"] .success-content h3,
[dir="rtl"] .success-content p {
  text-align: right;
}

/* =====================================================
   MOBILE MENU RTL SUPPORT
   ===================================================== */

/* Mobile Menu Drawer - slides from left in RTL */
[dir="rtl"] .mobile-menu {
  right: auto !important;
  left: 0 !important;
  transform: translateX(-100%) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
  visibility: hidden !important;
}

[dir="rtl"] .mobile-menu.open {
  transform: translateX(0) !important;
  visibility: visible !important;
}

/* Mobile Menu Header - in RTL, keep natural order (title left, X right) */
[dir="rtl"] .mobile-menu-header {
  flex-direction: row;
}

[dir="rtl"] .mobile-menu-title {
  text-align: right;
}

/* Mobile Menu Content */
[dir="rtl"] .mobile-menu-content {
  text-align: right;
}

[dir="rtl"] .mobile-menu-label {
  text-align: right;
}

/* Mobile Language Options */
[dir="rtl"] .mobile-lang-option {
  flex-direction: row-reverse;
  text-align: right;
}

/* Mobile CTA */
[dir="rtl"] .mobile-menu-cta {
  text-align: center;
}
