/* ════════════════════════════════════════════════
   AI Translator – Frontend Switcher (Minimalist)
   ════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&display=swap');

/* ── Position wrapper ── */
.ait-switcher {
  position: fixed;
  z-index: 99999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.ait-switcher.top-right    { top: 16px;    right: 16px;  }
.ait-switcher.top-left     { top: 16px;    left: 16px;   }
.ait-switcher.bottom-right { bottom: 16px; right: 16px;  }
.ait-switcher.bottom-left  { bottom: 16px; left: 16px;   }

/* ═══════════════════════════════════════════════
   MINIMAL STYLE — Just ESP / ENG abbreviation
   ═══════════════════════════════════════════════ */

.ait-trigger-minimal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px 7px 13px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #1a1a1a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.ait-trigger-minimal:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
}
.ait-trigger-minimal:active {
  transform: translateY(0);
}
.ait-trigger-minimal .ait-abbr {
  line-height: 1;
}
.ait-trigger-minimal .ait-chevron {
  opacity: 0.5;
  transition: transform 0.2s ease;
}
.ait-switcher.open .ait-trigger-minimal .ait-chevron {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════
   INLINE PILLS STYLE — ESP | ENG side by side
   ═══════════════════════════════════════════════ */

.ait-trigger-pills {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 3px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.ait-trigger-pills .ait-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.55);
  text-decoration: none;
  transition: all 0.18s ease;
  line-height: 1.2;
}
.ait-trigger-pills .ait-pill:hover {
  color: rgba(0, 0, 0, 0.85);
  background: rgba(0, 0, 0, 0.04);
}
.ait-trigger-pills .ait-pill.active {
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════
   CLASSIC STYLE (flag + name) — kept for compatibility
   ═══════════════════════════════════════════════ */

.ait-switcher.ait-style-classic .ait-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50px;
  padding: 8px 14px 8px 10px;
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  color: #1a1a1a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s ease;
}
.ait-switcher.ait-style-classic .ait-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.ait-switcher.ait-style-classic .ait-flag { font-size: 16px; line-height: 1; }
.ait-switcher.ait-style-classic .ait-chevron {
  font-size: 9px;
  opacity: 0.5;
  transition: transform 0.2s ease;
}
.ait-switcher.ait-style-classic.open .ait-chevron {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════
   DROPDOWN PANEL (shared, minimalist)
   ═══════════════════════════════════════════════ */

.ait-dropdown {
  position: absolute;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 5px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 10px 38px rgba(0, 0, 0, 0.12),
    0 6px 12px rgba(0, 0, 0, 0.06);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.97);
  transform-origin: top right;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Position dropdown relative to trigger anchor */
.ait-switcher.top-right    .ait-dropdown { top: calc(100% + 6px); right: 0;     }
.ait-switcher.top-left     .ait-dropdown { top: calc(100% + 6px); left: 0;      }
.ait-switcher.bottom-right .ait-dropdown { bottom: calc(100% + 6px); right: 0;  transform-origin: bottom right; }
.ait-switcher.bottom-left  .ait-dropdown { bottom: calc(100% + 6px); left: 0;   transform-origin: bottom left;  }

.ait-switcher.open .ait-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* Language option in dropdown */
.ait-lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px 9px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
  text-decoration: none;
  transition: background 0.12s ease;
  cursor: pointer;
}
.ait-lang-option:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #1a1a1a;
}
.ait-lang-option.active {
  background: rgba(124, 92, 252, 0.08);
  color: #5a3fd4;
}
.ait-lang-option .opt-abbr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.6);
  line-height: 1.3;
}
.ait-lang-option.active .opt-abbr {
  background: #5a3fd4;
  color: #fff;
}
.ait-lang-option .opt-name {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════
   INLINE SWITCHER (shortcode)
   ═══════════════════════════════════════════════ */

.ait-switcher-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 3px;
  font-family: 'Inter', system-ui, sans-serif;
}
.ait-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.55);
  text-decoration: none;
  transition: all 0.18s ease;
  line-height: 1.2;
}
.ait-inline-btn:hover {
  color: rgba(0, 0, 0, 0.85);
  background: rgba(0, 0, 0, 0.05);
}
.ait-inline-btn.active {
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════
   DARK SITE SUPPORT (auto-adapts)
   ═══════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .ait-trigger-minimal,
  .ait-trigger-pills,
  .ait-switcher.ait-style-classic .ait-trigger {
    background: rgba(28, 28, 32, 0.92);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f5f5f7;
  }
  .ait-trigger-pills .ait-pill {
    color: rgba(255, 255, 255, 0.55);
  }
  .ait-trigger-pills .ait-pill:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.06);
  }
  .ait-trigger-pills .ait-pill.active {
    background: #fff;
    color: #1a1a1a;
  }
  .ait-dropdown {
    background: rgba(28, 28, 32, 0.98);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .ait-lang-option {
    color: #f5f5f7;
  }
  .ait-lang-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
  }
  .ait-lang-option .opt-abbr {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.65);
  }
  .ait-lang-option.active {
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
  }
  .ait-lang-option.active .opt-abbr {
    background: #a78bfa;
    color: #1a1a1a;
  }
  .ait-switcher-inline {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .ait-inline-btn {
    color: rgba(255, 255, 255, 0.55);
  }
  .ait-inline-btn:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.06);
  }
  .ait-inline-btn.active {
    background: #fff;
    color: #1a1a1a;
  }
}

/* ═══════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════ */

#ait-loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ait-fade-in 0.2s ease;
}
.ait-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: 'Inter', system-ui, sans-serif;
}
.ait-loader-spinner {
  width: 36px;
  height: 36px;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ait-spin 0.7s linear infinite;
}
.ait-loader-text {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.9;
}
@keyframes ait-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ait-spin    { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
  .ait-switcher.top-right,
  .ait-switcher.bottom-right { right: 12px; }
  .ait-switcher.top-left,
  .ait-switcher.bottom-left  { left: 12px;  }
  .ait-switcher.top-right,
  .ait-switcher.top-left     { top: 12px;    }
  .ait-switcher.bottom-right,
  .ait-switcher.bottom-left  { bottom: 12px; }

  .ait-trigger-minimal {
    padding: 6px 10px 6px 11px;
    font-size: 11px;
  }
}
