/* Mobile Quick Add - Plus Button & Slide Panel */

/* Plus Button - Bottom Right of Product Image */
.mobile-quick-add {
  display: none;
}

@media screen and (max-width: 749px) {
  .mobile-quick-add {
    display: block;
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 2;
  }

  .mobile-quick-add__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(var(--color-background), 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
  }

  .mobile-quick-add__trigger:active {
    transform: scale(0.95);
  }

  .mobile-quick-add__trigger svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
  }

  .mobile-quick-add__trigger[aria-expanded="true"] svg {
    transform: rotate(45deg);
  }

  /* Overlay to dim the product image when panel is open */
  .mobile-quick-add__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--color-background), 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 2;
    pointer-events: none;
    cursor: pointer;
  }

  .mobile-quick-add__overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Slide Up Panel */
  .mobile-quick-add__panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(var(--color-background), 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.25s ease,
                visibility 0.3s ease;
    z-index: 3;
    border-top: 1px solid rgba(var(--color-foreground), 0.08);
  }

  .mobile-quick-add__panel.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  /* Panel Header */
  .mobile-quick-add__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  /* Hide header when it's a simple product (no title needed) */
  .mobile-quick-add__header--hidden {
    display: none;
  }

  .mobile-quick-add__title {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(var(--color-foreground), 0.6);
    margin: 0;
  }

  .mobile-quick-add__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: rgba(var(--color-foreground), 0.5);
  }

  .mobile-quick-add__close svg {
    width: 14px;
    height: 14px;
  }

  /* Size Options Grid - optimized for 3 per row on second line */
  .mobile-quick-add__options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .mobile-quick-add__option {
    flex: 0 0 auto;
    min-width: 40px;
    height: 34px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--color-foreground), 0.15);
    border-radius: 4px;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    color: rgb(var(--color-foreground));
  }

  .mobile-quick-add__option:active {
    transform: scale(0.97);
  }

  .mobile-quick-add__option:not(.is-disabled):hover,
  .mobile-quick-add__option:not(.is-disabled):focus {
    border-color: rgb(var(--color-foreground));
    background: rgba(var(--color-foreground), 0.03);
  }

  .mobile-quick-add__option.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
  }

  .mobile-quick-add__option.is-loading {
    pointer-events: none;
    position: relative;
    color: transparent;
  }

  .mobile-quick-add__option.is-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(var(--color-foreground), 0.2);
    border-top-color: rgb(var(--color-foreground));
    border-radius: 50%;
    animation: mobile-quick-add-spin 0.6s linear infinite;
  }

  @keyframes mobile-quick-add-spin {
    to {
      transform: rotate(360deg);
    }
  }

  /* Success State */
  .mobile-quick-add__option.is-success {
    background: rgb(var(--color-foreground));
    color: rgb(var(--color-background));
    border-color: rgb(var(--color-foreground));
  }

  /* Simple product - single Add to Cart button (no sizes) */
  .mobile-quick-add__option--single {
    flex: 1 1 auto;
    height: 40px;
    font-size: 13px;
    font-weight: 600;
    background: rgb(var(--color-foreground));
    color: rgb(var(--color-background));
    border-color: rgb(var(--color-foreground));
  }

  .mobile-quick-add__option--single:active {
    opacity: 0.9;
  }

  .mobile-quick-add__option--single.is-success {
    background: rgb(var(--color-foreground));
  }

  /* Inline close button for single-variant products */
  .mobile-quick-add__close--inline {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin-left: 8px;
    border: 1px solid rgba(var(--color-foreground), 0.15);
    border-radius: 4px;
    background: rgb(var(--color-background));
  }

  .mobile-quick-add__close--inline svg {
    width: 16px;
    height: 16px;
  }

  /* Single-variant panel needs more padding for visual clarity */
  .mobile-quick-add__panel--simple {
    padding: 16px;
  }

  /* Sold Out Message */
  .mobile-quick-add__sold-out {
    text-align: center;
    padding: 8px 0;
    font-size: 13px;
    color: rgba(var(--color-foreground), 0.6);
  }

  /* Error Message */
  .mobile-quick-add__error {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 12px;
    color: rgb(200, 50, 50);
    text-align: center;
  }

  .mobile-quick-add__error:empty {
    display: none;
  }

  /* Hide desktop quick add elements on mobile when mobile quick add is active */
  .product-card:has(.mobile-quick-add) .product-card__information-bottom {
    display: none;
  }
}

/* Fix product card info overflow for ALL cards on mobile */
@media screen and (max-width: 749px) {
  .product-card__inner {
    position: relative;
    overflow: visible;
  }

  .product-card__information {
    position: relative;
    z-index: 1;
    overflow: visible;
  }

  .product-card__information-top {
    overflow: visible;
  }

  /* Media area should NOT clip - images need to display properly */
  .product-card__media {
    position: relative;
    overflow: visible;
  }
}
