/**
 * Product Detail Page Styles for Nimje Medical
 * Optimized for smaller, more responsive design
 */

/* ======== GENERAL LAYOUT ======== */
.product-gallery {
    position: relative;
    margin-bottom: 1.5rem;
}

/* ======== GALLERY STYLES ======== */
#main-gallery {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#main-gallery .item {
    position: relative;
    height: 350px;
    background-color: #f8f9fa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-gallery .item img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

#main-gallery .owl-nav {
    margin-top: 0;
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#main-gallery .owl-nav button {
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.1);
}

#main-gallery .owl-nav button:hover {
    background-color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

#main-gallery .owl-nav button span {
    font-size: 1.25rem;
    line-height: 1;
    color: #495057;
}

#main-gallery .owl-nav .owl-prev {
    position: absolute;
    left: 12px;
}

#main-gallery .owl-nav .owl-next {
    position: absolute;
    right: 12px;
}

#main-gallery .owl-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

#thumb-gallery {
    margin-top: 12px;
}

#thumb-gallery .item {
    padding: 4px;
    cursor: pointer;
    position: relative;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

#thumb-gallery .item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

#thumb-gallery .active-thumb {
    border-color: #ff6f61;
    box-shadow: 0 2px 6px rgba(255, 111, 97, 0.2);
}

/* Video styling */
.video-thumbnail {
    position: relative;
}

.video-thumbnail::after {
    content: '\f4f9';
    font-family: 'Bootstrap Icons';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.video-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 0;
}

/* ======== PRODUCT INFORMATION ======== */
.product-info {
    padding: 0 0.25rem;
}

.product-info .h1, .product-info .h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.product-info .text-muted {
    font-size: 0.875rem;
}

/* Pricing section */
.pricing {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid #e9ecef;
}

.pricing .h3 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.pricing .text-muted {
    font-size: 0.8rem;
}

/* ======== VARIATION SWATCHES ======== */
.variations {
    margin-bottom: 1.25rem;
}

.variations .form-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.variation-swatch {
    min-width: 80px;
    height: auto;
    padding: 0.5rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
}

.variation-swatch:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.variation-swatch .variation-name {
    font-weight: 600;
}

.variation-swatch.active {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.variation-swatch:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ======== QUANTITY SELECTOR ======== */
.quantity-wrapper {
    max-width: 140px;
}

.quantity-input {
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    appearance: textfield;
    -moz-appearance: textfield;
    background-color: #fff;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background-color: #e9ecef;
}

#stock-message {
    font-size: 0.8rem;
}

/* ======== ADD TO CART SECTION ======== */
.add-to-cart-section {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem !important;
    margin-bottom: 1.25rem;
}

.add-to-cart-btn {
    border-radius: 0.375rem;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.add-to-cart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.add-to-wishlist-btn {
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
}

.add-to-wishlist-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.add-to-cart-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

/* ======== PRODUCT TABS ======== */
.card-header-tabs {
    margin-top: -0.25rem;
    border-bottom: none;
    padding: 0;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover:not(.active) {
    border-color: transparent;
    color: #ff6f61;
}

.nav-tabs .nav-link.active {
    color: #ff6f61;
    border-bottom-color: #ff6f61;
    background-color: transparent;
}

/* Tab content */
.tab-content {
    padding-top: 1rem;
}

.product-description {
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ======== REVIEW SYSTEM ======== */
.rating-display {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.rating-display .bi {
    color: #ffc107;
    margin-right: 2px;
    font-size: 1rem;
}

.rating-select {
    cursor: pointer;
}

.rating-select i {
    font-size: 1.25rem;
    margin-right: 5px;
    cursor: pointer;
}

.review-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #dee2e6;
}

.review-item:last-child {
    border-bottom: none;
}

.review-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ======== RELATED PRODUCTS ======== */
#related-products {
    margin-top: 0;
}

#related-products .owl-nav {
    position: absolute;
    top: -50px;
    right: 0;
}

#related-products .owl-nav button {
    width: 28px;
    height: 28px;
    border-radius: 50% !important;
    background-color: #f8f9fa !important;
    margin-left: 6px;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

#related-products .owl-nav button:hover {
    background-color: #ff6f61 !important;
    color: #fff !important;
    transform: scale(1.05);
}

