/* Language Switcher Base Styles */
:root {
  --dark-sea-green: #97c680;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Archia', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  color: #000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
  margin-right: 20px;
}

/* Text Overflow Protection for Multi-language Support */
.hero__h1,
.nav__link,
.btn,
.btn-border,
.category__card-title,
.category__card-month,
.skills__list-title,
.skills__list-desc,
.reviews__card-p {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Ensure hero title doesn't break layout */
.hero__h1 {
  max-width: 100%;
  line-height: 1.1;
}

/* Navigation link protection */
.nav__link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Button text protection */
.btn,
.btn-border {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.language-switcher:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.language-switcher button {
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 16px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.language-switcher button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
  transition: left 0.5s ease;
}

.language-switcher button:hover::before {
  left: 100%;
}

.language-switcher button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(151, 198, 128, 0.2);
}

.language-switcher button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.language-switcher .separator {
  color: rgba(0, 0, 0, 0.3);
  font-weight: 300;
  pointer-events: none;
}

.language-switcher .current-lang {
  background: rgba(0, 0, 0, 0.1);
  color: #000;
  font-weight: 600;
  transition: all 0.3s ease;
}

.language-switcher .current-lang.active {
  background-color: var(--dark-sea-green);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(151, 198, 128, 0.3);
}

.language-switcher .other-lang {
  color: rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.language-switcher .other-lang:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.05);
}

.language-switcher .other-lang.active {
  background-color: var(--dark-sea-green);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(151, 198, 128, 0.3);
}

/* Desktop Language Switcher - Positioned in fixed header */
.desktop-language-switcher {
  /* This switcher will be visible in the fixed header */
  /* The fixed header is always visible on scroll, so this works perfectly */
}

/* Floating Language Switcher - Independent of headers */
.floating-language-switcher {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 80px;
  text-align: center;
}

/* Ensure the floating switcher is always visible */
.floating-language-switcher .current-lang,
.floating-language-switcher .other-lang {
  min-width: 50px;
  text-align: center;
  white-space: nowrap;
}

/* Flag emoji styling for better rendering */
.language-switcher button,
.mobile-language-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}

/* Responsive adjustments for floating switcher */
@media screen and (max-width: 1200px) {
  .floating-language-switcher {
    bottom: 25px;
    right: 25px;
  }
}

@media screen and (max-width: 991px) {
  .floating-language-switcher {
    display: none; /* Hide on mobile since we have the mobile switcher */
  }
}

/* Ensure the language switcher is visible in both header contexts */
.header-block.mod--fixed .desktop-language-switcher,
.header-block.mod--absolute .desktop-language-switcher {
  display: flex;
}

/* Mobile Language Switcher */
.mobile-language-switcher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 20px 20px 20px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  font-family: 'Archia', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.2;
  color: #000;
}

.mobile-lang-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-width: 50px;
  text-align: center;
}

.mobile-lang-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
  transition: left 0.5s ease;
}

.mobile-lang-btn:hover::before {
  left: 100%;
}

.mobile-lang-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(151, 198, 128, 0.2);
  background-color: rgba(151, 198, 128, 0.1);
}

.mobile-lang-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.mobile-lang-btn.active {
  background-color: var(--dark-sea-green);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(151, 198, 128, 0.3);
  transition: all 0.3s ease;
}

.mobile-language-switcher .separator {
  color: rgba(0, 0, 0, 0.3);
  font-weight: 300;
  pointer-events: none;
  font-size: 14px;
}

/* Responsive Design */
@media screen and (max-width: 991px) {
  .language-switcher {
    font-size: 13px;
    padding: 6px 12px;
  }
  
  .mobile-lang-btn {
    font-size: 15px;
    padding: 10px 14px;
    min-width: 45px;
  }
  
  .mobile-language-switcher {
    margin: 0 16px 16px 16px;
    padding: 14px 16px;
    font-size: 15px;
  }
}

@media screen and (max-width: 767px) {
  .language-switcher {
    font-size: 12px;
    padding: 5px 10px;
  }
  
  .mobile-lang-btn {
    font-size: 14px;
    padding: 8px 12px;
    min-width: 40px;
  }
  
  .mobile-language-switcher {
    margin: 0 12px 12px 12px;
    padding: 12px 14px;
    font-size: 14px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .language-switcher {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  .language-switcher:hover {
    background: rgba(0, 0, 0, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
  }
  
  .language-switcher .separator {
    color: rgba(255, 255, 255, 0.5);
  }
  
  .language-switcher .current-lang {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
  }
  
  .language-switcher .current-lang.active,
  .language-switcher .other-lang.active {
    background-color: var(--dark-sea-green);
    color: white;
    box-shadow: 0 2px 8px rgba(151, 198, 128, 0.4);
  }
  
  .language-switcher .other-lang {
    color: rgba(255, 255, 255, 0.7);
  }
  
  .language-switcher .other-lang:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }
  
  .mobile-lang-btn {
    color: #fff;
  }
  
  .mobile-lang-btn.active {
    background-color: var(--dark-sea-green);
    color: white;
    box-shadow: 0 2px 8px rgba(151, 198, 128, 0.4);
  }
  
  .mobile-language-switcher .separator {
    color: rgba(255, 255, 255, 0.5);
  }
}
