/**
 * Mobile Panel Styles
 * ===================
 * Animations and visual feedback for mobile panel navigation.
 * Used by mobile_panel_controller.js for swipe gestures.
 */

/* ========================================
 * Panel Transition Animations
 * ======================================== */

/* Exit animation - slide out left */
.mobile-panel--exit-left {
  animation: mobilePanelExitLeft 0.15s ease-out forwards;
}

/* Exit animation - slide out right */
.mobile-panel--exit-right {
  animation: mobilePanelExitRight 0.15s ease-out forwards;
}

/* Enter animation - slide in from left */
.mobile-panel--enter-left {
  animation: mobilePanelEnterLeft 0.25s ease-out forwards;
}

/* Enter animation - slide in from right */
.mobile-panel--enter-right {
  animation: mobilePanelEnterRight 0.25s ease-out forwards;
}

@keyframes mobilePanelExitLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30%);
  }
}

@keyframes mobilePanelExitRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30%);
  }
}

@keyframes mobilePanelEnterLeft {
  from {
    opacity: 0;
    transform: translateX(-30%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mobilePanelEnterRight {
  from {
    opacity: 0;
    transform: translateX(30%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
 * Edge Bounce Feedback
 * ======================================== */

.mobile-panel--bounce-left {
  animation: mobilePanelBounceLeft 0.3s ease-out;
}

.mobile-panel--bounce-right {
  animation: mobilePanelBounceRight 0.3s ease-out;
}

@keyframes mobilePanelBounceLeft {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(15px);
  }
  60% {
    transform: translateX(-5px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes mobilePanelBounceRight {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-15px);
  }
  60% {
    transform: translateX(5px);
  }
  100% {
    transform: translateX(0);
  }
}

/* ========================================
 * Swipe Progress Indicator
 * ======================================== */

.mobile-swipe-indicator {
  --swipe-progress: 0;

  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent-primary);
  border-radius: var(--radius-lg);
  color: var(--color-accent-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  opacity: calc(var(--swipe-progress) * 0.9);
  z-index: var(--z-notification);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.1s ease-out;
}

.mobile-swipe-indicator--left {
  right: var(--space-4);
}

.mobile-swipe-indicator--right {
  left: var(--space-4);
}

.mobile-swipe-indicator--disabled {
  border-color: var(--color-text-muted);
  color: var(--color-text-muted);
  opacity: calc(var(--swipe-progress) * 0.3);
}

/* Icon arrows */
.mobile-swipe-indicator--left::before {
  content: '→';
  margin-right: var(--space-2);
}

.mobile-swipe-indicator--right::before {
  content: '←';
  margin-right: var(--space-2);
}

/* ========================================
 * Touch Feedback States
 * ======================================== */

/* Active touch state on buttons */
@media (hover: none) and (pointer: coarse) {
  .mobile-panel-switcher__btn:active {
    transform: scale(0.95);
    background: var(--color-bg-elevated);
  }

  .mobile-panel-switcher__btn.active:active {
    transform: scale(0.95);
  }
}

/* ========================================
 * Pull-to-Navigate Hint
 * ======================================== */

.mobile-nav-hint {
  position: fixed;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-pill);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-nav-hint--visible {
  opacity: 1;
}

.mobile-nav-hint__icon {
  display: inline-block;
  margin: 0 var(--space-1);
}

/* ========================================
 * Panel Pagination Dots
 * ======================================== */

.mobile-panel-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2);
}

.mobile-panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border-default);
  transition: all 0.2s ease;
}

.mobile-panel-dot--active {
  width: 24px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-primary);
}

/* ========================================
 * Safe Area Support (Notched Phones)
 * ======================================== */

@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-panel-switcher {
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  }

  /* Ensure modals don't get cut off */
  .mobile-mode .detail-modal,
  .mobile-mode .unified-modal {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* ========================================
 * Landscape Orientation
 * ======================================== */

@media (orientation: landscape) and (max-height: 500px) {
  .mobile-panel-switcher {
    padding: 2px 8px;
  }

  .mobile-panel-switcher__btn {
    min-height: 36px;
    padding: 4px 12px;
    font-size: 11px;
  }

  .mobile-panel-switcher__icon {
    display: none; /* Hide icons in cramped landscape mode */
  }
}

/* ========================================
 * Reduced Motion Support
 * ======================================== */

@media (prefers-reduced-motion: reduce) {
  .mobile-panel--exit-left,
  .mobile-panel--exit-right,
  .mobile-panel--enter-left,
  .mobile-panel--enter-right,
  .mobile-panel--bounce-left,
  .mobile-panel--bounce-right {
    animation: none;
  }

  .mobile-swipe-indicator {
    transition: none;
    opacity: 0.8;
  }
}

/* ========================================
 * High Contrast Mode
 * ======================================== */

@media (prefers-contrast: high) {
  .mobile-panel-switcher__btn {
    border-width: 2px;
  }

  .mobile-panel-switcher__btn.active {
    border-color: white;
    outline: 2px solid white;
    outline-offset: 2px;
  }

  .mobile-swipe-indicator {
    border-width: 2px;
  }
}
