/* === Mobile Bottom Dock (Enhanced) ===
   - Smart Home/Chat slot swapping based on page
   - Autohide on scroll with reveal handle
   - Safe-area padding and desktop hide
   - Analytics-ready with data attributes
*/

/* Base dock styles */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1020;
  background: #fff;
  border-top: 1px solid rgba(15, 58, 66, 0.12);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
}

.dock.hidden {
  transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
}

.dock.userClosed {
  transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
}

/* Dock inner container */
.dock nav {
  display: flex;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
  align-items: stretch;
}

/* Dock items (buttons/links) */
.dockItem {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 2px solid #4bb6c8;
  background: #fff;
  color: #0f3a42;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.dockItem:focus-visible {
  outline: 3px solid #4bb6c8;
  outline-offset: 2px;
}

.dockItem[aria-current="page"] {
  background: linear-gradient(135deg, #4bb6c8, #116a84);
  color: #fff;
  border-color: #116a84;
}

/* CTA variants */
.dockCta {
  background: linear-gradient(135deg, #4bb6c8, #116a84);
  color: #fff;
  border-color: #116a84;
}

.dockCta:hover,
.dockCta:active {
  background: linear-gradient(135deg, #3da5b7, #0e5568);
  border-color: #0e5568;
  color: #fff;
}

.dockAction {
  background: #fff;
  color: #0f3a42;
  border-color: #4bb6c8;
}

.dockAction:hover,
.dockAction:active {
  background: #eaf6f9;
  border-color: #3da5b7;
  color: #0f3a42;
}

/* Chat button (initially hidden on non-homepage) */
.dockChat {
  display: none;
}

/* Icons */
.dockItem i {
  font-size: 1rem;
  flex-shrink: 0;
}

.dockItem .externalIcon {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Reveal handle */
.dockHandle {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(0);
  z-index: 1019;
  background: rgba(75, 182, 200, 0.95);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  padding: 6px 20px 8px 20px;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.dockHandle.visible {
  opacity: 1;
  pointer-events: auto;
}

.dockHandle:hover {
  background: rgba(61, 165, 183, 0.95);
}

.dockHandle:focus-visible {
  outline: 3px solid #4bb6c8;
  outline-offset: 2px;
}

.dockHandle i {
  color: #fff;
  font-size: 1rem;
  display: block;
}

/* Desktop: hide dock entirely, show floating chat */
@media (min-width: 768px) {
  .dock,
  .dockHandle {
    display: none !important;
  }
}

/* Body padding to clear dock on mobile */
@media (max-width: 767.98px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  /* Hide floating chat launcher on mobile; use dock Ask Dantara instead */
  #dantara-chat-root .dc-launch { display: none !important; }
}

/* Compact text on smaller screens */
@media (max-width: 380px) {
  .dockItem {
    font-size: 0.8125rem;
    gap: 4px;
    padding: 10px 6px;
  }
  .dockItem span {
    display: none;
  }
  .dockItem i {
    font-size: 1.125rem;
  }
}
