/* Product detail page styles extracted from legacy inline CSS */
:root {
    --bs-primary: #d51920;
    --bs-primary-rgb: 213, 25, 32;
    --bs-primary-dark: #b6002c;
    --bs-link-color: #b6002c;
    --bs-link-hover-color: #d51920;
}

/* Remove tap highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Product image container */
.product-image-main {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    margin: 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Disable hover zoom for accessibility */
.product-image-main:hover img {
    transform: none;
}

/* Product thumbnails */
.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    flex-wrap: wrap;
}

.product-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.product-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 10px;
}

.product-thumbnail {
    width: 70px;
    height: 70px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-thumbnail.active {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px var(--bs-primary);
}

/* Rating stars */
.rating-stars {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.rating-stars .fa-star,
.rating-stars .fa-star-half-alt {
    font-size: 1.35rem;
    color: #ffc107 !important;
}

.rating-text {
    color: #888 !important;
    font-size: 0.875rem;
}

/* Price display */
.price-current {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-primary);
}

.price-original {
    font-size: 1.2rem;
    text-decoration: line-through;
    color: #6c757d;
}

.discount-badge {
    background-color: var(--bs-primary);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Breadcrumb links */
.breadcrumb-item a {
    color: var(--bs-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* Tabs */
.nav-tabs .nav-link.active {
    color: var(--bs-primary);
    border-color: var(--bs-primary) var(--bs-primary) #fff;
}

.nav-tabs .nav-link {
    color: #495057;
}

.nav-tabs .nav-link:hover {
    color: var(--bs-primary);
}

/* Reviews */
.review-item {
    border-bottom: 1px solid #dee2e6;
    padding: 1.5rem 0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.review-author {
    font-weight: 600;
    color: #495057;
}

.review-date {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Similar products */
.similar-product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.similar-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.similar-product-image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f8f9fa;
}

.similar-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile horizontal scroll for similar products */
@media (max-width: 767.98px) {
    #similarProductsContainer {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 0.75rem;
        padding: 0.25rem 0.25rem 0.5rem;
        margin: 0;
        scroll-snap-type: x mandatory;
    }
    #similarProductsContainer > .col {
        flex: 0 0 80%;
        max-width: 80%;
        scroll-snap-align: start;
    }
    #similarProductsContainer::-webkit-scrollbar {
        height: 6px;
    }
    #similarProductsContainer::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    #similarProductsContainer::-webkit-scrollbar-thumb {
        background: #d1d1d1;
        border-radius: 10px;
    }
}

/* Quantity controls (retained for JS parity) */
.quantity-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.quantity-controls button {
    border: none;
    background: #f8f9fa;
    color: #212529;
    font-size: 1.25rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quantity-controls button:hover {
    background: #e9ecef;
}

.quantity-controls input {
    width: 50px;
    border: none;
    text-align: center;
    font-weight: 600;
    padding: 0.5rem 0;
}

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

/* Mobile optimisations */
@media (max-width: 767.98px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .price-current {
        font-size: 1.5rem;
    }

    .product-thumbnails {
        gap: 0.25rem;
    }

    .product-thumbnail {
        width: 60px;
        height: 60px;
    }

    .btn {
        min-height: 48px;
        font-size: 0.9rem;
    }

    .quantity-controls {
        width: 100%;
        justify-content: center;
    }

    .quantity-controls input {
        width: 80px;
    }
}

/* Loading state */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

/* Error state */
.error-state {
    text-align: center;
    padding: 3rem 1rem;
}

.error-state i {
    font-size: 4rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Sticky add to cart */
@media (max-width: 767.98px) {
    .sticky-add-to-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #dee2e6;
        padding: 0.75rem;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    body.has-sticky-cart {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    #stickyAddToCart > .d-flex {
        justify-content: space-between;
        gap: 0.5rem;
        align-items: center;
    }

    #stickyAddToCart .flex-grow-1 {
        min-width: 0;
        overflow: hidden;
    }

    #stickyTitle {
        display: block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #stickyPrice {
        display: inline-block;
        max-width: 45vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
        font-size: 1rem;
    }

    #stickyAddToCartBtn {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.6rem 0.9rem;
        font-size: 0.95rem;
        max-width: 48vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    @media (max-width: 480px) {
        #stickyAddToCart > .d-flex {
            flex-direction: column;
            align-items: stretch;
        }
        #stickyPrice {
            max-width: 100%;
        }
        #stickyAddToCartBtn {
            max-width: 100%;
            width: 100%;
        }
    }
}

/* Zoom functionality (cursor adjustments only) */
.image-zoom-container {
    position: relative;
    overflow: hidden;
    cursor: default;
}

.image-zoom-container.zoomed {
    cursor: default;
}

.image-zoom-container img {
    transition: transform 0.3s ease;
    transform-origin: center;
}

