/**
 * Single Product Page - Responsive Styles
 * All media queries for mobile optimization
 */

/* ============================================================================
   STICKY MOBILE FOOTER - Compact Mobile
   ============================================================================ */

.product-sticky-footer {
    display: none;
}

@media (max-width: 768px) {
    .product-sticky-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: clamp(0.6rem, 1.5vw, 0.8rem);
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        padding: clamp(0.6rem, 1.2vw, 0.8rem);
        z-index: 100;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    }

    html.dark .product-sticky-footer {
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
    }

    .product-sticky-footer__price {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .product-sticky-footer__label {
        font-size: clamp(0.6rem, 0.8vw, 0.65rem);
        color: var(--text-muted);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .product-sticky-footer__amount {
        font-size: clamp(0.95rem, 1.5vw, 1.1rem);
        font-weight: 800;
        color: var(--accent);
    }

    .product-sticky-footer__btn {
        background: var(--accent);
        color: #000;
        padding: clamp(0.5rem, 1.2vw, 0.625rem) clamp(0.8rem, 1.5vw, 1rem);
        border-radius: 5px;
        font-weight: 700;
        text-decoration: none;
        font-size: clamp(0.7rem, 1vw, 0.8rem);
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
        min-height: 38px;
        display: flex;
        align-items: center;
        white-space: nowrap;
    }

    .product-sticky-footer__btn:hover {
        background: var(--accent-hover);
        transform: translateY(-1px);
    }

    body.single-flavor_product {
        padding-bottom: clamp(3rem, 6vw, 4rem);
    }
}

/* ============================================================================
   RESPONSIVE - Desktop to Tablet
   ============================================================================ */

@media (max-width: 1200px) {
    .related-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .prices-table__header,
    .prices-table__row {
        grid-template-columns: 1.5fr 120px 90px 70px;
        gap: 10px;
        padding: 10px;
    }
}

/* ============================================================================
   RESPONSIVE - Tablet
   ============================================================================ */

@media (max-width: 900px) {
    /* Gallery styles handled in inline CSS */

    .product-specs {
        grid-template-columns: 1fr;
    }

    .product-specs__row {
        grid-template-columns: 45% 55%;
    }

    .product-pros-cons__content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ============================================================================
   RESPONSIVE - Mobile
   ============================================================================ */

@media (max-width: 768px) {
    /* Mobile layout: Use CSS Grid to reorder elements across columns
       Order: Gallery -> Quick specs -> Prices -> Pros/Cons */
    .product-main {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Let children of product-left and product-right participate directly in grid */
    .product-left,
    .product-right {
        display: contents;
    }

    /* 1. Gallery at top */
    .product-gallery,
    .product-gallery-ssr {
        order: 1;
    }

    /* 2. Compare checkbox */
    .product-compare-checkbox {
        order: 2;
    }

    /* 3. Quick specs */
    .product-quick-specs {
        order: 3;
    }

    /* 4. Prices/Offers section */
    .product-merchant-feed {
        order: 4;
    }

    /* 5. Price history (mobile) */
    .price-history-mobile {
        order: 5;
    }

    /* 6. Description */
    .product-description {
        order: 6;
    }

    /* 7. Pros/Cons at bottom */
    .product-pros-cons {
        order: 7;
    }

    /* 8. Related mini carousel */
    .product-related-mini,
    .product-related-mini-ssr {
        order: 8;
    }

    /* Extra bottom padding for compare bar on product page */
    body.single-flavor_product {
        padding-bottom: 100px;
    }

    .single-product-page {
        padding: 16px 0 60px;
    }

    .single-product-container {
        padding: 0 16px;
    }

    .product-header {
        padding: 16px;
        border-radius: 10px;
    }

    .prices-section,
    .price-history-section,
    .seo-content {
        padding: 16px 0;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Prices Table Mobile */
    .prices-table__header {
        display: none;
    }

    .prices-table__row {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
        background-color: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .prices-table__row:last-child {
        margin-bottom: 0;
    }

    .prices-table__mobile-label {
        display: block;
    }

    .prices-table__col--shop {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 10px;
    }

    .prices-table__shop-info {
        display: contents;
    }

    .prices-table__col--shipping,
    .prices-table__col--price {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-top: 1px solid var(--border);
    }

    .prices-table__btn-buy {
        width: 100%;
        text-align: center;
        min-height: 40px;
    }

    /* Merchant Row Mobile */
    .merchant-row {
        grid-template-columns: 1fr;
        gap: 10px;
        background-color: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .merchant-row--lowest {
        border-width: 1px;
    }

    .merchant-row__left {
        flex-direction: row;
        align-items: center;
    }

    .merchant-row__center {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }

    .merchant-row__price-group {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    .merchant-row__right {
        width: 100%;
    }

    .btn-merchant-buy {
        width: 100%;
        min-height: 40px;
    }

    /* Specs Mobile */
    .specs-grid {
        grid-template-columns: 1fr;
    }

    /* Related Section Mobile */
    .related-section {
        padding: 16px 12px;
        margin-left: -12px;
        margin-right: -12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .related-card {
        flex: 0 0 140px;
        min-width: 140px;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ============================================================================
   RESPONSIVE - Small Mobile
   ============================================================================ */

@media (max-width: 480px) {
    .product-gallery__thumb {
        width: 48px;
        height: 48px;
    }

    .related-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .related-card {
        flex: 0 0 100%;
        min-width: 100%;
        flex-direction: row;
    }

    .related-card__image {
        width: 80px;
        aspect-ratio: 1;
        flex-shrink: 0;
    }

    .related-card__content {
        flex: 1;
        padding: 10px;
    }
}

/* ============================================================================
   SAFE AREA - Notched Devices
   ============================================================================ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .single-product-page {
            padding-bottom: calc(60px + env(safe-area-inset-bottom));
        }

        .product-sticky-footer {
            padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
        }
    }
}