#related-products .owl-dots {
    margin-top: 1rem;
}

/* Related products section header */
.related-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.related-products-header .h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0;
}

/* ======== STICKY GALLERY ======== */
.product-gallery.sticky-gallery {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 300px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    background-color: #fff;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.product-gallery.sticky-gallery #main-gallery .item {
    height: 250px;
}

.product-gallery.sticky-gallery #thumb-gallery {
    display: none;
}

/* Hide sticky gallery on mobile */
@media (max-width: 991.98px) {
    .product-gallery.sticky-gallery {
        display: none;
    }
}

/* ======== SHARE FUNCTIONALITY ======== */
.share-section {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.share-button {
    transition: all 0.3s ease;
}

.share-button:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.share-options {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.share-facebook:hover {
    background-color: #1877f2 !important;
    border-color: #1877f2 !important;
    color: white !important;
}

.share-twitter:hover {
    background-color: #1da1f2 !important;
    border-color: #1da1f2 !important;
    color: white !important;
}

.share-whatsapp:hover {
    background-color: #25d366 !important;
    border-color: #25d366 !important;
    color: white !important;
}

.share-copy:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

/* ======== ENHANCED GALLERY UI ======== */
.product-gallery img {
    transition: transform 0.3s ease;
}

.product-gallery img:hover {
    transform: scale(1.02);
}

/* Zoom modal enhancements */
#imageZoomModal .modal-content {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#imageZoomModal .modal-body {
    padding: 0;
    background-color: #000;
}

#imageZoomModal img {
    display: block;
    margin: 0 auto;
}

/* ======== RESPONSIVE STYLES ======== */
@media (max-width: 767.98px) {
    #main-gallery .item {
        height: 280px;
    }

    .product-info {
        padding: 0;
    }

    .product-info .h1, .product-info .h3 {
        font-size: 1.25rem;
    }

    .pricing {
        padding: 0.75rem 0.875rem;
    }

    .pricing .h3 {
        font-size: 1.5rem;
    }

    .variation-swatch {
        min-width: 32px;
        height: 32px;
        line-height: 26px;
        padding: 0.15rem 0.5rem;
        font-size: 0.8rem;
        margin-right: 0.375rem;
        margin-bottom: 0.375rem;
    }

    .quantity-wrapper {
        max-width: 100px;
    }

    .quantity-btn {
        width: 24px;
        height: 28px;
        font-size: 0.9rem;
    }

    .quantity-input {
        width: 30px;
        height: 28px;
        font-size: 0.85rem;
    }

    .nav-tabs .nav-link {
        padding: 0.75rem 0.75rem;
        font-size: 0.85rem;
    }

    .related-products-header .h4 {
        font-size: 1.1rem;
    }
}

@media (max-width: 575.98px) {
    #main-gallery .item {
        height: 240px;
    }

    #thumb-gallery .item {
        height: 50px;
    }

    .product-info .h1, .product-info .h3 {
        font-size: 1.1rem;
    }

    .variation-swatch {
        min-width: 28px;
        height: 28px;
        line-height: 22px;
        padding: 0.1rem 0.4rem;
        font-size: 0.75rem;
    }

    .add-to-cart-section {
        padding: 0.875rem !important;
    }

    .add-to-cart-btn {
        padding: 0.35rem 1rem;
        font-size: 0.85rem;
    }

    .nav-tabs .nav-link {
        padding: 0.625rem 0.625rem;
        font-size: 0.8rem;
    }

    .product-description {
        font-size: 0.9rem;
    }
}

/* ======== UTILITY CLASSES ======== */
.text-truncate-2 {
    display: -webkit-box;
        line-clamp: 2;
        -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
        line-clamp: 3;
        -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading states */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Focus states for accessibility */
.variation-swatch:focus,
.quantity-btn:focus,
.add-to-cart-btn:focus {
    outline: 2px solid #ff6f61;
    outline-offset: 2px;
}

/* Animation for price updates */
.price-update {
    animation: priceUpdate 0.3s ease-in-out;
}

@keyframes priceUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
