/*
 * Mobile-First Enhancements for GoTrip Theme
 * Focus on touch interactions, gestures, and mobile UX
 */

/* ===== SYSTEM FONT OVERRIDE ===== */
/* Force all tour card elements to use system font settings from admin style page */
.tour-card-luxury, .tour-card-luxury *,
.tour-card-mobile, .tour-card-mobile *,
.tourCard, .tourCard * {
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

/* ===== MOBILE NAVIGATION ===== */

/* Hamburger Menu with Animation */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-fixed);
  background: var(--luxury-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: all var(--transition-normal);
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  margin: 3px 0;
  transition: all var(--transition-fast);
}

.mobile-menu-toggle.is-active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.is-active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: -100%;
  width: 80vw;
  max-width: 320px;
  height: 100vh;
  background: white;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  transition: left var(--transition-normal);
  overflow-y: auto;
}

.mobile-nav-drawer.is-active {
  left: 0;
}

.mobile-nav-drawer__header {
  padding: var(--space-6);
  background: var(--luxury-cream);
  border-bottom: 1px solid var(--luxury-silver-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-nav-drawer__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--luxury-charcoal);
  padding: var(--space-2);
  min-width: 44px;
  min-height: 44px;
}

/* ===== TOUCH-FRIENDLY COMPONENTS ===== */

/* Enhanced Tour Cards for Mobile */
.tour-card-mobile {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all var(--transition-normal);
  margin-bottom: var(--space-4);
  position: relative;
}

.tour-card-mobile__image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.tour-card-mobile__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.tour-card-mobile__content {
  padding: var(--space-5);
}

.tour-card-mobile__title {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: var(--luxury-charcoal);
  margin-bottom: var(--space-2);
}

.tour-card-mobile__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tour-card-mobile__price {
  font-size: inherit;
  font-weight: inherit;
  color: var(--luxury-primary);
}

.tour-card-mobile__duration {
  font-size: inherit;
  font-weight: inherit;
  color: var(--luxury-charcoal-light);
}

.tour-card-mobile__action {
  width: 100%;
  padding: var(--space-4);
}

