/**
 * Savvy Rest Gift Card Enhancements - Responsive Design
 * Mobile-first breakpoints and adaptive layouts
 * Version: 2.0.0
 */

/* ==========================================
   LARGE TABLETS/SMALL DESKTOPS
   992px - 1200px
   ========================================== */

@media (min-width: 992px) and (max-width: 1200px) {
  /* Adjust grid for medium screens */
  .product-type-pw-gift-card .summary.entry-summary,
  .single-pw_gift_card .summary.entry-summary,
  .postid-141995 .summary.entry-summary {
    grid-template-columns: 500px 1fr !important;
    gap: var(--gc-spacing-2xl) !important;
  }

  body.single-product.product-type-pw-gift-card .summary.entry-summary,
  body.single-product.postid-141995 .summary.entry-summary {
    grid-template-columns: 500px 1fr !important;
    gap: var(--gc-spacing-2xl) !important;
  }
}

/* ==========================================
   TABLET LANDSCAPE
   768px - 992px
   ========================================== */

@media (min-width: 768px) and (max-width: 992px) {
  /* Adjust grid for tablet landscape */
  .product-type-pw-gift-card .summary.entry-summary,
  .single-pw_gift_card .summary.entry-summary,
  .postid-141995 .summary.entry-summary {
    grid-template-columns: 400px 1fr !important;
    gap: var(--gc-spacing-xl) !important;
  }

  body.single-product.product-type-pw-gift-card .summary.entry-summary,
  body.single-product.postid-141995 .summary.entry-summary {
    grid-template-columns: 400px 1fr !important;
    gap: var(--gc-spacing-xl) !important;
  }
  
  /* Amount grid stays at 2 columns */
  .gc-amount-grid,
  .savvyrest-gc-amount-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
}

/* ==========================================
   TABLET PORTRAIT & MOBILE
   Max 992px
   ========================================== */

@media (max-width: 767px) {
  /* Stack everything vertically on mobile/tablet portrait */
  .product-type-pw-gift-card .summary.entry-summary,
  .single-pw_gift_card .summary.entry-summary,
  .postid-141995 .summary.entry-summary,
  body.single-product.product-type-pw-gift-card .summary.entry-summary,
  body.single-product.postid-141995 .summary.entry-summary {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--gc-spacing-xl) !important;
  }

  /* All elements take full width on mobile */
  .product-type-pw-gift-card .summary .gift-card-featured-image,
  .product-type-pw-gift-card .summary .gift-card-description,
  .product-type-pw-gift-card .summary .product_title,
  .single-pw_gift_card .summary .gift-card-featured-image,
  .single-pw_gift_card .summary .gift-card-description,
  .single-pw_gift_card .summary .product_title,
  .postid-141995 .summary .gift-card-featured-image,
  .postid-141995 .summary .gift-card-description,
  .postid-141995 .summary .product_title {
    flex: 1 1 100% !important;
  }

  /* Form takes full width, no left margin */
  .product-type-pw-gift-card .summary .variations_form.cart,
  .single-pw_gift_card .summary .variations_form.cart,
  .postid-141995 .summary .variations_form.cart {
    margin-left: 0 !important;
  }

  /* Explicit stacking order for mobile (image → title → amount → description → purchase flow) */
  .product-type-pw-gift-card .summary .gift-card-featured-image,
  .single-pw_gift_card .summary .gift-card-featured-image,
  .postid-141995 .summary .gift-card-featured-image {
    order: 1;
  }

  .product-type-pw-gift-card .summary .product_title,
  .single-pw_gift_card .summary .product_title,
  .postid-141995 .summary .product_title {
    order: 2;
  }

  .product-type-pw-gift-card .summary .gc-amount-selector,
  .product-type-pw-gift-card .summary .savvyrest-gc-amount-selector,
  .single-pw_gift_card .summary .gc-amount-selector,
  .single-pw_gift_card .summary .savvyrest-gc-amount-selector,
  .postid-141995 .summary .gc-amount-selector,
  .postid-141995 .summary .savvyrest-gc-amount-selector {
    order: 3;
  }

  .product-type-pw-gift-card .summary .gift-card-description,
  .single-pw_gift_card .summary .gift-card-description,
  .postid-141995 .summary .gift-card-description {
    order: 4;
  }

  .product-type-pw-gift-card .summary #pwgc-purchase-container,
  .single-pw_gift_card .summary #pwgc-purchase-container,
  .postid-141995 .summary #pwgc-purchase-container {
    order: 5;
  }

  .product-type-pw-gift-card .summary .cart,
  .single-pw_gift_card .summary .cart,
  .postid-141995 .summary .cart {
    order: 6;
  }

  /* Online Exclusive Badge: Early in flow, after title */
  .product-type-pw-gift-card .summary .custom-online-exclusive,
  .single-pw_gift_card .summary .custom-online-exclusive,
  .postid-141995 .summary .custom-online-exclusive {
    order: 2;
  }

  /* FAQ Wrapper (Shipping & Return accordions): After cart */
  .product-type-pw-gift-card .summary .faq-wrapper,
  .single-pw_gift_card .summary .faq-wrapper,
  .postid-141995 .summary .faq-wrapper {
    order: 7;
  }

  /* Dealer Block: After FAQ */
  .product-type-pw-gift-card .summary .custom-dealer-block,
  .single-pw_gift_card .summary .custom-dealer-block,
  .postid-141995 .summary .custom-dealer-block {
    order: 8;
  }

  /* Sale Flash: Stays positioned at top over image */
  .product-type-pw-gift-card .astra-sale-flash,
  .single-pw_gift_card .astra-sale-flash,
  .postid-141995 .astra-sale-flash {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    max-width: 100% !important;
    width: 60% !important; /* Slightly wider on mobile */
  }

  /* Image takes full width */
  .gift-card-featured-image {
    max-width: 100%;
  }
  
  /* Show mobile sticky CTA */
  .savvyrest-gc-mobile-sticky {
    display: block;
  }
  
  /* Button full width on mobile */
  .single-product .single_add_to_cart_button {
    width: 100%;
    min-width: auto;
  }
  
  /* Amount selector padding */
  .savvyrest-gc-amount-selector {
    padding: var(--gc-spacing-xl) var(--gc-spacing);
  }
  
  /* Recipient fields padding */
  #pwgc-purchase-container {
    padding: var(--gc-spacing-xl) var(--gc-spacing);
  }
}

