/* Power Language Switch Styles */
.power-language-switch {
  position: relative;
  display: inline-block;
  z-index: 1000;
}

/* Power Button Base */
.power-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  min-width: 60px;
  justify-content: flex-start;
}

.power-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Power Ring Container */
.power-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

/* precision inner groove and rim */
.power-ring .rim,
.power-ring .groove,
.power-ring .inner-disc,
.power-ring .shine {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.power-ring .rim {
  inset: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.5);
}

.power-ring .groove {
  inset: 2px;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 55%, rgba(0,0,0,0) 60%);
}

.power-ring .inner-disc {
  inset: 4px;
  background: radial-gradient(circle at 40% 35%, #2a2c31 0%, #171a1f 65%, #0f1115 100%);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.7),
    inset 0 -2px 6px rgba(0,0,0,0.6);
}

.power-ring .shine {
  inset: 6px;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.22), rgba(255,255,255,0.06) 40%, rgba(255,255,255,0) 60%);
}

/* Active State - Blue CTA Glow with layered bevel */
.active-ring {
  /* outer ring with subtle brushed bevel */
  background: radial-gradient(circle at 30% 30%, #2a2a2d 0%, #1c1d20 60%, #131418 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 2px var(--primary-dark, #2563eb),
    0 0 18px rgba(37, 99, 235, 0.45),
    0 0 36px rgba(96, 165, 250, 0.25),
    inset 0 2px 3px rgba(255, 255, 255, 0.06),
    inset 0 -2px 6px rgba(0, 0, 0, 0.55);
}

/* animated thin neon ring */
.active-ring::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--primary-dark, #2563eb),
    var(--primary-light, #60a5fa),
    var(--primary-dark, #2563eb)
  );
  opacity: .9;
  filter: drop-shadow(0 0 8px rgba(37, 99, 235, .55));
  z-index: -1;
  animation: rotate 2.6s linear infinite;
}

/* inner lip highlight */
.active-ring::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 20%, rgba(255,255,255,.18), rgba(255,255,255,0) 55%);
  pointer-events: none;
}

/* Inactive State - Dark/Gray */
.inactive-ring {
  background: linear-gradient(135deg, #0f0f10 0%, #1a1a1a 50%, #0f0f10 100%);
  border: 2px solid #333333;
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.02);
}

.inactive-ring::after {
  /* inner subtle glow to mimic off ring */
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03), inset 0 0 0 1px rgba(0,0,0,0.5);
}

/* Power Center (inner circle) */
.power-center {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.active .power-center {
  /* layered dark disc with subtle blue tint */
  background:
    radial-gradient(60% 60% at 40% 35%, rgba(96,165,250,0.10), rgba(96,165,250,0) 60%),
    radial-gradient(circle at 50% 50%, #222428 0%, #17191d 68%, #0f1115 100%);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.65),
    inset 0 -2px 6px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(96, 165, 250, 0.20);
}

.inactive .power-center {
  background: radial-gradient(circle, #1a1a1a 0%, #0f0f10 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* crisp highlight ring inside the active center */
.active .power-center::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.06),
    inset 0 0 12px rgba(37,99,235,0.25);
}

.active .power-center::after {
  content: '';
  position: absolute;
  inset: 5px 6px 10px 6px;
  border-radius: 50%;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.18), rgba(255,255,255,0.02) 40%, rgba(255,255,255,0) 70%);
}

/* Power Icons */
.power-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.active-icon {
  color: var(--primary-light, #60a5fa);
  filter: drop-shadow(0 0 5px rgba(96, 165, 250, 0.65));
}

.inactive-icon {
  color: #666666;
}

/* Labels */
.power-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.active .power-label {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.35);
}

.inactive .power-label {
  color: #888888;
}

/* Dropdown */
.power-dropdown {
  position: absolute;
  top: 100%;
  right: 0; /* Changed from left: 0 to right: 0 for right alignment */
  margin-top: 8px;
  background: rgba(15, 15, 16, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  min-width: 120px;
  max-width: 250px; /* Prevent excessive width */
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.6),
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: dropdownSlide 0.2s ease-out;
  z-index: 1001;
  /* Ensure dropdown never goes off-screen */
  transform: translateX(0);
}

.dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Grid Layout for 2x2 when 4+ languages */
.dropdown-content.grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  width: 200px;
}

.dropdown-content.grid-2x2 .power-btn {
  min-width: 80px;
}

/* Dropdown Animation */
@keyframes dropdownSlide {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Rotation Animation for Active Ring */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Hover Effects */
.inactive:hover .inactive-ring {
  border-color: #555555;
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 8px rgba(255, 255, 255, 0.02);
}

.inactive:hover .inactive-icon {
  color: #aaaaaa;
}

.inactive:hover .power-label {
  color: #bbbbbb;
}

/* Responsive Design */

/* Tablets (768px to 1199px) - Improved touch targets and spacing */
@media (min-width: 768px) and (max-width: 1199px) {
  .power-btn {
    padding: 10px 14px; /* Más área táctil para tablets */
    min-width: 70px;
  }
  
  .power-ring {
    width: 36px; /* Ligeramente más grande para tablets */
    height: 36px;
  }
  
  .power-center {
    width: 26px;
    height: 26px;
  }
  
  .power-icon {
    width: 18px;
    height: 18px;
  }
  
  .power-label {
    font-size: 15px; /* Texto más legible en tablets */
    font-weight: 500;
  }
  
  .power-dropdown {
    min-width: 140px;
    max-width: 280px;
    margin-top: 12px; /* Más separación en tablets */
    padding: 12px;
    border-radius: 14px;
  }
  
  .dropdown-content.grid-2x2 {
    width: 220px;
    gap: 8px;
  }
  
  .dropdown-content.grid-2x2 .power-btn {
    min-width: 90px;
    padding: 8px 12px;
  }
}

/* Mobile phones (up to 767px) */
@media (max-width: 767px) {
  .power-btn {
    padding: 6px 10px;
  }
  
  .power-ring {
    width: 28px;
    height: 28px;
  }
  
  .power-center {
    width: 20px;
    height: 20px;
  }
  
  .power-icon {
    width: 14px;
    height: 14px;
  }
  
  .power-label {
    font-size: 13px;
  }
  
  .power-dropdown {
    min-width: 100px;
    max-width: calc(100vw - 32px); /* Ensure it fits within viewport */
    right: 0;
    left: auto;
  }
  
  .dropdown-content.grid-2x2 {
    width: 180px;
  }
}

/* Focus States for Accessibility */
.power-btn:focus {
  outline: none;
}

.power-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.55);
  border-radius: 8px;
}

/* Dark Theme Specific Adjustments */
@media (prefers-color-scheme: dark) {
  .power-dropdown {
    background: rgba(10, 10, 12, 0.98);
    border-color: rgba(255, 255, 255, 0.08);
  }
}

/* ═══ LIGHT MODE (.light-mode class) ═══ */
.light-mode .power-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.light-mode .power-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.light-mode .inactive-ring {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
  border-color: #cbd5e1;
  box-shadow: none;
}

.light-mode .inactive-ring::after {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.light-mode .inactive .power-center {
  background: #f8fafc;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.light-mode .inactive-icon {
  color: #64748b;
}

.light-mode .inactive:hover .inactive-ring {
  border-color: #94a3b8;
}

.light-mode .inactive:hover .inactive-icon {
  color: #334155;
}

.light-mode .inactive:hover .power-label {
  color: #0f172a !important;
}

/* Remove glowing shadows from active state in light mode */
.light-mode .active-ring {
  box-shadow: 0 0 0 2px var(--primary-dark, #2563eb), inset 0 1px 2px rgba(0,0,0,0.1);
  background: #ffffff;
}

.light-mode .active-ring::before {
  filter: none;
  box-shadow: none;
}

.light-mode .active .power-center {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  background: #ffffff;
}

.light-mode .active .power-center::before {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.light-mode .active .power-label {
  text-shadow: none;
}
