/**
 * RTL-Enhanced Styles with Logical Properties
 * Uses CSS logical properties for automatic RTL/LTR adaptation
 * NO CSS hacks, ONLY structural solutions
 */

/* ===========================
   NAVBAR - RTL & RESPONSIVE
   LAYOUT: Logo RIGHT (EN) / LEFT (Dari)
   =========================== */

.navbar {
  display: flex;
  align-items: center;
  width: 100%;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-direction: row-reverse; /* Logo on RIGHT in LTR */
}

[dir="rtl"] .navbar .container {
  flex-direction: row; /* Logo on LEFT in RTL */
}

/* Logo */
.navbar-brand {
  display: flex;
  align-items: center;
  order: 2; /* Logo comes second (right side) in LTR */
}

[dir="rtl"] .navbar-brand {
  order: 1; /* Logo comes first (left side) in RTL */
}

/* Navbar toggler (hamburger) */
.navbar-toggler {
  order: 1; /* Hamburger comes first (left side) in LTR */
}

[dir="rtl"] .navbar-toggler {
  order: 2; /* Hamburger comes second (right side) in RTL */
}

/* Navbar collapse */
.navbar-collapse {
  flex-grow: 1;
  display: flex;
  order: 1; /* Menu on LEFT in LTR */
}

[dir="rtl"] .navbar-collapse {
  order: 2; /* Menu on RIGHT in RTL */
}

.navbar-nav {
  margin-inline-start: 0 !important;
  margin-inline-end: auto !important;
}

[dir="rtl"] .navbar-nav {
  margin-inline-start: auto !important;
  margin-inline-end: 0 !important;
}

/* Navbar nav */
.navbar-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1rem;
}

.nav-item {
  margin: 0;
}

.nav-link {
  padding-inline: 0.75rem;
  padding-block: 0.5rem;
  text-decoration: none;
  transition: color 0.3s ease;
}

/* Language switcher dropdown in navbar */
#language-switcher {
  margin-inline-start: 1rem;
}

[dir="rtl"] #language-switcher {
  margin-inline-end: 1rem;
  margin-inline-start: 0;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-inline: 0.75rem;
  padding-block: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 120px;
}

#current-lang-flag {
  font-size: 1.2rem;
}

#current-lang-name {
  font-weight: 500;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-inline: 1rem;
  padding-block: 0.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lang-option:hover {
  background: var(--dropdown-hover, #f8f9fa);
}

.lang-option:active {
  background: var(--primary-color, #007bff);
  color: white;
}

/* Mobile Navbar (< 992px) */
@media (max-width: 991.98px) {
  .navbar .container {
    flex-direction: row;
    justify-content: space-between;
  }
  
  [dir="rtl"] .navbar .container {
    flex-direction: row;
  }
  
  .navbar-brand {
    order: 1;
  }
  
  .navbar-toggler {
    order: 3;
  }
  
  [dir="rtl"] .navbar-brand {
    order: 3;
  }
  
  [dir="rtl"] .navbar-toggler {
    order: 1;
  }
  
  .navbar-collapse {
    width: 100%;
    margin-block-start: 1rem;
    order: 4;
  }
  
  .navbar-nav {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
  }
  
  .nav-link {
    padding-block: 0.75rem;
    text-align: start;
  }
  
  [dir="rtl"] .nav-link {
    text-align: end;
  }
  
  #language-switcher {
    margin-inline-start: 0;
    margin-block-start: 1rem;
  }
  
  .lang-dropdown-btn {
    width: 100%;
    justify-content: flex-start;
  }
  
  [dir="rtl"] .lang-dropdown-btn {
    justify-content: flex-end;
  }
}

/* ===========================
   FOOTER - RTL AWARE
   =========================== */

.footer {
  width: 100%;
  background: var(--footer-bg, #1a1a1a);
  color: var(--footer-text, #fff);
  padding-block: 3rem 1.5rem;
}

.footer-container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.footer-main {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-block-end: 2rem;
  justify-content: space-between;
}

.footer-brand {
  flex: 1 1 300px;
  min-width: 200px;
}

.footer-logo {
  margin-block-end: 1.5rem;
}

.footer-logo img {
  max-width: 150px;
  height: auto;
}

.footer-social {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--social-bg, rgba(255,255,255,0.1));
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-icon:hover {
  background: var(--primary-color, #007bff);
  transform: translateY(-2px);
}

.footer-links-container {
  display: flex;
  flex: 2 1 600px;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-column {
  flex: 1 1 150px;
  min-width: 150px;
}

.footer-column h4 {
  margin-block-end: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-block-end: 0.75rem;
}

.footer-links a {
  color: var(--footer-link-color, rgba(255,255,255,0.7));
  text-decoration: none;
  transition: color 0.3s ease;
  padding-inline-start: 0;
}

.footer-links a:hover {
  color: var(--primary-color, #007bff);
  padding-inline-start: 0.25rem;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
  gap: 1rem;
}

.copyright,
.terms {
  font-size: 0.9rem;
}

.terms a {
  color: inherit;
  text-decoration: none;
}

.terms a:hover {
  color: var(--primary-color, #007bff);
}

/* Footer Mobile */
@media (max-width: 767.98px) {
  .footer-main {
    flex-direction: column;
  }
  
  .footer-links-container {
    flex-direction: column;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* ===========================
   GENERAL LAYOUT - LOGICAL PROPERTIES
   =========================== */

/* Spacing utilities */
.mb-4 {
  margin-block-end: 1.5rem;
}

.mb-5 {
  margin-block-end: 3rem;
}

.mt-5 {
  margin-block-start: 3rem;
}

.py-5 {
  padding-block: 3rem;
}

/* Text alignment */
.text-start {
  text-align: start;
}

.text-end {
  text-align: end;
}

/* RTL-specific fixes */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .bi-arrow-right::before {
  content: "\f12f"; /* arrow-left icon */
}

/* Team Cards */
.team-card {
  text-align: center;
}

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

/* Service Cards */
.service-card,
.industry-card,
.value-card {
  text-align: start;
}

[dir="rtl"] .service-card,
[dir="rtl"] .industry-card,
[dir="rtl"] .value-card {
  text-align: start;
}

/* Contact Form */
.contact-card {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.contact-info,
.contact-form {
  flex: 1 1 300px;
}

.info-item {
  display: flex;
  gap: 1rem;
  margin-block-end: 1.5rem;
  align-items: flex-start;
}

.icon-box {
  flex-shrink: 0;
}

.info-content {
  flex: 1;
  text-align: start;
}

[dir="rtl"] .info-content {
  text-align: start;
}

/* Form inputs */
input,
textarea,
select {
  text-align: start;
}

[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: start;
}

/* Buttons */
.btn {
  padding-inline: 1.5rem;
  padding-block: 0.75rem;
}

/* Projects/Articles */
.article-card {
  text-align: start;
}

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

.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Animations - maintain regardless of direction */
.animate_animated {
  animation-duration: 1s;
  animation-fill-mode: both;
}

/* Ensure no layout shift on language change */
html.is-lang-switching *,
html.is-lang-switching *::before,
html.is-lang-switching *::after {
  transition: none !important;
}
