/* ============================================================
   TECHSPRINT ADS – PREMIUM PRODUCT CARD
   Compact (280px) | Image-focused | Centered layout
   Full image visibility | Background fill + contain
   ============================================================ */

/* ---------------- CSS Variables ---------------- */
:root {
  --ts-primary: #c62828;
  --ts-primary-dark: #8e0000;
  --ts-primary-light: #ff5f52;
  --ts-dark: #1a1a2e;
  --ts-gray: #666666;
  --ts-light: #f8f9fa;
  --ts-white: #ffffff;
  --ts-shadow: 0 4px 12px rgba(0,0,0,0.08);
  --ts-shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
  --ts-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------- Wrapper ---------------- */
.ts-ads-wrapper {
   width: 100%;
  max-width: 100% !important;
  margin: 0;
  padding: 0 2%; /* tighter edges = more premium look */
  position: relative;
  overflow: hidden;
  box-sizing: border-box;

}

/* ---------------- Viewport ---------------- */
.ts-ads-slider-viewport {
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* ---------------- Track ---------------- */
.ts-ads-slider-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* ============================================================
   PRODUCT CARD – COMPACT & PREMIUM (280px FIXED HEIGHT)
   ============================================================ */
.ts-ads-card {
  background: var(--ts-white);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 0 0 100%;
  /* FIXED COMPACT HEIGHT - stays 280px */
  height: 280px;
  max-height: 280px;
  min-height: 280px;
  position: relative;
  transition: var(--ts-transition);
  box-shadow: var(--ts-shadow);
  cursor: pointer;
}

.ts-ads-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ts-shadow-hover);
}

/* 
   IMAGE CONTAINER – DUAL LAYER (Background fill + Foreground contain)
   Takes 60% of card height (approx 168px)
*/
.ts-ads-card-image {
  height: 168px;
  max-height: 168px;
  min-height: 168px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

/* BACKGROUND LAYER - fills empty spaces (crops to cover) */
.ts-ads-card-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.15;
  transition: transform 0.4s ease;
  pointer-events: none;
}

.ts-ads-card:hover .ts-ads-card-image::before {
  transform: scale(1.05);
}

/* FOREGROUND IMAGE - shows full image (contain) */
.ts-ads-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
  transition: transform 0.4s ease;
  background: transparent;
}

.ts-ads-card:hover .ts-ads-card-image img {
  transform: scale(1.02);
}

/* 
   CARD BODY – CENTERED LAYOUT
   Title + Buttons perfectly centered
*/
.ts-ads-card-body {
  padding: 12px 16px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;  /* CENTER EVERYTHING HORIZONTALLY */
  text-align: center;
  background: var(--ts-white);
}

/* Title – centered, single line, premium typography */
.ts-ads-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 10px;  /* Single line space between title and buttons */
  line-height: 1.3;
  color: var(--ts-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  letter-spacing: -0.2px;
}

/* 
   ACTIONS – CENTERED BUTTONS, EXACTLY ONE LINE BELOW TITLE
*/
.ts-ads-card-actions {
  padding: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;  /* CENTER BUTTONS */
  margin-top: 0;
  width: 100%;
}

/* Premium compact buttons */
.ts-ads-view-more-btn,
.ts-ads-cta-btn {
  font-size: 0.7rem;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ts-transition);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

/* View More - outlined style */
.ts-ads-view-more-btn {
  background: transparent;
  color: var(--ts-dark);
  border: 1.5px solid rgba(26, 26, 46, 0.15);
}

.ts-ads-view-more-btn:hover {
  background: var(--ts-dark);
  color: var(--ts-white);
  border-color: var(--ts-dark);
  transform: translateY(-2px);
}

