/* CrisisMitra Language Switcher System */
:root {
  --fab-size: 56px;
  --fab-bg: #2563eb;
  --fab-color: #ffffff;
  --modal-bg: rgba(15, 15, 15, 0.85);
  --modal-border: rgba(255, 255, 255, 0.1);
}

/* Floating Action Button (FAB) */
.lang-fab {
  position: fixed;
  bottom: 24px;
  left: 24px; /* Left side to avoid chat widgets usually on right */
  width: var(--fab-size);
  height: var(--fab-size);
  background: var(--fab-bg);
  color: var(--fab-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  z-index: 9999;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
}

.lang-fab:hover {
  transform: scale(1.1) rotate(15deg);
  background: #1d4ed8;
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.6);
}

.lang-fab svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* Tooltip */
.lang-fab::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.lang-fab:hover::after {
  opacity: 1;
}

/* Modal Overlay */
.lang-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.lang-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Modal Content */
.lang-modal {
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  width: 90%;
  max-width: 800px;
  border-radius: 24px;
  padding: 32px;
  transform: scale(0.95) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.lang-modal-overlay.open .lang-modal {
  transform: scale(1) translateY(0);
}

/* Header */
.lang-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.lang-modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(to right, #60a5fa, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lang-modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.lang-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Grid Layout */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

/* Custom Scrollbar */
.lang-grid::-webkit-scrollbar {
  width: 6px;
}
.lang-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}
.lang-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* Language Cards */
.lang-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.lang-card:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-2px);
}

.lang-card.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: #2563eb;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.15);
}

.lang-native {
  font-size: 1.1rem;
  font-weight: 500;
  color: #fff;
}

.lang-english {
  font-size: 0.8rem;
  color: #94a3b8;
}

.lang-card.active .lang-native {
  color: #60a5fa;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
  .lang-modal {
    width: 100%;
    margin: 0;
    border-radius: 24px 24px 0 0;
    position: fixed;
    bottom: 0;
    max-height: 80vh;
    transform: translateY(100%);
    border-bottom: none;
  }

  .lang-modal-overlay.open .lang-modal {
    transform: translateY(0);
  }

  .lang-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lang-fab {
    bottom: 80px; /* Above bottom nav */
  }
}

/* Hide Google Translate Default UI */
.skiptranslate,
.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame {
  display: none !important;
}

body {
  top: 0 !important;
}

.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}

/* Hide when printing */
@media print {
  .lang-fab,
  .lang-modal-overlay {
    display: none !important;
  }
}
