/* ============================================================
   Sorena Auto-Translate — Language Switcher CSS (Frontend)
   Glassmorphism design, CSS-hover open, RTL aware
   ============================================================ */

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

/* ---- Wrapper ---- */
.sat-switcher-wrapper {
  position: relative;
  display: inline-block;
  font-family: 'Inter', sans-serif;
  z-index: 9998;
}

/* ---- Toggle Button ---- */
.sat-switcher-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 40px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  line-height: 1;
  white-space: nowrap;
}
.sat-switcher-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.sat-switcher-flag { font-size: 20px; line-height: 1; }
.sat-switcher-name { font-size: 13px; }
.sat-switcher-caret {
  width: 10px; height: 6px;
  transition: transform 0.2s ease;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ---- Dropdown List ---- */
.sat-switcher-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;

  /* Glassmorphism */
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,.05);
  padding: 8px;
  margin: 0;
  list-style: none;
  min-width: 220px;

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
}

/* ---- Grid Layout ---- */
.sat-switcher-list.sat-layout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  min-width: 280px;
}

/* ---- Columns Layout ---- */
.sat-switcher-list.sat-layout-columns {
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

/* ---- CSS-Hover Open (no JS required for desktop) ---- */
.sat-switcher-wrapper:hover .sat-switcher-list,
.sat-switcher-wrapper:focus-within .sat-switcher-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.sat-switcher-wrapper:hover .sat-switcher-caret,
.sat-switcher-wrapper:focus-within .sat-switcher-caret {
  transform: rotate(180deg);
}

/* ---- Language Item ---- */
.sat-lang-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(241, 245, 249, 0.8);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}
.sat-lang-item:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  transform: translateX(2px);
}
.sat-lang-item--active {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
  font-weight: 600;
}
.sat-lang-item--active::after {
  content: '✓';
  margin-left: auto;
  font-size: 11px;
  color: #10b981;
}
.sat-lang-item-flag { font-size: 18px; line-height: 1; flex-shrink: 0; }
.sat-lang-item-name { flex: 1; }

/* ---- RTL support ---- */
.sat-switcher-wrapper[dir="rtl"] .sat-switcher-list { left: auto; right: 0; }
.sat-lang-item[dir="rtl"] { flex-direction: row-reverse; }

/* ---- Accessible focus styles ---- */
.sat-switcher-toggle:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 3px;
}
.sat-lang-item:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: -2px;
  border-radius: 10px;
}

/* ---- Mobile: 3-column grid ---- */
@media (max-width: 768px) {
  .sat-switcher-list {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    right: auto;
    top: auto;
    width: calc(100vw - 32px);
    max-width: 400px;
  }
  .sat-switcher-wrapper:hover .sat-switcher-list,
  .sat-switcher-wrapper:focus-within .sat-switcher-list {
    transform: translateX(-50%) translateY(0);
  }
  .sat-switcher-list.sat-layout-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- Minimal style variant ---- */
.sat-switcher-wrapper.sat-style-minimal .sat-switcher-toggle {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sat-switcher-wrapper.sat-style-minimal .sat-switcher-list {
  background: #fff;
  border: 1px solid #e2e8f0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.sat-switcher-wrapper.sat-style-minimal .sat-lang-item { color: #334155; }
.sat-switcher-wrapper.sat-style-minimal .sat-lang-item:hover { background: #f1f5f9; color: #0f172a; }
.sat-switcher-wrapper.sat-style-minimal .sat-lang-item--active { background: #e0e7ff; color: #3730a3; }

/* ---- Floating fixed position variant (optional, add class .sat-fixed) ---- */
.sat-switcher-wrapper.sat-fixed {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
}
