/* Mobile Product Cards — Collapsed/Expanded View
 * Only applies at ≤768px. Desktop is unaffected.
 * Collapsed: grid layout — image left, name+score right, CTA below
 * Expanded: full vertical details (ingredients, verdict, pros/cons, breakdown)
 */

@media (max-width: 768px) {

  /* ── Collapsed state: hide detail sections ─────────────────────── */
  .product-card:not(.gp-card-expanded) .ingredients-block,
  .product-card:not(.gp-card-expanded) .verdict-block,
  .product-card:not(.gp-card-expanded) .pros-list,
  .product-card:not(.gp-card-expanded) .con,
  .product-card:not(.gp-card-expanded) .score-breakdown,
  .product-card:not(.gp-card-expanded) .score-bar-track,
  .product-card:not(.gp-card-expanded) .score-criteria {
    display: none !important;
  }

  /* ── Collapsed card: CSS Grid layout ───────────────────────────── */
  .product-card:not(.gp-card-expanded) {
    padding: 0.75rem 0.85rem !important;
    display: grid !important;
    grid-template-columns: 75px 1fr;
    grid-template-rows: auto;
    gap: 0 0.75rem;
    align-items: start;
    border: 1px solid rgba(233, 30, 99, 0.1);
  }

  /* Soft border on all mobile cards */
  .product-card {
    border: 1px solid rgba(233, 30, 99, 0.1) !important;
  }

  /* Badge: spans full width, row 1 */
  .product-card:not(.gp-card-expanded) .top-pick-badge,
  .product-card:not(.gp-card-expanded) .glow-top-pick-badge {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.7rem;
  }

  /* Image: left column */
  .product-card:not(.gp-card-expanded) .product-image {
    grid-column: 1;
    grid-row: 2 / 4;
    margin-bottom: 0 !important;
    align-self: center;
  }

  .product-card:not(.gp-card-expanded) .product-image img {
    max-height: 75px !important;
    max-width: 75px !important;
    border-radius: 6px !important;
    object-fit: contain !important;
  }

  /* Product name: right column, compact */
  .product-card:not(.gp-card-expanded) .product-name {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
    line-height: 1.2;
  }

  /* GlowScore: right column, inline-compact */
  .product-card:not(.gp-card-expanded) .glowscore-block {
    grid-column: 2;
    grid-row: 3;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0;
  }

  .product-card:not(.gp-card-expanded) .glowscore-display {
    margin-bottom: 0;
  }

  .product-card:not(.gp-card-expanded) .score-number {
    font-size: 1.5rem;
  }

  .product-card:not(.gp-card-expanded) .score-label {
    font-size: 0.85rem;
  }

  .product-card:not(.gp-card-expanded) .score-title {
    font-size: 0.65rem;
    margin-left: 0.25rem;
  }

  /* CTA button: compact below grid */
  .product-card:not(.gp-card-expanded) .cta-wrapper {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 0.4rem;
    text-align: center;
  }

  .product-card:not(.gp-card-expanded) .cta-button {
    padding: 0.32rem 0.75rem !important;
    font-size: 0.72rem !important;
    display: inline-block !important;
    border-radius: 50px;
  }

  /* Toggle button: full width, last row */
  .product-card:not(.gp-card-expanded) .gp-card-toggle {
    grid-column: 1 / -1;
    grid-row: 5;
  }

  /* Handle cards WITHOUT badge: image starts at row 1 */
  .product-card:not(.gp-card-expanded):not(:has(.top-pick-badge)):not(:has(.glow-top-pick-badge)) .product-image {
    grid-row: 1 / 3;
  }

  .product-card:not(.gp-card-expanded):not(:has(.top-pick-badge)):not(:has(.glow-top-pick-badge)) .product-name {
    grid-row: 1;
  }

  .product-card:not(.gp-card-expanded):not(:has(.top-pick-badge)):not(:has(.glow-top-pick-badge)) .glowscore-block {
    grid-row: 2;
  }

  .product-card:not(.gp-card-expanded):not(:has(.top-pick-badge)):not(:has(.glow-top-pick-badge)) .cta-wrapper {
    grid-row: 3;
  }

  .product-card:not(.gp-card-expanded):not(:has(.top-pick-badge)):not(:has(.glow-top-pick-badge)) .gp-card-toggle {
    grid-row: 4;
  }

  /* ── Expand/Collapse Button ────────────────────────────────────── */
  .gp-card-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.4rem 1rem;
    margin-top: 0.35rem;
    background: linear-gradient(135deg, #fdf2f8, #f3e5f5);
    border: 1px solid rgba(156, 39, 176, 0.15);
    border-radius: 8px;
    color: #9c27b0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .gp-card-toggle:hover,
  .gp-card-toggle:active {
    background: linear-gradient(135deg, #f8e1ef, #edd5f5);
    border-color: rgba(156, 39, 176, 0.3);
  }

  .gp-card-toggle .gp-toggle-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.7rem;
  }

  .gp-card-expanded .gp-card-toggle .gp-toggle-arrow {
    transform: rotate(180deg);
  }

  /* ── Expanded state: back to normal block layout ───────────────── */
  .gp-card-expanded {
    padding: 1.5rem !important;
    display: block !important;
  }

  .gp-card-expanded .product-name {
    font-size: 1.3rem;
  }

  .gp-card-expanded .glowscore-block {
    margin-left: 0;
  }

  /* Smooth transition for expand */
  .gp-card-expanded .ingredients-block,
  .gp-card-expanded .verdict-block,
  .gp-card-expanded .pros-list,
  .gp-card-expanded .con,
  .gp-card-expanded .score-breakdown,
  .gp-card-expanded .score-bar-track {
    animation: gp-fade-in 0.3s ease;
  }

  @keyframes gp-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Disable hover lift on mobile (causes jank) */
  .product-card:hover {
    transform: none !important;
  }
}

/* ── Hide toggle button on desktop ───────────────────────────────── */
@media (min-width: 769px) {
  .gp-card-toggle {
    display: none !important;
  }
}
