/* ==========================================================================
   IONITY CENTRAL - ENHANCED MOBILE EXPERIENCE
   Bottom navigation dock, swipe gestures, and touch-optimized layouts
   ========================================================================== */

/* Mobile Bottom Navigation Dock */
.mobile-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10000;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-dock-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.mobile-dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

.mobile-dock-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.mobile-dock-btn.active {
  color: var(--accent-primary);
}

.mobile-dock-btn.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.mobile-dock-btn:active {
  transform: scale(0.9);
  background: rgba(51, 102, 255, 0.1);
}

.mobile-dock-btn .dock-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--status-red);
  color: white;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

/* Show mobile dock on small screens */
@media (max-width: 768px) {
  .mobile-dock {
    display: block;
  }

  /* Adjust main content for dock */
  .main-wrapper {
    padding-bottom: 64px;
  }

  .viewport-container {
    height: calc(100vh - var(--header-height) - 64px);
  }

  /* Hide sidebar on mobile (use dock instead) */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 64px;
    transform: translateX(-100%);
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    bottom: 64px;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    backdrop-filter: blur(4px);
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Compact header on mobile */
  .top-header {
    padding: 0 12px;
    height: 52px;
  }

  .header-right {
    gap: 6px;
  }

  .search-trigger-btn span:not(.kbd-shortcut) {
    display: none;
  }

  .search-trigger-btn {
    padding: 6px 10px;
  }

  .sync-status-pill span:last-child {
    display: none;
  }

  .btn-record-quick span:last-child,
  .btn-watermark-quick span:last-child {
    display: none;
  }

  .btn-record-quick,
  .btn-watermark-quick {
    padding: 6px 8px;
  }

  /* View sections mobile padding */
  .view-section {
    padding: 12px;
  }

  /* Dashboard mobile */
  .dashboard-container {
    padding: 12px;
  }

  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .dashboard-panels {
    grid-template-columns: 1fr;
  }

  .dashboard-bottom-panels {
    grid-template-columns: 1fr;
  }

  .dashboard-welcome {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .welcome-stats {
    justify-content: center;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* CRM mobile */
  .crm-pipeline-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .crm-stage-column {
    max-height: none;
  }

  .forecast-bars-grid {
    grid-template-columns: repeat(2, 1fr);
    height: 100px;
  }

  /* SCRUM mobile */
  .scrum-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .scrum-column {
    max-height: none;
  }

  .sprint-header-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .sprint-metrics-right {
    width: 100%;
    justify-content: space-between;
  }

  /* Auth gate mobile */
  .landing-portal-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero-card {
    padding: 24px;
  }

  .landing-features-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero-headline {
    font-size: 20px;
  }

  .auth-card-container {
    padding: 24px 20px;
  }

  /* KPI cards mobile */
  .kpi-card {
    padding: 14px;
  }

  .kpi-card .kpi-value {
    font-size: 20px;
  }

  /* Floating elements repositioned */
  .fab {
    bottom: 80px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  #floating-screenshare-container {
    max-width: calc(100vw - 32px);
    max-height: 40vh;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .mobile-dock-btn {
    padding: 6px 8px;
    font-size: 8px;
  }

  .mobile-dock-btn svg {
    width: 18px;
    height: 18px;
  }

  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-item {
    min-height: 44px;
  }

  .deal-card,
  .scrum-task-card {
    min-height: 80px;
  }

  /* Larger tap targets */
  .btn-icon {
    min-width: 40px;
    min-height: 40px;
    padding: 10px;
  }

  /* Disable hover effects on touch */
  .hover-lift:hover {
    transform: none;
  }

  .hover-scale:hover {
    transform: none;
  }
}

/* Swipe gesture hint animation */
@keyframes swipeHint {
  0% { transform: translateX(0); opacity: 0.6; }
  50% { transform: translateX(-10px); opacity: 1; }
  100% { transform: translateX(0); opacity: 0.6; }
}

.swipe-hint {
  animation: swipeHint 2s ease-in-out infinite;
}

/* Pull-to-refresh indicator */
.pull-refresh-indicator {
  position: fixed;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10001;
}

.pull-refresh-indicator.visible {
  top: 8px;
}

.pull-refresh-indicator .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
