/* ============================================
   🔥 TINDER-STYLE RECIPE SWIPER
   Addictive swipe-based recipe discovery
   ============================================ */

/* ============================================
   SWIPER CONTAINER
   ============================================ */

.recipe-swiper-container {
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 5rem; /* Account for bottom nav */
  background: #f5f5f5;
  overflow: hidden;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.recipe-swiper-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* ============================================
   RECIPE CARD STACK
   ============================================ */

.swipe-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.swipe-card:active {
  cursor: grabbing;
}

/* Stack effect - cards behind current */
.swipe-card:nth-child(2) {
  transform: scale(0.95) translateY(10px);
  opacity: 0.9;
  z-index: 2;
}

.swipe-card:nth-child(3) {
  transform: scale(0.9) translateY(20px);
  opacity: 0.8;
  z-index: 1;
}

.swipe-card:nth-child(n + 4) {
  transform: scale(0.85) translateY(30px);
  opacity: 0;
  pointer-events: none;
}

.swipe-card.current {
  z-index: 3;
}

/* Swiping states */
.swipe-card.swiping-right {
  transform: translateX(20px) rotate(5deg);
}

.swipe-card.swiping-left {
  transform: translateX(-20px) rotate(-5deg);
}

.swipe-card.swiping-up {
  transform: translateY(-20px);
}

/* Swipe out animations */
.swipe-card.swipe-right {
  animation: swipeRight 0.4s ease-out forwards;
}

.swipe-card.swipe-left {
  animation: swipeLeft 0.4s ease-out forwards;
}

.swipe-card.swipe-up {
  animation: swipeUp 0.5s ease-out forwards;
}

@keyframes swipeRight {
  to {
    transform: translateX(150%) rotate(30deg);
    opacity: 0;
  }
}

@keyframes swipeLeft {
  to {
    transform: translateX(-150%) rotate(-30deg);
    opacity: 0;
  }
}

@keyframes swipeUp {
  to {
    transform: translateY(-150%) scale(1.1);
    opacity: 0;
  }
}

/* ============================================
   CARD CONTENT
   ============================================ */

.swipe-card-image {
  width: 100%;
  height: 65%;
  object-fit: cover;
  position: relative;
}

/* Gradient overlay for better text contrast */
.swipe-card-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
}

.swipe-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  color: white;
  z-index: 10;
}

.swipe-card-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.swipe-card-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.swipe-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.swipe-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swipe-card-tag {
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ============================================
   SWIPE INDICATORS
   ============================================ */

.swipe-indicator {
  position: absolute;
  top: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 100;
  border: 4px solid;
}

.swipe-indicator.like {
  right: 2rem;
  color: #00c853;
  border-color: #00c853;
  background: rgba(0, 200, 83, 0.1);
  transform: rotate(20deg);
}

.swipe-indicator.nope {
  left: 2rem;
  color: #ff3d00;
  border-color: #ff3d00;
  background: rgba(255, 61, 0, 0.1);
  transform: rotate(-20deg);
}

.swipe-indicator.superlike {
  left: 50%;
  transform: translateX(-50%);
  top: 1rem;
  color: #00b0ff;
  border-color: #00b0ff;
  background: rgba(0, 176, 255, 0.1);
}

.swipe-card.swiping-right .swipe-indicator.like,
.swipe-card.swipe-right .swipe-indicator.like {
  opacity: 1;
}

.swipe-card.swiping-left .swipe-indicator.nope,
.swipe-card.swipe-left .swipe-indicator.nope {
  opacity: 1;
}

.swipe-card.swiping-up .swipe-indicator.superlike,
.swipe-card.swipe-up .swipe-indicator.superlike {
  opacity: 1;
}

/* ============================================
   ACTION BUTTONS (Tinder-style)
   ============================================ */

.swiper-actions {
  position: fixed;
  bottom: calc(5rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.25rem;
  z-index: 1000;
  padding: 1rem;
}

.swiper-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.swiper-btn:active {
  transform: scale(0.9);
}

.swiper-btn-large {
  width: 68px;
  height: 68px;
  font-size: 2rem;
}

/* Button colors */
.swiper-btn-undo {
  color: #ffb300;
}

.swiper-btn-nope {
  color: #ff3d00;
}

.swiper-btn-like {
  color: #00c853;
}

.swiper-btn-superlike {
  color: #00b0ff;
  background: linear-gradient(135deg, #008744 0%, #006b3c 100%);
  color: white;
}

.swiper-btn-boost {
  color: #9c27b0;
}

/* Ripple effect on tap */
.swiper-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  transform: scale(0);
  transition: all 0.4s ease;
}

.swiper-btn:active::after {
  opacity: 0.2;
  transform: scale(1);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.swiper-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.swiper-empty.visible {
  opacity: 1;
  pointer-events: all;
}

.swiper-empty-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

.swiper-empty-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.swiper-empty-text {
  font-size: 1rem;
  color: #757575;
  margin-bottom: 1.5rem;
}

.swiper-empty-btn {
  background: linear-gradient(135deg, #2d5016 0%, #3d6e1f 100%);
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 24px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.swiper-empty-btn:active {
  transform: scale(0.95);
}

/* ============================================
   MATCH ANIMATION (When you save a recipe)
   ============================================ */

.match-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.match-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.match-content {
  text-align: center;
  color: white;
  padding: 2rem;
  animation: matchPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes matchPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.match-icon {
  font-size: 6rem;
  margin-bottom: 1rem;
  animation: heartBeat 1s infinite;
}

@keyframes heartBeat {
  0%,
  100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.1);
  }
  50% {
    transform: scale(1);
  }
}

.match-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #00c853 0%, #76ff03 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.match-text {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.match-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.match-btn {
  padding: 0.875rem 2rem;
  border-radius: 24px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.match-btn-primary {
  background: linear-gradient(135deg, #00c853 0%, #76ff03 100%);
  color: #000;
}

.match-btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.match-btn:active {
  transform: scale(0.95);
}

/* ============================================
   PROGRESS INDICATOR
   ============================================ */

.swiper-progress {
  position: fixed;
  top: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 900;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2d5016;
}

.swiper-progress-bar {
  width: 100px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.swiper-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2d5016 0%, #3d6e1f 100%);
  transition: width 0.3s ease;
}

/* ============================================
   RECIPE DETAILS PANEL
   ============================================ */

.swipe-details-btn {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 20;
  transition: all 0.2s ease;
}

.swipe-details-btn:active {
  transform: scale(0.9);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (min-width: 768px) {
  .recipe-swiper-wrapper {
    max-width: 450px;
  }

  .swiper-actions {
    gap: 2rem;
  }

  .swiper-btn {
    width: 64px;
    height: 64px;
    font-size: 2rem;
  }

  .swiper-btn-large {
    width: 76px;
    height: 76px;
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .recipe-swiper-container {
    top: 0;
    bottom: 0;
  }

  .recipe-swiper-wrapper {
    max-width: 500px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .swipe-card,
  .swiper-btn,
  .match-content {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keyboard navigation hint */
.keyboard-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10001;
}

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

.keyboard-hint-text {
  margin-bottom: 0.5rem;
}

.keyboard-hint-keys {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.keyboard-key {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
}

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

@media (prefers-color-scheme: dark) {
  .recipe-swiper-container {
    background: #121212;
  }

  .swipe-card {
    background: #1e1e1e;
  }

  .swiper-btn {
    background: #2d2d2d;
  }

  .swiper-progress {
    background: rgba(45, 45, 45, 0.9);
    color: #e0e0e0;
  }

  .swiper-progress-bar {
    background: #424242;
  }
}
