/* --- section.css --- */
/* This file handles "card" layouts, product sections, etc. */

/* PRODUCT / CARD-LIKE STYLES */

.cards-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px auto;
  max-width: 1200px;
  flex-wrap: wrap;
}

.card {
  width: 300px;
  height: auto;
  min-height: 450px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(2, 6, 23, 0.7));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  text-align: center;
  padding: 25px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #e5e7eb;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(2, 8, 23, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: visible;
}

.card-image-container {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.3s ease;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-title {
  margin-bottom: 15px;
  font-size: 1.4rem;
  font-weight: 700;
  color: #3b82f6;
  flex-shrink: 0;
}

.card-description {
  margin-bottom: 20px;
  line-height: 1.6;
  color: #cbd5e1;
  flex-shrink: 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Override legacy card styles to use new classes */
.card .card-title {
  margin-bottom: 15px;
  font-size: 1.4rem;
  font-weight: 700;
  color: #3b82f6;
  flex-shrink: 0;
}

.card .card-description {
  margin-bottom: 20px;
  line-height: 1.6;
  color: #cbd5e1;
  flex-shrink: 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Legacy card img styles for backward compatibility */
.card img.card-img {
  width: 150px;
  height: 150px;
  margin: 0 auto 15px;
  border-radius: 4px;
  object-fit: cover;
}

/* Legacy card text styles - these will be overridden by the new classes above */
.card h2 {
  margin-bottom: 15px;
  font-size: 1.4rem;
  font-weight: 700;
  color: #3b82f6;
  flex-shrink: 0;
}

.card p {
  margin-bottom: 20px;
  line-height: 1.6;
  color: #cbd5e1;
  flex-shrink: 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Price spacing */
.card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Ensure consistent vertical spacing between top-level pieces inside a card */
.card > * { margin-bottom: 20px; }
.card > *:last-child { margin-bottom: 0; }

/* === BUTTONS === */
.card-buttons {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 12px;               /* default vertical space between buttons */
  position: relative;
  clear: both;
  flex-shrink: 0;

  /* Force centering */
  margin-left: auto;
  margin-right: auto;
}

.card-buttons .details-btn,
.card-buttons .cart-btn {
  display: block;
  position: relative;
  float: none;

  /* spacing handled by .card-buttons gap */
  margin: 0;

  padding: 16px 32px;
  width: 100%;
  max-width: 180px;
  box-sizing: border-box;
  line-height: 1.2;
  height: auto;
  min-height: 48px;
  text-align: center;
  border-radius: 25px;
}

/* Visual styles */
.details-btn,
.cart-btn {
  padding: 16px 32px;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  width: 100%;
  max-width: 180px;
  white-space: nowrap;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
  text-align: center;
  min-height: 48px;
}

.details-btn:hover,
.cart-btn:hover {
  background: linear-gradient(180deg, #2563eb, #1e40af);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
  transform: translateY(-2px);
}

.details-btn:active,
.cart-btn:active {
  transform: translateY(0);
  transition: transform 0.1s ease;
}

/* Hover effects only on devices with a pointer & hover */
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    border-color: #38bdf8;
    box-shadow: 0 16px 40px rgba(2, 132, 199, 0.25);
    transform: translateY(-3px) scale(1.03);
    background-color: rgba(30, 41, 59, 0.35);
  }
  
  .card:hover .card-img {
    transform: scale(1.05);
  }
  
  .card:hover .card-image-container {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* PAGINATION */
.pagination {
  display: flex;
  justify-content: center;
  margin: 20px auto;
  gap: 4px;
}
.pagination a {
  color: #e5e7eb;
  background-color: rgba(30, 41, 59, 0.8);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.3s;
}
.pagination a.active {
  background-color: #3b82f6;
  color: #f8fafc;
}
.pagination a:hover {
  background-color: rgba(59, 130, 246, 0.5);
}

/* Clickable card styles */
.clickable-card {
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.clickable-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
}
.clickable-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}
.clickable-card:hover::before { opacity: 1; }
.clickable-card .card-buttons { position: relative; z-index: 2; }
.clickable-card:active { transform: translateY(-2px); transition: transform 0.1s ease; }
.clickable-card .cart-btn,
.clickable-card .details-btn { position: relative; z-index: 3; transition: all 0.2s ease; }
.clickable-card .cart-btn:hover,
.clickable-card .details-btn:hover { transform: none; box-shadow: none; }
.clickable-card::after {
  content: '👆 Click to view details';
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 4;
}
.clickable-card:hover::after { opacity: 1; }

/* --- RESPONSIVE --- */
@media only screen and (max-width: 768px) {
  .cards-container {
    flex-direction: column;
    align-items: center;
    gap: 25px;
  }
  .card {
    width: 90%;
    max-width: 400px;
    min-height: 450px;
    padding: 25px 20px;
  }
  .card h2 { font-size: 1.6rem; margin-bottom: 20px; }
  .card p { font-size: 1rem; min-height: 80px; margin-bottom: 25px; }
  .card .price { font-size: 1.8rem; margin-bottom: 30px; }

  .card-buttons { margin-top: 30px; gap: 10px; }
  .details-btn, .cart-btn {
    padding: 16px 28px;
    font-size: 1rem;
    max-width: 250px;
  }
}

@media only screen and (max-width: 480px) {
  .card { width: 95%; padding: 20px 15px; min-height: 480px; }
  .card h2 { font-size: 1.4rem; }
  .card p  { font-size: 0.95rem; min-height: 70px; }
  .card .price { font-size: 1.6rem; margin-bottom: 25px; }

  .card-buttons { margin-top: 25px; gap: 10px; }
  .details-btn, .cart-btn {
    padding: 18px 24px;
    font-size: 1rem;
    max-width: 100%;
  }
}

/* -------------------------------------------------- */
/* HARD GUARANTEE: create a visible gap exactly between
   the two buttons, regardless of wrapper/order/overrides */
/* -------------------------------------------------- */

/* 1) If wrapper exists, use its gap (stronger specificity + !important) */
.card .card-buttons {
  gap: 14px !important;           /* adjust to taste */
}

/* 2) Fallback: if buttons are direct siblings inside the card,
      add top margin to the second one (works either order) */
.card .cart-btn + .details-btn,
.card .details-btn + .cart-btn {
  margin-top: 14px !important;    /* same visual gap */
}

/* 3) Keep buttons centered and same width */
.card .cart-btn,
.card .details-btn {
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
  max-width: 180px !important;
}