/* CTA Button - solid primary */
.ts-ads-cta-btn {
  background: var(--ts-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(198, 40, 40, 0.2);
}

.ts-ads-cta-btn:hover {
  background: var(--ts-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(198, 40, 40, 0.3);
}

.ts-ads-view-more-btn:active,
.ts-ads-cta-btn:active {
  transform: translateY(0);
}

/* Optional: Add a subtle price tag or badge */
.ts-ads-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--ts-primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  z-index: 5;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ============================================================
   DESKTOP – 3 COLUMNS (COMPACT & TIGHT)
   ============================================================ */
@media (min-width: 1024px) {
  .ts-ads-slider-track {
    gap: 20px; /* slightly more breathing space */
  }

  .ts-ads-card {
    flex: 0 0 calc(25% - 15px); /* 4 cards */
    height: 340px; /* BIGGER */
    max-height: 340px;
    min-height: 340px;
  }

  .ts-ads-card-image {
    height: 200px; /* scale image */
  }

  .ts-ads-card-title {
    font-size: 1rem;
  }
}

/* ============================================================
   TABLET – 2 COLUMNS (COMPACT)
   ============================================================ */
@media (min-width: 640px) and (max-width: 1023px) {
  .ts-ads-card {
   flex: 0 0 calc(50% - 10px); /* 2 cards */
    height: 320px;
    max-height: 280px;
    min-height: 280px;
  }
  
  .ts-ads-card-image {
    height: 190px;
    max-height: 190px;
    min-height: 190px;
  }
  
  .ts-ads-card-title {
    font-size: 0.85rem;
    margin-bottom: 9px;
  }
  
  .ts-ads-card-body {
    padding: 11px 14px 13px;
  }
  
  .ts-ads-view-more-btn,
  .ts-ads-cta-btn {
    padding: 5px 12px;
    font-size: 0.68rem;
  }
}
/* ============================================================
   MOBILE – HORIZONTAL SLIDER (PREMIUM)
   ============================================================ */
@media (max-width: 639px) {

  /* Keep cards in a row (NOT column) */
  .ts-ads-slider-track {
    display: flex;
    flex-direction: row;
    gap: 14px;
    padding-left: 4%;
    padding-right: 4%;
  }

  /* Enable smooth horizontal scroll */
  .ts-ads-slider-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  /* Each card takes most of the screen with a "peek" */
  .ts-ads-card {
    flex: 0 0 85%;
    height: 300px;
    max-height: 300px;
    min-height: 300px;
    scroll-snap-align: start;
     border-radius: 18px;
  }

  /* Bigger image for better visual impact */
  .ts-ads-card-image {
    height: 180px;
    max-height: 180px;
    min-height: 180px;
  }

  /* Improve readability */
  .ts-ads-card-title {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .ts-ads-card-body {
    padding: 12px 14px 14px;
  }

  /* Buttons slightly bigger for touch */
  .ts-ads-view-more-btn,
  .ts-ads-cta-btn {
    padding: 6px 14px;
    font-size: 0.75rem;
  }

  .ts-ads-card-actions {
    gap: 10px;
  }

  /* Hide scrollbar (clean look) */
  .ts-ads-slider-viewport::-webkit-scrollbar {
    display: none;
  }

  .ts-ads-slider-viewport {
    scrollbar-width: none;
  }
}

/* Extra small devices – maintain proportions */
@media (max-width: 480px) {
  .ts-ads-card {
    height: 270px;
    max-height: 270px;
    min-height: 270px;
    
  }
  
  .ts-ads-card-image {
    height: 162px;
    max-height: 162px;
    min-height: 162px;
  }
  
  .ts-ads-card-body {
    padding: 10px 12px 12px;
  }
  
  .ts-ads-card-title {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }
  
  .ts-ads-view-more-btn,
  .ts-ads-cta-btn {
    padding: 4px 10px;
    font-size: 0.65rem;
  }
  
  .ts-ads-card-actions {
    gap: 8px;
  }
}

/* ============================================================
   MODAL – CLEAN PRODUCT VIEW
   ============================================================ */
.ts-ads-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.ts-ads-modal.active {
  display: flex;
  animation: modalFadeIn 0.25s ease;
}

.ts-ads-modal-inner {
  background: var(--ts-white);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ts-ads-modal-inner img {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  background: #f5f5f5;
}

.ts-ads-modal-body {
  padding: 24px;
  overflow-y: auto;
  text-align: center;
}

.ts-ads-modal-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ts-dark);
}

.ts-ads-modal-body p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ts-gray);
  margin-bottom: 20px;
}

.ts-ads-modal-body .ts-ads-cta-btn {
  font-size: 0.85rem;
  padding: 8px 20px;
}

.ts-ads-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border: none;
  color: white;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  z-index: 10;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ts-transition);
}

.ts-ads-modal-close:hover {
  background: var(--ts-primary);
  transform: scale(1.08);
}

/* ============================================================
   UTILITIES & ACCESSIBILITY
   ============================================================ */
.ts-ads-wrapper *,
.ts-ads-wrapper *::before,
.ts-ads-wrapper *::after {
  box-sizing: border-box;
}

/* Card entrance animation – subtle staggered */
.ts-ads-card {
  opacity: 0;
  transform: translateY(10px);
  animation: cardEntrance 0.4s ease forwards;
}

@keyframes cardEntrance {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ts-ads-card:nth-child(1) { animation-delay: 0.05s; }
.ts-ads-card:nth-child(2) { animation-delay: 0.1s; }
.ts-ads-card:nth-child(3) { animation-delay: 0.15s; }
.ts-ads-card:nth-child(4) { animation-delay: 0.2s; }
.ts-ads-card:nth-child(5) { animation-delay: 0.25s; }
.ts-ads-card:nth-child(6) { animation-delay: 0.3s; }

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .ts-ads-slider-track,
  .ts-ads-card,
  .ts-ads-card-image img,
  .ts-ads-view-more-btn,
  .ts-ads-cta-btn,
  .ts-ads-modal-inner {
    transition: none;
    animation: none;
  }
  
  .ts-ads-card:hover {
    transform: none;
  }
}

/* Hide scrollbar but keep functionality (clean look) */
.ts-ads-slider-viewport {
  scrollbar-width: thin;
  scrollbar-color: var(--ts-primary) #e0e0e0;
}

.ts-ads-slider-viewport::-webkit-scrollbar {
  width: 4px;
}

.ts-ads-slider-viewport::-webkit-scrollbar-track {
  background: #e0e0e0;
  border-radius: 4px;
}

.ts-ads-slider-viewport::-webkit-scrollbar-thumb {
  background: var(--ts-primary);
  border-radius: 4px;
}