/**
 * TrendingTags - Enhanced Mobile Features
 * Pull to Refresh, Bottom Sheets, Swipe Gestures
 * Version 99
 */

/* ==============================================
   PULL TO REFRESH
   ============================================== */

.ptr-wrapper {
  position: relative;
  overflow: hidden;
}

.ptr-indicator {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: top 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.ptr-indicator svg {
  width: 20px;
  height: 20px;
  color: var(--color-accent);
  transition: transform 0.3s ease;
}

.ptr-indicator.pulling svg {
  transform: rotate(180deg);
}

.ptr-indicator.refreshing svg {
  animation: ptr-spin 1s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ptr-wrapper.refreshing .ptr-indicator {
  top: 20px;
}

/* ==============================================
   BOTTOM SHEET
   ============================================== */

.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg-card);
  border-radius: 20px 20px 0 0;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 8px;
  cursor: grab;
}

.bottom-sheet-handle::before {
  content: '';
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--color-border);
}

.bottom-sheet-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
}

.bottom-sheet-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  border: none;
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bottom-sheet-close:hover {
  background: var(--color-accent);
  color: white;
}

.bottom-sheet-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(85vh - 100px);
  -webkit-overflow-scrolling: touch;
}

/* Bottom Sheet Menu Items */
.bottom-sheet-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bottom-sheet-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.bottom-sheet-menu-item:last-child {
  border-bottom: none;
}

.bottom-sheet-menu-item:hover,
.bottom-sheet-menu-item:active {
  color: var(--color-accent);
}

.bottom-sheet-menu-item svg {
  width: 24px;
  height: 24px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.bottom-sheet-menu-item:hover svg {
  color: var(--color-accent);
}

.bottom-sheet-menu-item span {
  font-size: 1rem;
  font-weight: 500;
}

/* Share Bottom Sheet */
.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 8px 0;
}

.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s ease;
  cursor: pointer;
}

.share-item:hover,
.share-item:active {
  border-color: var(--color-accent);
  transform: scale(1.05);
}

.share-item svg {
  width: 28px;
  height: 28px;
}

.share-item span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ==============================================
   SWIPE GESTURES - Post Navigation
   ============================================== */

.swipe-container {
  position: relative;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}

.swipe-hint {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  padding: 12px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
  pointer-events: none;
}

.swipe-hint.left {
  left: 20px;
}

.swipe-hint.right {
  right: 20px;
}

.swipe-hint.visible {
  opacity: 1;
}

.swipe-hint svg {
  width: 20px;
  height: 20px;
  color: var(--color-accent);
}

.swipe-hint span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Swipe navigation buttons (visible on hover/touch) */
.swipe-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.swipe-nav.prev {
  left: 10px;
}

.swipe-nav.next {
  right: 10px;
}

.swipe-container:hover .swipe-nav,
.swipe-nav.visible {
  opacity: 1;
}

.swipe-nav-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.swipe-nav-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.swipe-nav-btn svg {
  width: 24px;
  height: 24px;
}

/* ==============================================
   BREADCRUMBS
   ============================================== */

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0;
  font-size: 0.875rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
}

.breadcrumb-item a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
  color: var(--color-accent);
}

.breadcrumb-item.active {
  color: var(--color-text);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--color-border);
}

.breadcrumb-separator svg {
  width: 14px;
  height: 14px;
}

/* ==============================================
   MOBILE RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
  .bottom-sheet {
    border-radius: 16px 16px 0 0;
  }
  
  .share-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  
  .share-item {
    padding: 10px 8px;
  }
  
  .share-item svg {
    width: 24px;
    height: 24px;
  }
  
  .swipe-nav {
    display: none;
  }
  
  .breadcrumbs {
    font-size: 0.8rem;
    padding: 12px 0;
  }
}

/* Hide on desktop */
@media (min-width: 769px) {
  .ptr-indicator {
    display: none;
  }
  
  .bottom-sheet-trigger-mobile {
    display: none;
  }
}
