/**
 * ASP Custom Product Page Styles
 *
 * Bloom & Wild-inspired single product page.
 * Uses CSS custom property --asp-pp-aspect-ratio for configurable gallery ratio.
 * Responsive: mobile (<= 768px), tablet (769-1024px), desktop (> 1024px).
 */

/* =========================================================================
   CSS Custom Properties
   ========================================================================= */

.asp-pp {
    --asp-pp-aspect-ratio: 1 / 1;
    --asp-pp-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    --asp-pp-font-serif: Georgia, "Times New Roman", Times, serif;
    --asp-pp-color-text: #1a1a1a;
    --asp-pp-color-text-muted: #666;
    --asp-pp-color-border: #e5e5e5;
    --asp-pp-color-bg: #fff;
    --asp-pp-color-btn: #1a1a1a;
    --asp-pp-color-btn-text: #fff;
    --asp-pp-color-star: #f5a623;
    --asp-pp-color-badge: #fef3cd;
    --asp-pp-color-badge-text: #856404;
    --asp-pp-color-overlay: rgba(0, 0, 0, 0.4);
    --asp-pp-radius: 0;
    --asp-pp-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --asp-pp-panel-width: 480px;
    --asp-pp-gap: 4px;

    font-family: var(--asp-pp-font-family);
    color: var(--asp-pp-color-text);
    line-height: 1.5;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Override theme side-padding on the product page so we get true edge-to-edge */
.woocommerce.single-product #primary,
.woocommerce.single-product .site-main,
.woocommerce.single-product .entry-content,
.woocommerce.single-product .content-area {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
}

/* =========================================================================
   Typography
   ========================================================================= */

.asp-pp-title {
    font-family: var(--asp-pp-font-serif);
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

/* =========================================================================
   Desktop Layout: Two-column grid
   ========================================================================= */

.asp-pp-desktop-grid {
    display: grid;
    grid-template-columns: var(--asp-pp-columns, 1fr 1fr);
    gap: 40px;
    align-items: start;
    padding: 24px var(--page--spacing, 24px) 48px;
}

.asp-pp-desktop-left {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.asp-pp-desktop-info {
    position: sticky;
    top: 24px;
    padding-top: 8px;
}

/* =========================================================================
   Gallery — Desktop (2x2 Grid)
   ========================================================================= */

.asp-pp-gallery--desktop {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--asp-pp-gap);
}

.asp-pp-gallery-cell {
    position: relative;
    overflow: hidden;
    border-radius: var(--asp-pp-radius);
}

.asp-pp-gallery-media {
    display: block;
    width: 100%;
    aspect-ratio: var(--asp-pp-aspect-ratio);
    object-fit: cover;
}

/* =========================================================================
   Gallery — Mobile (Horizontal Scroll-Snap)
   ========================================================================= */

.asp-pp-gallery--mobile {
    position: relative;
    margin: 0; /* No negative margin — parent has no padding */
}

.asp-pp-gallery-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: var(--asp-pp-gap);
    padding: 0; /* Edge-to-edge images */
}

.asp-pp-gallery-scroll::-webkit-scrollbar {
    display: none;
}

.asp-pp-gallery--mobile .asp-pp-gallery-item {
    flex: 0 0 85%;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    border-radius: var(--asp-pp-radius);
}

.asp-pp-gallery--mobile .asp-pp-gallery-media {
    display: block;
    width: 100%;
    aspect-ratio: var(--asp-pp-aspect-ratio);
    object-fit: cover;
}

/* Gallery scroll progress bar (Bloom & Wild style) */
.asp-pp-gallery-progress {
    position: relative;
    height: 2px;
    margin: 12px var(--page--spacing, 16px) 0;
    background: var(--asp-pp-color-border);
    border-radius: 1px;
    overflow: hidden;
}

.asp-pp-gallery-progress-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--asp-pp-color-text);
    border-radius: 1px;
    transition: left 0.15s ease-out, width 0.15s ease-out;
    will-change: left, width;
}

/* =========================================================================
   Video Play/Pause Button
   ========================================================================= */

.asp-pp-gallery-video-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

.asp-pp-gallery-video-wrap video {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: var(--asp-pp-aspect-ratio);
    object-fit: cover;
}

.asp-pp-video-btn {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--asp-pp-color-text);
    backdrop-filter: blur(4px);
    transition: background var(--asp-pp-transition);
    z-index: 2;
}

.asp-pp-video-btn:hover {
    background: #fff;
}

.asp-pp-video-btn-icon {
    font-size: 11px;
}

/* =========================================================================
   Promo Badge
   ========================================================================= */