/* ==========================================
   TABLET PORTRAIT
   Max 768px
   ========================================== */

@media (max-width: 768px) {
  /* Amount grid: 2 columns */
  .gc-amount-grid,
  .savvyrest-gc-amount-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  /* Card sizing */
  .savvyrest-gc-amount-card {
    padding: var(--gc-spacing) var(--gc-spacing-md);
    min-height: 120px;
  }

  .savvyrest-gc-amount-value {
    font-size: var(--gc-font-size-3xl);
  }

  /* Success notification - mobile */
  .savvyrest-gc-success-notification {
    top: 80px;
    right: -100%;
    left: auto;
    min-width: auto;
    width: calc(100% - 32px);
    margin: 0 16px;
  }

  .savvyrest-gc-success-notification.show {
    right: 0;
    left: 16px;
  }

  .gc-notification-actions {
    flex-direction: column;
  }

  .gc-notification-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================
   MOBILE SMALL
   Max 480px
   ========================================== */

@media (max-width: 480px) {
  /* Amount grid: 1 column (stacked) */
  .gc-amount-grid,
  .savvyrest-gc-amount-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  /* Compact card sizing */
  .savvyrest-gc-amount-card {
    min-height: 100px;
    padding: var(--gc-spacing) var(--gc-spacing-md);
  }
  
  .savvyrest-gc-amount-value {
    font-size: var(--gc-font-size-4xl);
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  .savvyrest-gc-mobile-sticky,
  .single-product .single_add_to_cart_button {
    display: none;
  }
}

/* ==========================================
   ACCESSIBILITY - HIGH CONTRAST
   ========================================== */

@media (prefers-contrast: high) {
  .savvyrest-gc-amount-card {
    border-width: 4px;
  }
  
  .savvyrest-gc-amount-card.active {
    border-width: 5px;
  }
}

/* ==========================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  .savvyrest-gc-amount-card,
  .single-product .single_add_to_cart_button,
  .savvyrest-gc-mobile-sticky {
    animation: none;
    transition: none;
  }
}

/* ==========================================
   CUSTOM AMOUNT RESPONSIVE STYLES
   ========================================== */

@media (max-width: 767px) {
  .savvyrest-custom-amount-input {
    font-size: 18px;
    padding: 14px 14px 14px 32px;
    min-height: 48px; /* Touch target */
  }

  .savvyrest-gc-custom-input-wrapper .currency-symbol {
    font-size: 18px;
    left: 14px;
  }

  .savvyrest-gc-amount-range {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .custom-amount-card {
    /* Full width on very small screens */
    grid-column: 1 / -1;
  }

  .savvyrest-custom-amount-input {
    font-size: 16px; /* Prevent iOS zoom */
  }
}