/* Touch-Optimized Buttons */
.btn-mobile {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  font-size: 1rem;
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-height: 48px; /* Apple HIG recommended */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-mobile:active {
  transform: scale(0.98);
  transition-duration: var(--transition-fast);
}

/* Swipe Indicators */
.swipe-indicator {
  position: absolute;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.swipe-indicator span {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--luxury-silver);
}

.tour-card-mobile:hover .swipe-indicator {
  opacity: 1;
}

/* ===== MOBILE SEARCH ===== */

.mobile-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.mobile-search-overlay.is-active {
  display: flex;
}

.mobile-search-container {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  padding: var(--space-6);
}

.mobile-search-input {
  width: 100%;
  padding: var(--space-4);
  border: 2px solid var(--luxury-silver-light);
  border-radius: var(--radius-md);
  font-size: 1rem;
  min-height: 48px;
  margin-bottom: var(--space-4);
}

/* ===== GESTURE SUPPORT ===== */

/* Horizontal Scroll Snap */
.mobile-scroll-snap {
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.mobile-scroll-snap__item {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* Pull-to-Refresh */
.pull-to-refresh {
  position: relative;
  padding-top: 60px; /* Space for refresh indicator */
  min-height: 200px;
}

.pull-to-refresh__indicator {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--luxury-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-normal);
}

.pull-to-refresh.is-pulling .pull-to-refresh__indicator {
  opacity: 1;
  transform: translateX(-50%) rotate(180deg);
}

/* ===== MOBILE FILTERS ===== */

.mobile-filter-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  z-index: var(--z-modal);
  max-height: 70vh;
  overflow-y: auto;
}

.mobile-filter-sheet.is-active {
  transform: translateY(0);
}

.mobile-filter-sheet__handle {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--luxury-silver);
  border-radius: var(--radius-full);
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */

@media (max-width: 480px) {
  .tour-card-mobile__title {
    font-size: inherit;
    line-height: inherit;
  }
  
  .tour-card-mobile__price {
    font-size: inherit;
  }
  
  .mobile-search-container {
    width: 95%;
  }
}

@media (max-width: 360px) {
  .tour-card-mobile__title {
    font-size: inherit;
  }
  
  .mobile-search-container {
    width: 100%;
    padding: var(--space-4);
  }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
  .mobile-nav-drawer {
    background: var(--luxury-charcoal);
    color: white;
  }
  
  .mobile-search-container {
    background: var(--luxury-charcoal);
    color: white;
  }
  
  .mobile-filter-sheet {
    background: var(--luxury-charcoal);
    color: white;
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Management */
.mobile-focus-ring {
  position: relative;
}

.mobile-focus-ring::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid var(--luxury-primary);
  border-radius: var(--radius-md);
  pointer-events: none;
}

.btn-mobile:focus,
.mobile-search-input:focus {
  outline: none;
}

.btn-mobile:focus .mobile-focus-ring::after,
.mobile-search-input:focus .mobile-focus-ring::after {
  opacity: 1;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Reduce Motion on Mobile */
@media (max-width: 768px) {
  .tour-card-mobile,
  .btn-mobile,
  .mobile-nav-drawer {
    transition-duration: var(--transition-fast);
  }
}

/* Optimize Images */
.mobile-optimized-image {
  content-visibility: auto;
  contain: layout style paint;
}

/* ===== UTILITY CLASSES ===== */

.mobile-text-center {
  text-align: center;
}

.mobile-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-space-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.mobile-hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.mobile-hide-scrollbar::-moz-scrollbar {
  display: none;
}

/* ===== 2-COLUMN TOUR & HOTEL CARDS ON MOBILE ===== */
@media (max-width: 575px) {
  /* Tighter card padding so content fits in half-width columns */
  .tourCard__content,
  .hotelsCard__content {
    padding: 8px !important;
  }

  /* Smaller title text */
  .tourCard__title,
  .hotelsCard__title {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  /* Smaller meta text (duration, location, price) */
  .tourCard__content .text-14,
  .tourCard__content .text-13,
  .tourCard__content .text-16,
  .hotelsCard__content .text-14,
  .hotelsCard__content .text-13,
  .hotelsCard__content .text-16 {
    font-size: 11px !important;
  }

  /* Hide the View button on mobile — title is already a link */
  .tourCard__content .button.-sm,
  .hotelsCard__content .button.-sm {
    display: none !important;
  }

  /* Tighter row gap between cards */
  .row.y-gap-20,
  .row.y-gap-30 {
    --y-gap: 12px;
  }
}

/* ===== REDUCED CARD HEIGHT ON MOBILE (2-col layout) ===== */
@media (max-width: 575px) {
  /* Shrink image from 1:1 (100%) to ~16:9 (56%) */
  .tourCard .cardImage.ratio::before,
  .hotelsCard .cardImage.ratio::before {
    padding-bottom: 65% !important;
  }

  /* Tighter content spacing */
  .tourCard__content,
  .hotelsCard__content {
    padding: 6px 8px 8px !important;
  }

  /* Remove top margin on title */
  .tourCard__title,
  .hotelsCard__title {
    margin-top: 2px !important;
  }

  /* Collapse the divider margin */
  .tourCard__content .border-top-light,
  .hotelsCard__content .border-top-light {
    margin-top: 6px !important;
  }

  /* Tighter price row */
  .tourCard__content .border-top-light + div,
  .hotelsCard__content .border-top-light + div {
    padding-top: 6px !important;
  }

  /* Hide location line to save vertical space */
  .tourCard__content .icon-pin,
  .tourCard__content .icon-pin + * ,
  .hotelsCard__content .icon-pin,
  .hotelsCard__content .icon-pin + * {
    display: none !important;
  }

  /* Hide the duration/rating row — keep only title + price */
  .tourCard__content > .d-flex.justify-between.mb-5,
  .hotelsCard__content > .d-flex.justify-between.mb-5 {
    display: none !important;
  }
}