.asp-pp-promo-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--asp-pp-color-badge);
    color: var(--asp-pp-color-badge-text);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    line-height: 1.3;
}

/* =========================================================================
   Price Row
   ========================================================================= */

.asp-pp-price-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.asp-pp-price {
    font-size: 1.25rem;
    font-weight: 600;
}

.asp-pp-stars-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.asp-pp-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
}

.asp-pp-rating-text {
    font-size: 0.875rem;
    color: var(--asp-pp-color-text-muted);
}

/* =========================================================================
   "In a Nutshell" Section
   ========================================================================= */

.asp-pp-nutshell {
    margin-bottom: 20px;
}

.asp-pp-nutshell-heading {
    font-family: var(--asp-pp-font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.asp-pp-nutshell-content {
    font-size: 0.9375rem;
    color: var(--asp-pp-color-text);
    line-height: 1.6;
}

.asp-pp-nutshell-content ul {
    padding-left: 20px;
    margin: 0;
}

.asp-pp-nutshell-content li {
    margin-bottom: 4px;
}

/* =========================================================================
   "More Information" Link
   ========================================================================= */

.asp-pp-more-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 20px;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--asp-pp-color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-family: inherit;
}

.asp-pp-more-info:hover {
    color: var(--asp-pp-color-text-muted);
}

.asp-pp-more-info svg {
    flex-shrink: 0;
}

/* =========================================================================
   Quantity — theme (Heim) renders .quantity with its own CSS.
   We only ensure it aligns in our flex row and matches button heights.
   ========================================================================= */

.asp-pp-action-buttons .quantity {
    flex-shrink: 0;
    margin: 0; /* Override any default WC margin */
}

/* =========================================================================
   Action Buttons (Quantity + Send + Heart)
   ========================================================================= */

.asp-pp-action-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.asp-pp-send-btn {
    flex: 1;
    padding: 14px 24px;
    background: var(--asp-pp-color-btn);
    color: var(--asp-pp-color-btn-text);
    border: none;
    border-radius: var(--asp-pp-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--asp-pp-transition);
    font-family: inherit;
    letter-spacing: 0.01em;
}

.asp-pp-send-btn:hover {
    opacity: 0.85;
}

.asp-pp-heart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 1px solid var(--asp-pp-color-border);
    border-radius: var(--asp-pp-radius);
    background: var(--asp-pp-color-bg);
    cursor: pointer;
    transition: all var(--asp-pp-transition);
    flex-shrink: 0;
    color: var(--asp-pp-color-text);
}

.asp-pp-heart-btn:hover {
    border-color: var(--asp-pp-color-text);
}

.asp-pp-heart-btn--active {
    color: #e25555;
    border-color: #e25555;
}

.asp-pp-heart-btn svg {
    min-width: 20px;
    min-height: 20px;
}

/* =========================================================================
   Delivery Info
   ========================================================================= */

.asp-pp-delivery-info {
    margin-bottom: 16px;
    font-size: 0.875rem;
}

/* =========================================================================
   Icon Lines
   ========================================================================= */

.asp-pp-icon-lines {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.asp-pp-icon-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--asp-pp-color-border);
    font-size: 0.875rem;
}

.asp-pp-icon-line:last-child {
    border-bottom: none;
}

.asp-pp-icon-line-icon {
    flex-shrink: 0;
    object-fit: contain;
}

/* =========================================================================
   Tab List
   ========================================================================= */

.asp-pp-tabs-section {
    margin-top: 8px;
}

.asp-pp-tab-list {
    display: flex;
    flex-direction: column;
}

.asp-pp-tab-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 18px 0;
    border: none;
    border-top: 1px solid var(--asp-pp-color-border);
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--asp-pp-color-text);
    text-align: left;
    transition: color var(--asp-pp-transition);
}

.asp-pp-tab-row:last-child {
    border-bottom: 1px solid var(--asp-pp-color-border);
}

.asp-pp-tab-row:hover {
    color: var(--asp-pp-color-text-muted);
}

.asp-pp-tab-label {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.asp-pp-tab-reviews-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.asp-pp-tab-reviews-text {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--asp-pp-color-text-muted);
}

.asp-pp-tab-chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.asp-pp-tab-chevron svg {
    min-width: 20px;
    min-height: 20px;
}

/* =========================================================================
   Panel Overlay
   ========================================================================= */

.asp-pp-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--asp-pp-color-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--asp-pp-transition), visibility var(--asp-pp-transition);
}

.asp-pp-panel-overlay--open {
    opacity: 1;
    visibility: visible;
}

/* =========================================================================
   Side Panel (Desktop)
   ========================================================================= */