/* Availability badge */
.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.availability-badge.in-stock {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.availability-badge.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.availability-badge.limited-stock {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Specification table */
.spec-table {
    width: 100%;
    margin-bottom: 1.5rem;
}

.spec-table th,
.spec-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.spec-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    width: 40%;
}

.spec-table tr:last-child th,
.spec-table tr:last-child td {
    border-bottom: none;
}

/* Tab content styling */
.tab-content .tab-pane {
    background: linear-gradient(to bottom, #ffffff, #fafafa);
    border: 1px solid #eee;
    padding: 2rem;
    border-radius: 0.8rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    margin-top: -1px;
    animation: fadeIn 0.4s ease-in-out;
    position: relative;
    overflow: hidden;
}

.tab-content .tab-pane::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--bs-primary), var(--bs-primary-dark));
    border-radius: 4px 4px 0 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-tabs {
    border-bottom: none;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: 0.8rem;
    padding: 0.9rem 1.8rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    letter-spacing: 0.02em;
}

.nav-tabs .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-primary-dark));
    border-color: transparent;
    box-shadow: 0 5px 15px rgba(213, 25, 32, 0.3);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
}

.nav-tabs .nav-link:hover:not(.active) {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

/* Product description rich text */
.product-description {
    margin-bottom: 2rem;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
    position: relative;
}

.product-description p {
    margin-bottom: 1.4rem;
    transition: color 0.2s ease;
}

.product-description p:hover {
    color: #000;
}

.product-description img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 0.8rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-description img:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-description a {
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    background: linear-gradient(to right, var(--bs-primary), var(--bs-primary));
    background-size: 0 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    padding-bottom: 2px;
}

.product-description a:hover {
    text-decoration: none;
    color: var(--bs-primary-dark);
    background-size: 100% 2px;
}

.product-description blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    border-left: 4px solid var(--bs-primary);
    border-radius: 0.5rem;
    font-style: italic;
    color: #495057;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    position: relative;
}

.product-description blockquote::before {
    content: "\"";
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 3rem;
    color: rgba(213, 25, 32, 0.1);
    font-family: Georgia, serif;
}

.product-description h2 {
    font-size: 1.9rem;
    margin: 2.5rem 0 1.2rem;
    padding-bottom: 0.7rem;
    border-bottom: 2px solid #f1f1f1;
    color: var(--bs-primary-dark);
    position: relative;
    font-weight: 700;
}

.product-description h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(to right, var(--bs-primary), transparent);
}

.product-description h3 {
    font-size: 1.6rem;
    margin: 2rem 0 1rem;
    color: #343a40;
    font-weight: 600;
    padding-left: 1rem;
    border-left: 3px solid var(--bs-primary);
}

.product-description ul,
.product-description ol {
    margin-left: 1.8rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.product-description ul li,
.product-description ol li {
    margin-bottom: 0.7rem;
    position: relative;
    padding-left: 0.5rem;
}

.product-description ul li::marker {
    color: var(--bs-primary);
}

.product-description table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-radius: 0.8rem;
    overflow: hidden;
}

.product-description table th {
    background: linear-gradient(to right, #f1f1f1, #f8f9fa);
    font-weight: 600;
    text-align: left;
    padding: 1.2rem;
    border: 1px solid #dee2e6;
    border-bottom: 2px solid #ddd;
}

.product-description table td {
    padding: 1.2rem;
    border: 1px solid #dee2e6;
    transition: background-color 0.2s ease;
}

.product-description table tr {
    transition: transform 0.2s ease;
}

.product-description table tr:hover {
    background-color: #f8f9fa;
    transform: translateX(3px);
}

.product-description table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.product-description strong,
.product-description b {
    color: #222;
    font-weight: 700;
}

.product-description em,
.product-description i {
    font-style: italic;
    color: #555;
}

.product-description code {
    background: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--bs-primary-dark);
    font-family: monospace;
}

.product-description hr {
    margin: 2rem 0;
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
}

.product-description .highlight {
    background: rgba(213, 25, 32, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    color: var(--bs-primary-dark);
}

/* Mobile tabs styling */
@media (max-width: 768px) {
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        scrollbar-width: thin;
    }

    .nav-tabs::-webkit-scrollbar {
        height: 5px;
    }

    .nav-tabs::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .nav-tabs::-webkit-scrollbar-thumb {
        background: #d1d1d1;
        border-radius: 10px;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
    }

    .tab-content .tab-pane {
        padding: 1.5rem;
    }
}

/* Image navigation arrows */
.image-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: none;
}

.image-nav-arrow:hover {
    background-color: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.prev-image {
    left: 10px;
}

.next-image {
    right: 10px;
}

@media (max-width: 768px) {
    .product-image-main {
        height: 300px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .product-image-main img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .product-thumbnails {
        justify-content: center;
    }

    .product-thumbnail {
        width: 60px;
        height: 60px;
    }

    .image-nav-arrow {
        display: none !important;
    }
}
