/*
FLUTTER-STYLE RECOMMENDED PLANS - 100% MATCH
Exactly like Flutter app screenshot with metrics table
*/

/* ===== RECOMMENDED PLANS SECTION - FLUTTER STYLE ===== */
.recommended-section {
  padding: 16px 16px 8px 16px;
  background: #ffffff;
  position: relative;
  /* Allow normal scroll on mobile */
  touch-action: auto;
  overflow: visible;
  /* Isolate layout to prevent affecting other sections */
  contain: layout;
  will-change: auto;
  /* Remove fixed height to allow natural content flow */
}

/* Ensure offers section is completely isolated from recommended section changes */
.recommended-section+.offers-section {
  position: relative;
  contain: layout style;
  will-change: auto;
  /* Create a new stacking context to isolate from layout changes above */
  transform: translateZ(0);
  /* Additional isolation techniques */
  isolation: isolate;
  /* Reduce space between sections - Made even smaller */
  margin-top: -8px !important;
  padding-top: 4px !important;
}

/* Extra isolation for mobile devices */
@media (max-width: 768px) {
  .recommended-section+.offers-section {
    /* Stronger isolation on mobile */
    position: relative;
    top: 0;
    left: 0;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    /* Force GPU acceleration for stability */
    will-change: transform;
  }
}

/* Responsive Section Padding */
@media (max-width: 768px) {
  .recommended-section {
    padding: 12px 16px !important;
    /* Enhanced mobile scroll prevention */
    touch-action: pan-y pinch-zoom;
    overflow: hidden;
    position: relative;
    z-index: 10;
  }

  .recommended-plans-container {
    /* Stronger mobile scroll prevention */
    touch-action: pan-x pinch-zoom;
    overflow-y: hidden;
    position: relative;
    z-index: 11;
  }

  .plan-card {
    /* Mobile-specific touch handling */
    touch-action: pan-x pinch-zoom;
    overflow: hidden;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .recommended-section {
    padding: 16px 20px !important;
  }
}

@media (min-width: 1025px) {
  .recommended-section {
    padding: 20px 24px !important;
  }
}

.recommended-section h2 {
  color: #333333;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.recommended-plans-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 16px 8px 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  width: calc(100% - 12px);
  max-width: calc(100% - 12px);
  margin-right: 12px;
  box-sizing: border-box;
  /* Prevent vertical scroll during horizontal swipe */
  touch-action: pan-x pinch-zoom;
  position: relative;
  z-index: 5;
  /* Allow natural content height */
  contain: layout style;
}

.recommended-plans-container::-webkit-scrollbar {
  display: none;
}

/* Flutter-style horizontal scroll for multiple plans */
.plans-horizontal-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}

.plans-horizontal-scroll::-webkit-scrollbar {
  display: none;
}

.plans-horizontal-scroll .plan-card {
  flex-shrink: 0;
  min-width: 300px;
}

/* Responsive Plan Card Sizing - Fit to Screen */
@media (max-width: 768px) {
  .plan-card {
    width: calc(100vw - 48px) !important;
    max-width: calc(100vw - 48px) !important;
    min-width: calc(100vw - 48px) !important;
  }

  .recommended-plans-container {
    padding: 8px 16px 8px 12px;
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    margin-right: 16px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .plan-card {
    width: calc(100% - 48px) !important;
    max-width: calc(100% - 48px) !important;
    min-width: calc(100% - 48px) !important;
  }

  .recommended-plans-container {
    padding: 8px 24px;
    justify-content: flex-start;
    width: calc(100% - 48px);
    max-width: calc(100% - 48px);
  }
}

@media (min-width: 1025px) and (max-width: 1440px) {
  .plan-card {
    width: calc(100% - 64px) !important;
    max-width: calc(100% - 64px) !important;
    min-width: calc(100% - 64px) !important;
  }

  .recommended-plans-container {
    padding: 8px 32px;
    justify-content: flex-start;
    width: calc(100% - 64px);
    max-width: calc(100% - 64px);
  }
}

@media (min-width: 1441px) {
  .plan-card {
    width: calc(100% - 80px) !important;
    max-width: calc(100% - 80px) !important;
    min-width: calc(100% - 80px) !important;
  }

  .recommended-plans-container {
    padding: 8px 40px;
    justify-content: flex-start;
    width: calc(100% - 80px);
    max-width: calc(100% - 80px);
  }
}

/* Flutter-Style Plan Card - Perfect Fit Design with Smooth Transitions */
.plan-card {
  background: #ffffff;
  border: 1px solid #e5e5e7;
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  position: relative;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 1;
  transform: translateX(0) scale(1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  box-sizing: border-box;
  flex: 0 0 auto;
  /* Prevent scroll conflicts during swipe */
  touch-action: pan-x pinch-zoom;
  /* Prevent layout shifts */
  contain: layout style;
  will-change: opacity, transform;
}

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

.plan-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(114, 30, 44, 0.2);
}

.plan-card:active {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Provider header exactly like Flutter */
.plan-provider {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.plan-provider-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  margin-right: 10px;
  background: var(--provider-color, #11d83e);
  overflow: hidden;
  flex-shrink: 0;
}

/* Provider Logo Image in Recommended Plans */
.plan-provider-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.plan-provider-logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  border-radius: 8px;
}

.plan-provider-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.plan-provider-name {
  font-size: 16px;
  font-weight: 600;
  color: #333333;
}

/* Metrics table exactly like Flutter screenshot */
.plan-metrics {
  margin-bottom: 16px;
}

.plan-metrics-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e5e5e7;
  border-radius: 10px;
  overflow: hidden;
}

.plan-metrics-table th,
.plan-metrics-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e5e7;
  font-size: 13px;
  line-height: 1.3;
}

