/**
 * Language Toggle Button - Premium Modern Design
 * Ultra-modern design with advanced visual effects and micro-interactions
 * 
 * @author Senior Frontend Architect
 * @version 10.0.0
 */

/*--------------------------------------------------------------
# CSS CUSTOM PROPERTIES
--------------------------------------------------------------*/
:root {
  --i18n-bg: linear-gradient(135deg, #f7f8fa, #e4e6ea);
  --i18n-bg-hover: linear-gradient(135deg, #e4e6ea, #dadde1);
  --i18n-border: #1877f2;
  --i18n-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.05);
  --i18n-shadow-hover: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
  --i18n-glow: 0 0 8px rgba(24,119,242,0.2);
  --i18n-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --i18n-scale: 1;
  --i18n-scale-hover: 1.05;
  --i18n-rotate: 0deg;
}

@media (prefers-color-scheme: dark) {
  :root {
    --i18n-bg: linear-gradient(135deg, #242526, #18191a);
    --i18n-bg-hover: linear-gradient(135deg, #2f3031, #242526);
    --i18n-border: #1877f2;
    --i18n-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --i18n-shadow-hover: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --i18n-glow: 0 0 8px rgba(24,119,242,0.3);
    --i18n-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --i18n-scale: 1;
    --i18n-scale-hover: 1.05;
    --i18n-rotate: 0deg;
  }
}

/*--------------------------------------------------------------
# PREMIUM LANGUAGE TOGGLE BUTTON
--------------------------------------------------------------*/
.i18n-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  min-height: 32px;
  background: var(--i18n-bg);
  border: 1px solid var(--i18n-border);
  border-radius: 10px;
  cursor: pointer;
  font: 600 12px/1.2 ui-sans-serif, system-ui;
  color: #1877f2;
  position: absolute;
  top: 10px;
  inset-inline-end: 14px;
  user-select: none;
  outline: none;
  transition: var(--i18n-transition);
  box-shadow: var(--i18n-shadow);
  z-index: 1000;
  transform: scale(var(--i18n-scale)) rotate(var(--i18n-rotate));
}

/* RTL Positioning Override */
html[dir="rtl"] .i18n-link {
  inset-inline-start: 14px;
  inset-inline-end: auto;
}

/*--------------------------------------------------------------
# PREMIUM HOVER EFFECTS
--------------------------------------------------------------*/
.i18n-link:hover {
  background: var(--i18n-bg-hover);
  box-shadow: var(--i18n-shadow-hover), var(--i18n-glow);
  transform: scale(var(--i18n-scale-hover)) translateY(-2px) rotate(1deg);
  color: #166fe5;
  --i18n-rotate: 1deg;
}

.i18n-link:active {
  transform: scale(0.95) translateY(0) rotate(0deg);
  box-shadow: var(--i18n-shadow);
  --i18n-rotate: 0deg;
}

/*--------------------------------------------------------------
# PREMIUM LANGUAGE SEGMENTS
--------------------------------------------------------------*/
.i18n-link .i18n-sep {
  opacity: 0.4;
  font-weight: 300;
  font-size: 0.85em;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #64748b;
  transform: scale(1);
}

.i18n-link:hover .i18n-sep {
  opacity: 0.8;
  color: #475569;
  transform: scale(1.1) rotate(-2deg);
}

.i18n-link .i18n-cur {
  position: relative;
  font-weight: 700;
  font-size: 1em;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #1877f2;
  transform: scale(1);
  text-shadow: 0 1px 2px rgba(24,119,242,0.1);
}

.i18n-link:hover .i18n-cur {
  color: #166fe5;
  transform: scale(1.05) rotate(1deg);
  text-shadow: 0 2px 4px rgba(24,119,242,0.2);
}

.i18n-link .i18n-alt {
  opacity: 0.5;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #64748b;
  transform: scale(1);
}

.i18n-link:hover .i18n-alt {
  opacity: 0.8;
  color: #475569;
  transform: scale(1.08) rotate(-1deg);
}

/*--------------------------------------------------------------
# PREMIUM UNDERLINE ANIMATION
--------------------------------------------------------------*/
.i18n-link .i18n-cur::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -3px;
  height: 3px;
  transform: scaleX(0) rotate(-1deg);
  transform-origin: inline-start;
  background: linear-gradient(90deg, #1877f2, #42a5f5, #60a5fa);
  border-radius: 2px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(24, 119, 242, 0.4), 0 0 12px rgba(24, 119, 242, 0.2);
}

.i18n-link:hover .i18n-cur::after {
  transform: scaleX(1) rotate(0deg);
  box-shadow: 0 0 8px rgba(24, 119, 242, 0.6), 0 0 16px rgba(24, 119, 242, 0.3);
}

/* RTL Underline Animation */
html[dir="rtl"] .i18n-link .i18n-cur::after {
  transform-origin: inline-end;
  background: linear-gradient(270deg, #1877f2, #42a5f5, #60a5fa);
}

/*--------------------------------------------------------------
# PREMIUM DARK MODE SUPPORT
--------------------------------------------------------------*/
@media (prefers-color-scheme: dark) {
  .i18n-link {
    color: #1877f2;
  }
  
  .i18n-link:hover {
    color: #42a5f5;
  }
  
  .i18n-link .i18n-cur::after {
    background: linear-gradient(90deg, #1877f2, #42a5f5, #60a5fa);
    box-shadow: 0 0 6px rgba(24, 119, 242, 0.5), 0 0 12px rgba(24, 119, 242, 0.3);
  }
  
  html[dir="rtl"] .i18n-link .i18n-cur::after {
    background: linear-gradient(270deg, #1877f2, #42a5f5, #60a5fa);
  }
  
  .i18n-link:hover .i18n-cur::after {
    box-shadow: 0 0 8px rgba(24, 119, 242, 0.7), 0 0 16px rgba(24, 119, 242, 0.4);
  }
}

/*--------------------------------------------------------------
# PREMIUM FOCUS STATES
--------------------------------------------------------------*/
.i18n-link:focus-visible {
  outline: 3px solid #1877f2;
  outline-offset: 4px;
  box-shadow: var(--i18n-shadow-hover), var(--i18n-glow), 0 0 0 4px rgba(24, 119, 242, 0.15);
  transform: scale(var(--i18n-scale-hover)) rotate(0.5deg);
  --i18n-rotate: 0.5deg;
}

/*--------------------------------------------------------------
# ACCESSIBILITY ENHANCEMENTS
--------------------------------------------------------------*/
/* High contrast mode support */
@media (prefers-contrast: high) {
  .i18n-link {
    border: 2px solid currentColor;
    background: transparent;
  }
  
  .i18n-link:focus-visible {
    outline-width: 3px;
  }
  
  .i18n-link .i18n-cur::after {
    background: currentColor;
  }
}

/*--------------------------------------------------------------
# REDUCED MOTION SUPPORT
--------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  .i18n-link {
    transition: none;
  }
  
  .i18n-link:hover {
    transform: none;
  }
  
  .i18n-link .i18n-cur::after {
    transition: none;
  }
  
  .i18n-link:hover .i18n-cur::after {
    transform: scaleX(0);
  }
}

/*--------------------------------------------------------------
# PREMIUM RESPONSIVE DESIGN
--------------------------------------------------------------*/
@media (max-width: 768px) {
  .i18n-link {
    top: 8px;
    padding: 0.35rem 0.5rem;
    font-size: 11px;
    gap: 0.25rem;
    border-radius: 8px;
    --i18n-scale-hover: 1.02;
  }
}

@media (max-width: 480px) {
  .i18n-link {
    top: 6px;
    padding: 0.3rem 0.45rem;
    font-size: 10px;
    gap: 0.2rem;
    border-radius: 6px;
    --i18n-scale-hover: 1.01;
  }
}

/*--------------------------------------------------------------
# PRINT STYLES
--------------------------------------------------------------*/
@media print {
  .i18n-link {
    display: none;
  }
}