/* ============================================================
   IloveTools — Mobile Bottom Navigation Bar & Scanner Suite
   Engineered for Mobile & Android UX (Google Material 3 Standard)
   ============================================================ */

/* 1. BOTTOM NAVIGATION CONTAINER */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(11, 15, 25, 0.96);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: space-around;
    padding-inline: 8px;
    user-select: none;
    -webkit-user-select: none;
  }

  /* Extra padding on body so bottom nav doesn't cover content */
  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Ensure chatbot floating button is clearly positioned higher above the bottom nav */
  .chatbot-fab, .cb-fab, #cb-fab {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    right: 18px !important;
    z-index: 9999 !important;
  }
  .cb-hint, #cb-hint {
    bottom: calc(106px + env(safe-area-inset-bottom, 0px)) !important;
    right: 78px !important;
    z-index: 9998 !important;
  }
  .cb-panel {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-2, #cbd5e1);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 12px;
  transition: color 0.15s ease, transform 0.15s ease;
  min-width: 56px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  transition: transform 0.15s ease, stroke 0.15s ease;
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-item.is-active,
.mobile-nav-item:hover {
  color: #38bdf8;
}

.mobile-nav-item.is-active svg {
  color: #38bdf8;
  stroke-width: 2.2;
}

/* 2. CENTER HERO SCANNER FAB */
.mobile-nav-fab-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  top: -12px;
}

.mobile-nav-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #d946ef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: none;
  outline: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.5), 0 0 0 4px #0b0f19;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-fab:active {
  transform: scale(0.9);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4), 0 0 0 4px #0e101a;
}

.mobile-nav-fab svg {
  width: 24px;
  height: 24px;
  stroke: #ffffff;
  stroke-width: 2;
}

.mobile-nav-fab-label {
  font-size: 10px;
  font-weight: 700;
  color: #c7d2fe;
  margin-top: 3px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Pulse animation for scanner hero */
.mobile-nav-fab::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid rgba(168, 85, 247, 0.6);
  animation: fabPulse 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes fabPulse {
  0% { transform: scale(1); opacity: 0.8; }
  60% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* 3. QUICK SCANNER BOTTOM SHEET MODAL */
.scanner-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.scanner-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.scanner-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #131622;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px 28px 0 0;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.7);
  z-index: 99999;
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

.scanner-sheet.is-open {
  transform: translateY(0);
}

.scanner-sheet-handle {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  margin: 0 auto 16px;
}

.scanner-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.scanner-sheet-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.scanner-sheet-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818cf8;
}

.scanner-sheet-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2, #cbd5e1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}

.scanner-sheet-close:active {
  background: rgba(255, 255, 255, 0.16);
}

/* Scanner Grid Cards */
.scanner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.scanner-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.scanner-card:active {
  transform: scale(0.97);
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
}

.scanner-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.scanner-card-icon svg {
  width: 22px;
  height: 22px;
}

.scanner-card-icon.doc {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.scanner-card-icon.qr {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.scanner-card-icon.ocr {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}

.scanner-card-icon.snap {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.scanner-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.scanner-card-desc {
  font-size: 0.72rem;
  color: var(--text-3, #94a3b8);
  line-height: 1.35;
}

/* Hidden Camera Native Input Trigger */
.scanner-native-input {
  display: none;
}

/* 4. ANDROID PWA INSTALL PROMPT BANNER */
.android-install-banner {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  right: 14px;
  background: #1e2235;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  padding: 10px 14px;
  display: none;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 998;
  animation: bannerSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.android-install-banner.is-visible {
  display: flex;
}

@keyframes bannerSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.android-install-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.android-install-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.android-install-icon svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
}

.android-install-text {
  display: flex;
  flex-direction: column;
}

.android-install-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #ffffff;
}

.android-install-sub {
  font-size: 0.6875rem;
  color: #94a3b8;
}

.android-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.android-install-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.android-install-btn:active {
  transform: scale(0.95);
}

.android-install-dismiss {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

/* 5. DIRECT CAMERA PROCESSING HUD */
.scan-processing-hud {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  animation: hudFadeIn 0.2s ease-out;
}
.scan-processing-hud.is-active {
  display: flex;
}
.scan-processing-card {
  background: #181b2a;
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 32px rgba(99, 102, 241, 0.25);
  border-radius: 20px;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 300px;
}
.scan-processing-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: hudSpin 0.75s linear infinite;
}
.scan-processing-text h4 {
  margin: 0;
  font-size: 1.05rem;
  color: #ffffff;
  font-weight: 700;
}
.scan-processing-text p {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}
@keyframes hudSpin {
  to { transform: rotate(360deg); }
}
@keyframes hudFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