.plan-metrics-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #666666;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-metrics-table td {
  font-weight: 500;
  color: #333333;
}

.plan-metrics-table tr:last-child th,
.plan-metrics-table tr:last-child td {
  border-bottom: none;
}

/* Alternating row colors like Flutter */
.plan-metrics-table tr:nth-child(even) {
  background: #fafbfc;
}

/* Buy Now button styles removed - now uses unified component */
.plan-buy-button-container {
  margin-top: 12px;
  position: relative;
  z-index: 10;
  /* Ensure buy button is above other elements */
}

/* Ensure buy button is clickable and not affected by swipe gestures */
.plan-buy-button-container .unified-buy-now {
  pointer-events: auto !important;
  position: relative;
  z-index: 11;
}

/* Price styling */
.plan-price {
  font-size: 20px;
  font-weight: 700;
  color: #333333;
  margin-bottom: 4px;
}

/* Professional Slider Dots - Enhanced */
.pagination-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 4px 16px;
}

.pagination-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d1d1d6;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination-dot.active {
  background: #007aff;
  transform: scale(1.3);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.pagination-dot:hover {
  background: #a1a1a6;
  transform: scale(1.1);
}

.pagination-dot.active:hover {
  background: #0051d0;
  transform: scale(1.3);
}

/* Swipe Indicator Animation */
@keyframes swipeHint {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(8px);
  }
}

.recommended-section::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 16px;
  width: 6px;
  height: 20px;
  background: linear-gradient(to bottom, transparent, #007aff, transparent);
  border-radius: 3px;
  opacity: 0.3;
  animation: swipeHint 2s infinite;
  pointer-events: none;
  z-index: 1;
}

/* Hide swipe hint when only one plan */
.recommended-section.single-plan::before {
  display: none;
}

.plan-price-currency {
  font-size: 16px;
  color: #666666;
}

/* Loading state */
.plan-card-shimmer {
  min-width: 300px;
  height: 280px;
  border-radius: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Shimmer animation moved to shared/shimmer.css */

/* Error state */
.recommended-error {
  text-align: center;
  padding: 40px 20px;
  color: #ff3b30;
}

.recommended-error-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.recommended-retry-button {
  margin-top: 16px;
  padding: 12px 24px;
  background: #007aff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* REMOVED - Dark mode now centralized in internet.css */

/* Perfect Fit Responsive Design - Like Offers Cards */
@media (min-width: 769px) and (orientation: landscape) {
  .plan-card {
    width: calc(50vw - 24px);
    max-width: 400px;
    min-width: 320px;
    padding: 18px;
  }

  .recommended-plans-container {
    padding: 8px 20px 8px 20px;
    margin-right: 16px;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .recommended-plans-container {
    padding: 8px 18px 8px 14px;
    width: calc(100% - 14px);
    max-width: calc(100% - 14px);
    margin-right: 14px;
    gap: 12px;
  }

  .plan-card {
    width: calc(100vw - 50px);
    max-width: calc(100vw - 50px);
    min-width: calc(100vw - 50px);
    padding: 14px;
  }

  .plan-metrics-table th,
  .plan-metrics-table td {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Old buy button styles removed - now uses unified component */
}

@media (max-width: 480px) {
  .recommended-plans-container {
    padding: 8px 16px 8px 12px;
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    margin-right: 16px;
    gap: 8px;
  }

  .plan-card {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    min-width: calc(100vw - 40px);
    padding: 12px;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .plan-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(114, 30, 44, 0.15);
  }

  .plan-card:active {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  }

  .plan-metrics-table th,
  .plan-metrics-table td {
    padding: 6px 8px;
    font-size: 11px;
  }

  .plan-provider-logo {
    width: 24px;
    height: 24px;
    font-size: 12px;
    margin-right: 8px;
    transition: all 0.3s ease;
  }

  .plan-card:hover .plan-provider-logo {
    transform: scale(1.1);
    filter: brightness(1.1);
  }

  .plan-metrics-table {
    transition: all 0.3s ease;
  }

  .plan-card:hover .plan-metrics-table {
    background: rgba(114, 30, 44, 0.02);
  }

  /* Old buy button styles removed - now uses unified component */
}


/* Shimmer Loading Effects */
.plan-shimmer {
  pointer-events: none;
}

.plan-provider-shimmer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.plan-provider-logo-shimmer {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.plan-provider-name-shimmer {
  width: 80px;
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.plan-metrics-table-shimmer {
  width: 100%;
  margin-bottom: 16px;
}

.shimmer-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.shimmer-cell {
  flex: 1;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.plan-buy-button-shimmer {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

/* Shimmer animation moved to shared/shimmer.css */

/* Dark mode shimmer */
@media (prefers-color-scheme: dark) {

  .plan-provider-logo-shimmer,
  .plan-provider-name-shimmer,
  .shimmer-cell,
  .plan-buy-button-shimmer {
    background: linear-gradient(90deg, #2c2c2e 25%, #3a3a3c 50%, #2c2c2e 75%) !important;
    background-size: 200% 100%;
  }
}