.asp-pp-side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--asp-pp-panel-width);
    max-width: 90vw;
    background: var(--asp-pp-color-bg);
    transform: translateX(100%);
    transition: transform var(--asp-pp-transition);
    display: flex;
    flex-direction: column;
    z-index: 100000;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

.asp-pp-side-panel--open {
    transform: translateX(0);
}

.asp-pp-side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--asp-pp-color-border);
    flex-shrink: 0;
}

/* =========================================================================
   Bottom Sheet (Mobile)
   ========================================================================= */

.asp-pp-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    background: var(--asp-pp-color-bg);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform var(--asp-pp-transition);
    display: flex;
    flex-direction: column;
    z-index: 100000;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
}

.asp-pp-bottom-sheet--open {
    transform: translateY(0);
}

.asp-pp-bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--asp-pp-color-border);
    flex-shrink: 0;
    position: relative;
}

.asp-pp-bottom-sheet-handle {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

/* =========================================================================
   Panel Shared (Title, Close, Body)
   ========================================================================= */

.asp-pp-panel-title {
    font-family: var(--asp-pp-font-serif);
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
}

.asp-pp-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--asp-pp-color-text);
    border-radius: 50%;
    transition: background var(--asp-pp-transition);
    flex-shrink: 0;
}

.asp-pp-panel-close:hover {
    background: #f0f0f0;
}

.asp-pp-panel-close svg {
    min-width: 20px;
    min-height: 20px;
}

.asp-pp-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

.asp-pp-panel-content {
    font-size: 0.9375rem;
    line-height: 1.7;
}

.asp-pp-panel-content p {
    margin: 0 0 16px;
}

.asp-pp-panel-content img {
    max-width: 100%;
    height: auto;
}

/* =========================================================================
   Mobile Bottom Bar
   ========================================================================= */

.asp-pp-mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--asp-pp-color-bg);
    border-top: 1px solid var(--asp-pp-color-border);
    transform: translateY(100%);
    transition: transform var(--asp-pp-transition);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);

    /* Only show on mobile */
    display: none;
}

.asp-pp-mobile-bar--visible {
    transform: translateY(0);
}

.asp-pp-mobile-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-width: 600px;
    margin: 0 auto;
    gap: 16px;
}


.asp-pp-mobile-bar-send {
    flex: 1;
    padding: 12px 32px;
    background: var(--asp-pp-color-btn);
    color: var(--asp-pp-color-btn-text);
    border: none;
    border-radius: var(--asp-pp-radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: opacity var(--asp-pp-transition);
}

/* Quantity in mobile bottom bar — uses theme .quantity styling */
.asp-pp-mobile-bar .quantity {
    margin: 0;
}

.asp-pp-mobile-bar-send:hover {
    opacity: 0.85;
}

/* =========================================================================
   Mobile Layout
   ========================================================================= */

.asp-pp-mobile {
    padding-bottom: 80px; /* Space for bottom bar */
}

.asp-pp-mobile-info {
    padding: 16px var(--page--spacing, 16px) 0;
}

/* =========================================================================
   Responsive Breakpoints
   ========================================================================= */

/* Mobile: <= 768px */
@media (max-width: 768px) {
    .asp-pp-title {
        font-size: 1.5rem;
    }

    .asp-pp-mobile-bar {
        display: block;
    }

    .asp-pp-send-btn {
        padding: 12px 20px;
    }

    .asp-pp-heart-btn {
        width: 48px;
        height: 48px;
    }

}

/* Tablet: 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .asp-pp-desktop-grid {
        gap: 24px;
    }

    .asp-pp-title {
        font-size: 1.75rem;
    }
}

/* Large desktop: > 1400px — full width, spacing via --page--spacing */

/* =========================================================================
   WooCommerce review styles within panel
   ========================================================================= */

.asp-pp-panel-content .commentlist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.asp-pp-panel-content .comment {
    padding: 16px 0;
    border-bottom: 1px solid var(--asp-pp-color-border);
}

.asp-pp-panel-content .comment:last-child {
    border-bottom: none;
}

.asp-pp-panel-content .star-rating {
    display: inline-flex;
    color: var(--asp-pp-color-star);
    font-size: 14px;
    margin-bottom: 4px;
}

.asp-pp-panel-content .comment_container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.asp-pp-panel-content .woocommerce-review__author {
    font-weight: 600;
    font-size: 0.875rem;
}

.asp-pp-panel-content .description p {
    margin: 4px 0 0;
}

/* =========================================================================
   Hidden WooCommerce elements
   ========================================================================= */

/* Hidden WooCommerce elements (sr-only, not display:none, so JS events fire) */
.asp-pp-hidden-woo {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    white-space: nowrap !important;
}
