/* ==========================================================================
   cards.css – Unified SmartMobile Card & Front-Page Visuals
   Derived from homepage.css + original cards.css
   ========================================================================== */

/* ---------- Global Container ---------- */
.smartmobile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  justify-content: center;
  align-items: stretch; /* Changed to stretch for equal height */
  width: 100%;
  box-sizing: border-box;
  padding: 0 6px;
}

/* ---------- SmartMobile Card - FIXED IDENTICAL SIZES ---------- */
.smartmobile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  background: #F2F8ED;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  transition: transform .18s ease, box-shadow .18s ease;
  width: 100%;
  max-width: 260px;
  box-sizing: border-box;
  margin: 0 auto;
  min-height: 280px; /* consistent height */
  height: 100%; /* Ensure all cards take full grid height */
  position: relative; /* For absolute positioning if needed */
}

.smartmobile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}

/* ---------- Image Container - FIXED SIZE ---------- */
.smartmobile-card .image-container {
  width: 160px;
  height: 212px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  flex-shrink: 0; /* Prevent container from shrinking */
}

.smartmobile-card img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}

/* ---------- Text & Price - REDUCED SPACING ---------- */
.smartmobile-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2; /* Reduced from 1.25 */
  color: #004D61;
  text-align: center;
  margin: 2px 0 0; /* Reduced bottom margin */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.4em; /* Slightly reduced */
  max-height: 1.4em; /* Slightly reduced */
  flex-shrink: 0;
}

.smartmobile-price {
  font-size: 1.1rem;
  font-weight: 600;
  color: #38761d;
  margin: 0; /* Remove all margins */
  text-align: center;
  min-height: 1.3em; /* Slightly reduced */
  max-height: 1.3em; /* Slightly reduced */
  flex-shrink: 0;
}

/* ---------- Content Wrapper for Consistent Spacing ---------- */
.smartmobile-card .card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex-grow: 1; /* Take remaining space */
  width: 100%;
  padding: 0 5px;
}

/* ---------- Pagination ---------- */
.smartmobile-pagination {
  margin: 22px 0 6px;
  text-align: center;
}

.smartmobile-pagination .page-numbers {
  display: inline-block;
  margin: 0 5px;
  padding: 6px 11px;
  border-radius: 6px;
  background: #2a2a2a;
  color: #fff;
  text-decoration: none;
}

/* ---------- Section Headings ---------- */
.section-heading {
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  display: block;
  margin: 0 auto 24px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  width: fit-content;
}
.green-heading { background: #1BAE77; }
.blue-heading { background: #004080; }

/* ---------- Slider / Flyer ---------- */
.mobile-store-slider-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 10px;
  box-sizing: border-box;
}
.slider-container {
  position: relative;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 1;
  background: #f5f5f5 url('../images/loader.gif') no-repeat center;
}
.slider {
  display: flex;
  transition: transform .6s ease-in-out;
  width: 100%;
  height: 100%;
}
.slide {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}
.slide img.fslider-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 3/1;
}
.progress-container {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  gap: 8px;
}
.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: background .3s ease;
}
.progress-dot.active {
  background: #1BAE77;
}

/* ---------- Related Items Specific Styles ---------- */
.related-price-range .section-heading {
    margin-top: 30px;
}

/* Related items grid - ensure consistent sizing */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.related-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #F2F8ED;
  border-radius: 8px;
  padding: 10px;
  min-height: 220px;
  height: 100%;
}

.related-item .sm-related-thumb {
  width: 100px;
  height: 160px;
  object-fit: contain;
  margin: 0 auto 6px;
}

.related-item .related-title {
  font-size: 0.9rem;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.2em;
}

.related-item .related-price {
  font-weight: bold;
  color: #28a745;
  font-size: 0.9rem;
  min-height: 1.3em;
}

/* ---------- Responsive Tweaks ---------- */
@media (max-width: 1200px) {
  .smartmobile-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 992px) {
  .smartmobile-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
  
  .smartmobile-card .image-container {
    width: 110px;
    height: 180px;
  }
}

@media (max-width: 768px) {
  .smartmobile-card {
    max-width: 100%;
    min-height: 250px;
  }
  
  .smartmobile-card .image-container {
    width: 100px;
    height: 160px;
  }
  
  .smartmobile-title {
    font-size: 1rem;
    min-height: 2.2em;
  }
  
  .smartmobile-price {
    font-size: 1rem;
  }
  
  .section-heading {
    font-size: 1.6rem;
    padding: 10px 20px;
  }
}

@media (max-width: 680px) {
  .smartmobile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .smartmobile-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .smartmobile-card {
    max-width: 280px;
    min-height: 240px;
  }
  
  .smartmobile-card .image-container {
    width: 110px;
    height: 170px;
  }
  
  .section-heading {
    font-size: 1.4rem;
    padding: 8px 16px;
    margin-bottom: 16px;
  }
  
  .slider-container { 
    aspect-ratio: 4 / 3; 
  }
}

/* ---------- Fallback for older browsers ---------- */
@supports not (display: grid) {
  .smartmobile-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .smartmobile-card {
    width: 200px;
    margin: 7px;
  }
}
/* ---------- Price Alerts ---------- */
.price-alert.increased {
    color: #0870D1;
    animation: pulseUp 1.2s infinite alternate;
}
.price-alert.decreased {
    color: #e60000;
    animation: pulseDown 1.2s infinite alternate;
}

@keyframes pulseUp {
    from { transform: translateY(0); opacity: 0.9; }
    to { transform: translateY(-3px); opacity: 1; }
}
@keyframes pulseDown {
    from { transform: translateY(0); opacity: 0.9; }
    to { transform: translateY(3px); opacity: 1; }
}
