#product-page { padding-top: 14px !important; }

.product-price {
    margin-top: -47px !important;
}

/* Product Count Styling */
#productCount {
    text-align: center;
    margin: 20px 0;
}

#productCount span {
    font-size: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #000;
    font-weight: 400;
}

/* Custom Carousel Styles */
.product-image {
    padding: 12px;
}

#image { 
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#image a img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.image-skeleton {
    transition: opacity 0.3s ease-in-out;
    margin-bottom: 0;
}

.product-image {
    margin-bottom: 0 !important;
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

#image:hover .carousel-prev,
#image:hover .carousel-next {
    opacity: 1;
    visibility: visible;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

#image-thumbs {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#image-thumbs { padding-left: 0 !important; display:flex; gap:8px; margin-top:8px; }
#image-thumbs li { list-style:none; cursor:pointer; }
#image-thumbs img { width:100px; height:100px; object-fit:cover; }
#image-thumbs li.active img { outline:2px solid #333; }

/* Stock Display Styles */
.stock-display {
    display: block;
    padding: 15px;
    border-radius: 2px;
    text-align: center;
    font-weight: 600;
    margin-top: 10px;
}

.stock-icon {
    font-size: 1.2em;
    margin-bottom: 5px;
}

.stock-text {
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stock-subtitle {
    margin: 5px 0 0 0;
    font-size: 0.85em;
    opacity: 0.9;
}

/* Default State */
.stock-display.default {
    background-color: #6c757d;
    border: 2px solid #5a6268;
}

.stock-display.default .stock-text,
.stock-display.default .stock-icon,
.stock-display.default .stock-subtitle {
    color: #ffffff;
}

/* Sold Out State */
.stock-display.sold-out {
    background-color: #dc3545;
    border: 2px solid #bd2130;
}

.stock-display.sold-out .stock-text,
.stock-display.sold-out .stock-icon,
.stock-display.sold-out .stock-subtitle {
    color: #ffffff;
}

/* Critical Stock (≤5) */
.stock-display.critical {
    background-color: #ff6b35;
    border: 2px solid #e85d2a;
    animation: pulse 2s infinite;
}

.stock-display.critical .stock-text,
.stock-display.critical .stock-icon,
.stock-display.critical .stock-subtitle {
    color: #ffffff;
}

/* Low Stock (6-15) */
.stock-display.low {
    background-color: #ffd93d;
    border: 2px solid #f0c929;
}

.stock-display.low .stock-text,
.stock-display.low .stock-icon,
.stock-display.low .stock-subtitle {
    color: #2c3e50;
}

/* Available Stock (>15) */
.stock-display.available {
    background-color: #28a745;
    border: 2px solid #218838;
}

.stock-display.available .stock-text,
.stock-display.available .stock-icon,
.stock-display.available .stock-subtitle {
    color: #ffffff;
}

/* Pulse Animation for Critical Stock */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Category Filter Cards */
.category-card {
    border: 1px solid #e0e0e0;
    border-radius: 0;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.category-card:hover::before {
    left: 100%;
}

.category-card:hover {
    border-color: #333;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
}

.category-card.active {
    border-color: #000;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    background: linear-gradient(135deg, #222 0%, #000 100%);
    color: #fff;
}

.category-card.active h5 {
    color: #fff;
    letter-spacing: 2px;
}

.category-card-body h5 {
    margin: 0;
    font-weight: 600;
    letter-spacing: 1.5px;
    font-size: 0.9rem;
    color: #333;
    transition: all 0.4s ease;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Mobile Filter Styles */
#mobile-category-select {
    display: none;
    width: 100%;
    margin-bottom: 15px;
}

.mobile-category-container {
    position: relative;
}

.mobile-category-container .sort-by-button {
    width: 100%;
    justify-content: center;
}

.mobile-category-container .sort-popover {
    left: 0;
    right: auto;
    width: 100%;
}

/* Mobile Sort Container */
.mobile-sort-container {
    display: none;
    width: 100%;
    margin-bottom: 60px;
    position: relative;
    overflow: visible;
    z-index: 1001;
}

.mobile-sort-container .sort-by-button {
    width: 100%;
    justify-content: center;
}

.mobile-sort-container .sort-popover {
    left: 0;
    right: auto;
    width: 100%;
    max-height: none;
    overflow: visible;
    position: absolute;
    z-index: 10000000000;
}

@media (max-width: 991.98px) {
    /* Ensure parent containers don't clip the popover */
    .container-fluid,
    .row,
    .col-12 {
        overflow: visible !important;
    }
    
    /* Add extra padding to prevent clipping */
    .container-fluid.p-t-20.m-b-0 {
        padding-bottom: 250px !important;
        margin-bottom: -220px !important;
    }
    
    /* Hide desktop grid filter */
    #category-filters {
        display: none !important;
    }

    /* Show mobile dropdown */
    #mobile-category-select {
        display: block !important;
    }
    
    /* Show mobile sort */
    .mobile-sort-container {
        display: block !important;
    }
    
    /* Hide desktop sort */
    #desktop-sort-container {
        display: none !important;
    }

    /* Hide the "Filter by Category" title */
    #filters-title {
        display: none !important;
    }

    /* Show mobile filters title */
    #mobile-filters-title {
        display: block !important;
    }
}

@media (min-width: 992px) {
    /* Show desktop grid filter */
    #category-filters {
        display: flex !important;
        flex-wrap: wrap;
    }

    /* Hide mobile elements */
    #mobile-category-select {
        display: none !important;
    }
    
    .mobile-sort-container {
        display: none !important;
    }

    #mobile-filters-title {
        display: none !important;
    }

    #filters-title {
        display: block !important;
    }
}
/* Sort By Popover Styles - Halfsumo Inspired */
.sort-by-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: -12px;
}

.sort-by-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid #000;
    color: #000;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sort-by-button:hover {
    background-color: #000;
    color: #fff;
}

.sort-by-button:hover .sort-chevron {
    stroke: #fff;
}

.sort-by-button[aria-expanded="true"] {
    background-color: #000;
    color: #fff;
}

.sort-by-button[aria-expanded="true"] .sort-chevron {
    stroke: #fff;
    transform: rotate(180deg);
}

.sort-chevron {
    stroke: #000;
    transition: all 0.2s ease;
}

.sort-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #000;
    min-width: 220px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10000000000;
}

.sort-popover[hidden] {
    display: none;
}

.sort-popover-header {
    padding: 16px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #e5e5e5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sort-options {
    display: flex;
    flex-direction: column;
}

.sort-option {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    color: #000;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.sort-option span {
    position: relative;
    display: inline-block;
}

.sort-option:hover {
    background-color: #f5f5f5;
}

.sort-option.active {
    font-weight: 600;
}

.sort-option.active span::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #000;
}

@media (max-width: 768px) {
    .sort-by-container {
        width: 100%;
        justify-content: flex-start;
    }
    
    .sort-by-button {
        width: 100%;
        justify-content: center;
    }
    
    .sort-popover {
        right: auto;
        left: 0;
        width: 100%;
    }
}

/* Fix double-tap issue on mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .product .product-image:hover>a:nth-of-type(2) {
        opacity: 0;
        z-index: -1;
    }
    
    .product:hover .product-wishlist,
    .product:hover .product-wishlist a {
        opacity: 0;
        z-index: -1;
    }
}

/* Enable immediate tap on mobile */
.product a,
.grid-item a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    cursor: pointer;
}

.product,
.grid-item {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}
