/* ===============================================
   MOTORS ADDON - FIXED STYLES v1.4
   Fixes: Added position relative to image container
   Added error message styles
   Improved responsive design
   =============================================== */

/* 4 Column Grid */
.mh-grid-wrap {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 28px !important;
  padding: 0;
  margin: 0;
}

/* Card Base */
.mh-listing-card.motors-style {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e6e6e6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.mh-listing-card.motors-style:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* IMAGE CONTAINER - FIXED: Added position relative */
.mh-card-img {
  position: relative; /* CRITICAL FIX - needed for absolute positioning of gallery badge */
  width: 100%;
  overflow: hidden;
  background: #f5f5f5;
  display: block;
}

.mh-card-img img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.mh-listing-card.motors-style:hover .mh-card-img img {
  transform: scale(1.05);
}

/* GALLERY BADGE */
.mh-gallery-count {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mh-gallery-count i {
  font-size: 16px;
}

/* CARD BODY */
.mh-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* TITLE AREA */
.mh-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 15px 8px;
  gap: 10px;
}

.mh-title-text {
  font-size: 17px;
  font-weight: 700;
  color: #222;
  margin: 0;
  line-height: 1.3;
  flex: 1;
}

/* PRICE */
.mh-price-badge {
  background: #d6281c;
  padding: 6px 12px;
  color: #fff;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Divider */
.mh-divider {
  border: 0;
  border-top: 1px solid #e6e6e6;
  margin: 8px 0 10px;
}

/* SPECS → 2 PER ROW */
.mh-spec-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr) !important;
  padding: 6px 15px;
  column-gap: 12px;
  row-gap: 8px;
  font-size: 13px;
  color: #444;
  align-items: center;
}

.mh-spec-row div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0; /* Prevent overflow */
}

.mh-spec-row i {
  font-size: 16px;
  color: #d6281c;
  flex-shrink: 0;
}

/* BUTTON */
.mh-btn {
  display: block;
  text-align: center;
  background: #d6281c !important;
  color: #fff !important;
  padding: 12px 24px;
  border-radius: 6px;
  margin: 14px 15px 18px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.25s ease, transform 0.2s ease;
  border: none;
  cursor: pointer;
}

.mh-btn:hover {
  background: #000 !important;
  color: #fff !important;
  transform: translateY(-2px);
}

/* ERROR & INFO MESSAGES */
.mh-error,
.mh-no-results {
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  font-size: 15px;
  text-align: center;
}

.mh-error {
  background: #ffebee;
  border: 2px solid #d6281c;
  color: #c62828;
}

.mh-no-results {
  background: #fff3cd;
  border: 2px solid #ffc107;
  color: #856404;
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

/* Tablets (3 columns) */
@media (max-width: 1024px) {
  .mh-grid-wrap {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
  }
  
  .mh-card-img img {
    height: 200px;
  }
}

/* Small Tablets (2 columns) */
@media (max-width: 768px) {
  .mh-grid-wrap {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  
  .mh-title-text {
    font-size: 15px;
  }
  
  .mh-price-badge {
    font-size: 13px;
    padding: 5px 10px;
  }
  
  .mh-spec-row {
    font-size: 12px;
  }
  
  .mh-card-img img {
    height: 180px;
  }
}

/* Mobile (1 column) */
@media (max-width: 480px) {
  .mh-grid-wrap {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .mh-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .mh-price-badge {
    align-self: flex-start;
  }
  
  .mh-spec-row {
    grid-template-columns: 1fr !important;
  }
  
  .mh-card-img img {
    height: 220px;
  }
}

/* Print Styles */
@media print {
  .mh-listing-card.motors-style {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .mh-gallery-count,
  .mh-btn {
    display: none;
  }
}
