/**
 * Product Pages Styles
 */

/* ============================================
   Product List Page
   ============================================ */
.product-list-page {
    padding: var(--space-2xl) 0;
}

/* ============================================
   Product Show Page
   ============================================ */
.product-page {
    padding: var(--space-2xl) 0;
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: start;
}

/* Gallery */
.product-gallery {
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
}

.product-gallery__main {
    aspect-ratio: 1;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.product-gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-gallery__no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: var(--text-4xl);
}

.product-gallery__thumbs {
    display: flex;
    gap: var(--space-sm);
}

.product-gallery__thumb {
    width: 70px;
    height: 70px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.product-gallery__thumb:hover,
.product-gallery__thumb--active {
    opacity: 1;
}

.product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info */
.product-info {
    padding-top: var(--space-md);
}

.product-name {
    font-size: var(--text-2xl);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-md);
}

.product-price {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
}

.product-description {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-xl);
}

.product-short-description {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: var(--space-lg) 0 var(--space-xl) 0;
}

/* ============================================
   Product Purchase (Add to Cart Form)
   ============================================ */
.product-purchase {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

/* Form Groups */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
}

/* Select Styles */
.select-wrapper {
    position: relative;
}

.form-select {
    width: 100%;
    padding: var(--space-md) var(--space-xl) var(--space-md) var(--space-md);
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--text-base);
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-select:focus {
    outline: none;
    border-color: var(--color-text-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.form-select:hover {
    border-color: var(--color-text-secondary);
}

.select-arrow {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    transition: transform var(--transition-fast);
}

.select-wrapper:hover .select-arrow {
    color: var(--color-text-primary);
}

/* Quantity Selector */
.quantity-selector {
    margin-top: var(--space-lg);
}

/* Quantity Input Group */
.quantity-input-group {
    display: flex;
    align-items: center;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-fast);
    width: fit-content;
}

.quantity-input-group:focus-within {
    border-color: var(--color-text-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.quantity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quantity-btn:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.quantity-btn:active {
    background: var(--color-border);
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-btn--minus {
    border-right: 1px solid var(--color-border);
}

.quantity-btn--plus {
    border-left: 1px solid var(--color-border);
}

.quantity-input {
    flex: 1;
    min-width: 60px;
    padding: var(--space-md);
    text-align: center;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
}

.quantity-input:focus {
    outline: none;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input[type=number] {
    -moz-appearance: textfield;
}

/* Add to Cart Button */
.add-to-cart-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
    border: 2px solid var(--color-text-primary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    margin-top: var(--space-lg);
}

.add-to-cart-btn:hover:not(:disabled) {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.add-to-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

.add-to-cart-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.add-to-cart-btn .btn-text,
.add-to-cart-btn .btn-loading,
.add-to-cart-btn .btn-success {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-loading svg,
.btn-success svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Stock Information */
.stock-info {
    margin-top: var(--space-md);
    text-align: center;
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.stock-status--in-stock {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.stock-status--low-stock {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.stock-status--out-of-stock {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}


/* Meta */
.product-meta {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-border);
}

.product-meta__item {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

/* ============================================
   Responsive - Tablet
   ============================================ */
@media (max-width: 900px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .product-gallery {
        position: static;
    }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 768px) {
    .product-page {
        padding: var(--space-lg) 0;
        padding-bottom: calc(80px + var(--safe-area-bottom) + var(--space-lg));
    }

    .product-layout {
        gap: var(--space-lg);
    }

    .product-name {
        font-size: var(--text-xl);
    }

    .product-price {
        font-size: var(--text-lg);
        margin-bottom: var(--space-lg);
        padding-bottom: var(--space-lg);
    }

    /* Gallery Swipe - Horizontal scroll */
    .product-gallery__thumbs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: var(--space-sm);
    }

    .product-gallery__thumb {
        flex-shrink: 0;
        scroll-snap-align: start;
        width: 60px;
        height: 60px;
    }

    /* Quantity buttons bigger for touch */
    .quantity-btn {
        width: 52px;
        height: 52px;
    }

    .quantity-input {
        font-size: var(--text-lg);
    }

    /* Purchase section simplified */
    .product-purchase {
        padding: var(--space-md);
    }

    /* Variant select full width */
    .form-select {
        padding: var(--space-lg) var(--space-xl) var(--space-lg) var(--space-md);
        font-size: var(--text-base);
    }

    /* Meta info */
    .product-meta {
        padding-top: var(--space-lg);
    }
}

/* ============================================
   Sticky Add to Cart (Mobile)
   ============================================ */
@media (max-width: 768px) {
    .product-page {
        position: relative;
    }

    /* Mobile sticky bar at bottom */
    .sticky-add-to-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--color-bg-primary);
        border-top: 1px solid var(--color-border);
        padding: var(--space-md);
        padding-bottom: calc(var(--space-md) + var(--safe-area-bottom));
        z-index: 100;
        display: flex;
        align-items: center;
        gap: var(--space-md);
    }

    .sticky-add-to-cart__price {
        font-family: var(--font-mono);
        font-size: var(--text-lg);
        font-weight: var(--weight-medium);
    }

    .sticky-add-to-cart__btn {
        flex: 1;
    }
}

/* Breadcrumbs mobile */
@media (max-width: 768px) {
    .breadcrumbs {
        font-size: var(--text-xs);
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: var(--space-xs);
        margin-bottom: var(--space-lg);
        -webkit-overflow-scrolling: touch;
    }

    .breadcrumbs::-webkit-scrollbar {
        display: none;
    }
}

/* Product Description Accordion (Mobile) */
@media (max-width: 768px) {
    .product-description-accordion {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        overflow: hidden;
    }

    .product-description-accordion__trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: var(--space-md);
        background: var(--color-bg-secondary);
        border: none;
        color: var(--color-text-primary);
        font-size: var(--text-sm);
        font-weight: var(--weight-medium);
        cursor: pointer;
        text-align: left;
    }

    .product-description-accordion__content {
        padding: var(--space-md);
        display: none;
    }

    .product-description-accordion.is-open .product-description-accordion__content {
        display: block;
    }

    .product-description-accordion__icon {
        transition: transform 0.3s ease;
    }

    .product-description-accordion.is-open .product-description-accordion__icon {
        transform: rotate(180deg);
    }
}

