/**
 * Dock Stylings
 */

/* ============================================
   DOCK CONTAINER - Base positioning (CRITICAL)
   ============================================ */
.dock-container {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 1000;
  padding-bottom: 8px;
  justify-content: center;
  align-items: end;
}

.dock {
  display: flex;
  position: relative;
  padding: 8px 12px;
  border-radius: 22px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  isolation: isolate;
}

.dock-icons {
  display: flex;
  position: relative;
  z-index: 2;
  padding-bottom: 4px;
  align-items: end;
  gap: 8px;
}

/* ============================================
   RESPONSIVE DOCK - Exact OS specifications:
   - macOS Dock: 48px icons, 18px badges
   - iOS Dock: 60px icons, 20px badges
   ============================================ */

/* Desktop (default): macOS-style */
.dock-icons--desktop {
  display: flex !important;
}

.dock-icons--mobile {
  display: none !important;
}

.dock-icon {
  width: 48px;
  height: 48px;
}

/* Dock icon images - crisp rendering for Retina displays */
.dock-icon img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
}

.dock-icon__badge {
  height: 18px;
  min-width: 18px;
  font-size: 11px;
  border-radius: 9px;
}

/* ============================================
   DOCK GLASS - The actual glass layer (CRITICAL!)
   Must be absolutely positioned to fill the dock
   ============================================ */
.dock-glass {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--lg-tint-gradient);
  /* backdrop-filter injected by JS for Chromium */
}

.dock-shine {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  border: 0.05px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.25),
    inset 0 -1px 1px rgba(255, 255, 255, 0.05);
}

/* Use dock-icon-wrapper for hover since dock-icon has pointer-events: none */
.dock-icon-wrapper:hover .glass-tooltip {
  opacity: 1;
}

/* ============================================
   iOS MODE - Class-based styling
   Applied when .desktop--ios is active (touch devices)
   Works on ANY viewport size, not just narrow screens
   ============================================ */
.desktop--ios .dock-icons--desktop {
  display: none !important;
}

.desktop--ios .dock-icons--mobile {
  display: flex !important;
}

.desktop--ios .dock-container {
  /* Use safe area inset for bottom padding on iOS */
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: auto !important;
  z-index: 1000 !important;
  /* Ensure dock is positioned within visible viewport */
  bottom: 0 !important;
}

.desktop--ios .dock {
  padding: 10px 14px;
  border-radius: 28px;
  pointer-events: auto !important;
  /* Ensure touch events work */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.desktop--ios .dock-icons {
  gap: 14px;
  align-items: center !important;
  padding-bottom: 0 !important;
  pointer-events: auto !important;
}

.desktop--ios .dock-icon-wrapper {
  pointer-events: auto !important;
  cursor: pointer !important;
  /* Ensure touch events work on mobile */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.desktop--ios .dock-icon {
  width: 60px;
  height: 60px;
  /* Allow pointer events on mobile - touch needs to reach the element */
  pointer-events: auto !important;
  cursor: pointer !important;
  touch-action: manipulation;
}

.desktop--ios .dock-icon__badge {
  height: 20px;
  min-width: 20px;
  font-size: 12px;
  border-radius: 10px;
  top: -3px;
  right: -3px;
}

.desktop--ios .dock-icon:hover {
  transform: none;
}

/* Hide open app indicator in iOS mode - macOS only feature */
.desktop--ios .dock-icon__indicator {
  display: none;
}

/* Scale calendar text for larger iOS icons */
.desktop--ios .calendar-icon__label {
  font-size: 12px;
}

.desktop--ios .calendar-icon__day {
  font-size: 32px;
}

/* ============================================
   LOADING STATE - Before JS runs
   Show a subtle blur while loading
   ============================================ */
body:not(.lg-ready) .dock-glass {
  backdrop-filter: blur(15px) saturate(1.3);
  -webkit-backdrop-filter: blur(15px) saturate(1.3);
  background: var(--lg-tint-gradient);
}

/* ============================================
   SAFARI - Enhanced fallback with chromatic edges
   Dark tint for readability
   ============================================ */
.lg-safari .dock-glass {
  backdrop-filter: blur(30px) saturate(1) brightness(1.05) !important;
  -webkit-backdrop-filter: blur(30px) saturate(1) brightness(1.05) !important;
  background: var(--lg-tint-gradient) !important;
  box-shadow:
    inset 1px 0 8px -2px rgba(180, 140, 200, 0.15),
    inset -1px 0 8px -2px rgba(140, 180, 220, 0.15),
    inset 0 1px 6px -2px rgba(180, 160, 200, 0.12),
    inset 0 -1px 6px -2px rgba(160, 180, 210, 0.12);
}

/* ============================================
   FIREFOX - Blur fallback (no SVG backdrop support)
   Dark tint for readability
   ============================================ */
.lg-firefox .dock-glass {
  backdrop-filter: blur(25px) saturate(1) brightness(1.05);
  background: var(--lg-tint-gradient);
}

/* ============================================
   FALLBACK - When SVG filter fails or unsupported
   Dark tint for readability
   ============================================ */
.lg-fallback .dock-glass {
  backdrop-filter: blur(25px) saturate(1) brightness(1.05) !important;
  -webkit-backdrop-filter: blur(25px) saturate(1) brightness(1.05) !important;
  background: var(--lg-tint-gradient) !important;
}
