/* Product pages styles — ported verbatim from Pages/Shared/_ProductStyles.cshtml
 * so V2 ProductDetail picks up the same rules V1 had via a <style> partial.
 * Source of truth = the .cshtml. If you change one, mirror the other (until
 * V1 is dropped in Etap 6). */

/* Product Detail Page */
.product-hero {
    background-color: var(--background-color);
    padding: 3rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.product-images {
    position: sticky;
    top: 20px;
}

.product-main-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    /* CSS fallback - will be overridden by JavaScript for precise calculation */
    max-height: calc(100vh - 200px);
}

/* When thumbnails exist, reduce main image height to fit both (CSS fallback) */
.product-images:has(.product-thumbnails) .product-main-image {
    max-height: calc(100vh - 280px);
}

.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
}

.product-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 2px;
}

.product-thumbnail {
    width: 70px;
    height: 70px;
    min-width: 70px;
    object-fit: contain;
    background: #f8f8f8;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #eee;
    transition: all 0.2s ease;
}

.product-thumbnail:hover,
.product-thumbnail.active {
    border-color: var(--accent-color);
}

.product-info {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.product-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--heading-color);
}

.product-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.product-price-old {
    font-size: 1.5rem;
    color: #999;
    text-decoration: line-through;
    margin-left: 1rem;
}

/* Omnibus Directive - lowest price from 30 days */
.omnibus-price-info {
    margin-top: 0.25rem;
}

.omnibus-price-info small {
    font-size: 0.75rem;
    color: #6c757d;
}

.product-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.product-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.product-stock {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

.product-stock.in-stock {
    background: #d4edda;
    color: #155724;
}

.product-stock.low-stock {
    background: #fff3cd;
    color: #856404;
}

.product-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.product-description {
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.product-description h2,
.product-description h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Row containing quantity selector and add to cart button */
.product-actions-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-add-to-cart {
    flex: 1;
    min-width: 200px;
    padding: 0 2rem;
    height: 48px;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--product-btn-color, var(--accent-color));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-add-to-cart i {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.btn-add-to-cart:hover:not(:disabled) {
    filter: brightness(0.85);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Quantity selector - theme-aware styling */
.quantity-selector {
    display: inline-flex;
    align-items: stretch;
    border: 2px solid var(--product-btn-color, var(--accent-color));
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    height: 48px;
}

.quantity-selector .btn {
    width: 44px;
    height: 100%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--product-btn-color, var(--accent-color));
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.quantity-selector .btn:hover {
    background: var(--product-btn-color, var(--accent-color));
    color: white;
}

.quantity-selector input[type="number"] {
    width: 56px;
    height: 100%;
    text-align: center;
    border: none;
    border-left: 1px solid rgba(0,0,0,0.1);
    border-right: 1px solid rgba(0,0,0,0.1);
    font-size: 1.1rem;
    font-weight: 600;
    -moz-appearance: textfield;
}

.quantity-selector input[type="number"]::-webkit-outer-spin-button,
.quantity-selector input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-selector input[type="number"]:focus {
    outline: none;
    background: #f8f9fa;
}

.product-tabs {
    margin-top: 3rem;
}

.product-tabs .nav-tabs {
    border-bottom: 2px solid #eee;
}

.product-tabs .nav-link {
    color: var(--text-color);
    font-weight: 600;
    padding: 1rem 1.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.product-tabs .nav-link:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.product-tabs .nav-link.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: transparent;
}

/* Product List / Shop */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.product-card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-card-image {
    transform: scale(1.05);
}

.product-card-body {
    padding: 1.5rem;
}

.product-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--heading-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-description {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.product-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #dc3545;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.product-card-badge.sale {
    background: #dc3545;
}

.product-card-badge.featured {
    background: var(--primary-color, #5d57f4);
}

.products-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.products-filters select {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item a {
    color: var(--accent-color);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--secondary-color);
}

/* Back to shop button - theme aware */
.btn-back-to-shop {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--product-btn-color, var(--accent-color));
    background: transparent;
    border: 2px solid var(--product-btn-color, var(--accent-color));
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-back-to-shop:hover {
    background: var(--product-btn-color, var(--accent-color));
    color: #fff;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .product-title {
        font-size: 1.8rem;
    }

    .product-price {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }

    .product-images {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
    }

    .product-main-image {
        max-height: 50vh;
    }

    .product-images:has(.product-thumbnails) .product-main-image {
        max-height: 45vh;
    }

    .product-actions-row {
        flex-direction: row;
        gap: 10px;
    }

    .product-actions-row .quantity-selector {
        width: auto;
        flex-shrink: 0;
        height: 44px;
        border-radius: 8px;
    }

    .product-actions-row .quantity-selector .btn {
        width: 36px;
    }

    .product-actions-row .quantity-selector input[type="number"] {
        width: 40px;
        font-size: 14px;
    }

    .product-actions-row .btn-add-to-cart {
        flex: 1;
        min-width: unset;
        padding: 0 16px;
        height: 44px;
        border-radius: 8px;
        font-size: 14px;
    }

    .product-actions-row .btn-add-to-cart i {
        margin-right: 6px !important;
    }
}
