/**
 * Avyra WooCommerce Styles
 *
 * @package Avyra
 */

/* Hide WooCommerce Price Filter Widget heading (already have custom heading) */
.widget_price_filter .widget-title,
.widget_price_filter > h2 {
    display: none !important;
}

/* Hide Price Filter accessibility labels */
.price_slider_wrapper .price_label .from::before,
.price_slider_wrapper .price_label .to::before {
    content: none !important;
}

/* Filter Drawer Styles */
#filter-drawer.translate-x-full {
    transform: translateX(100%);
}

#filter-overlay.opacity-0 {
    opacity: 0;
}

#filter-overlay.invisible {
    visibility: hidden;
}

/* Adjust for WordPress admin bar */
.admin-bar #filter-drawer {
    top: 46px;
    height: calc(100% - 46px);
}

.admin-bar #filter-overlay {
    top: 46px;
}

@media screen and (min-width: 783px) {
    .admin-bar #filter-drawer {
        top: 32px;
        height: calc(100% - 32px);
    }
    
    .admin-bar #filter-overlay {
        top: 32px;
    }
}

.filter-group-content {
    transition: max-height 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
}

.filter-group-content.open {
    max-height: 1000px;
}

.rotate-180 {
    transform: rotate(180deg);
}

/* Custom Scrollbar for Filters */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #d6d3d1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a29e;
}

/* Body states */
body.filter-open,
body.modal-open {
    overflow: hidden;
}

/* WooCommerce Ordering Select */
.woocommerce-ordering select {
    width: 100%;
    appearance: none;
    background-color: #fafaf9;
    border: 1px solid #e7e5e4;
    color: #44403c;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border-radius: 0.125rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.woocommerce-ordering select:focus {
    outline: none;
    border-color: #9F1239;
}

.woocommerce-ordering select:hover {
    background-color: #ffffff;
}

/* WooCommerce Pagination */
.woocommerce-pagination {
    display: flex;
    justify-content: center;
}

.woocommerce-pagination ul.page-numbers {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #e7e5e4;
    color: #57534e;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.woocommerce-pagination .page-numbers:hover {
    color: #292524;
    border-color: #292524;
}

.woocommerce-pagination .page-numbers.current {
    background-color: #292524;
    color: #ffffff;
    border-color: #292524;
    font-weight: 700;
}

.woocommerce-pagination .page-numbers.prev,
.woocommerce-pagination .page-numbers.next {
    color: #a8a29e;
}

.woocommerce-pagination .page-numbers.prev:hover,
.woocommerce-pagination .page-numbers.next:hover {
    color: #292524;
    border-color: #292524;
}

.woocommerce-pagination .page-numbers.dots {
    border: none;
    color: #a8a29e;
    pointer-events: none;
}

.woocommerce-pagination .page-numbers.dots {
    border: none;
    color: #a8a29e;
}

/* WooCommerce Price Filter Widget */
.widget_price_filter .price_slider_wrapper {
    padding-top: 1rem;
}

.widget_price_filter .ui-slider {
    position: relative;
    height: 4px;
    background: #e7e5e4;
    border-radius: 2px;
    margin-bottom: 1rem;
}

.widget_price_filter .ui-slider .ui-slider-range {
    position: absolute;
    height: 100%;
    background: #9F1239;
    border-radius: 2px;
}

.widget_price_filter .ui-slider .ui-slider-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #9F1239;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    top: -6px;
    margin-left: -8px;
    box-shadow: 0 0 0 1px #e7e5e4;
}

.widget_price_filter .price_slider_amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #57534e;
}

.widget_price_filter .price_slider_amount .price_label {
    display: flex;
    gap: 0.5rem;
}

.widget_price_filter .price_slider_amount button {
    display: none;
}

/* AJAX Loading States */
.avyra-products-loading {
    position: relative;
    min-height: 200px;
}

.avyra-products-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.avyra-products-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #e7e5e4;
    border-top-color: #9F1239;
    border-radius: 50%;
    animation: avyra-spin 0.8s linear infinite;
    z-index: 11;
}

@keyframes avyra-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Smooth transitions for product grid */
.avyra-product-grid {
    transition: opacity 0.3s ease;
}

.avyra-product-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* WooCommerce Breadcrumb */
.woocommerce-breadcrumb {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 300;
    color: #78716c;
}

.woocommerce-breadcrumb a {
    color: #78716c;
    transition: color 0.2s;
}

.woocommerce-breadcrumb a:hover {
    color: #9F1239;
}

/* Quick View Modal Quantity Input */
.avyra-qty-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

.avyra-qty-input::-webkit-outer-spin-button,
.avyra-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Product Card Hover Effects */
.woocommerce ul.products li.product .avyra-quickview-btn,
.woocommerce ul.products li.product .avyra-wishlist-btn,
.woocommerce ul.products li.product .avyra-compare-btn {
    opacity: 0;
    transform: translateY(0.5rem);
    transition: all 0.3s ease;
}

.woocommerce ul.products li.product:hover .avyra-quickview-btn,
.woocommerce ul.products li.product:hover .avyra-wishlist-btn,
.woocommerce ul.products li.product:hover .avyra-compare-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Product Price Styling - Match Design */
.woocommerce ul.products li.product .price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.woocommerce ul.products li.product .price del {
    font-size: 0.75rem;
    color: #a8a29e;
    text-decoration: line-through;
    order: 2;
}

.woocommerce ul.products li.product .price ins {
    font-size: 0.875rem;
    font-weight: 700;
    color: #9F1239;
    text-decoration: none;
    order: 1;
}

.woocommerce ul.products li.product .price > .amount {
    font-size: 0.875rem;
    font-weight: 700;
    color: #292524;
}

/* Product Title Styling */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-family: 'Lora', serif;
    font-size: 1.125rem;
    font-weight: 500;
    color: #292524;
    transition: color 0.2s;
}

.woocommerce ul.products li.product:hover .woocommerce-loop-product__title {
    color: #9F1239;
}

/* Product Image Container */
.woocommerce ul.products li.product .attachment-woocommerce_thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Color Filter Active State */
.avyra-color-filter.active,
.avyra-color-filter-mobile.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #9F1239;
}

/* Sale Badge Animation */
@keyframes pulse-badge {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.product .onsale {
    animation: pulse-badge 2s ease-in-out infinite;
}

/* Loading Spinner */
.avyra-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e7e5e4;
    border-radius: 50%;
    border-top-color: #9F1239;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* AJAX Add to Cart Button States */
.add_to_cart_button.loading {
    opacity: 0.7;
    pointer-events: none;
}

.add_to_cart_button.added {
    background-color: #16a34a !important;
}

/* WooCommerce Messages */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.125rem;
    font-size: 0.875rem;
}

.woocommerce-message {
    background-color: #f0fdf4;
    border-left: 4px solid #16a34a;
    color: #166534;
}

.woocommerce-info {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.woocommerce-error {
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

/* No Products Found */
.woocommerce-no-products-found {
    text-align: center;
    padding: 4rem 2rem;
}

.woocommerce-no-products-found .woocommerce-info {
    display: inline-block;
    background: none;
    border: none;
    color: #78716c;
    font-size: 1rem;
}


/* ========================================
   SINGLE PRODUCT PAGE STYLES
   ======================================== */

/* Product Gallery Thumbnails */
.avyra-thumb {
    transition: all 0.2s ease;
}

.avyra-thumb.active {
    border-color: #9F1239 !important;
    opacity: 1 !important;
}

.avyra-thumb:not(.active):hover {
    opacity: 1;
}

/* Hide scrollbar for thumbnails on mobile */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Snap scroll for mobile thumbnails */
.snap-x-mandatory {
    scroll-snap-type: x mandatory;
}

.snap-center {
    scroll-snap-align: center;
}

/* Product Tabs */
.avyra-tab-btn {
    position: relative;
    border-bottom: 2px solid transparent;
}

.avyra-tab-btn.tab-active {
    border-bottom-color: #9F1239;
    color: #9F1239;
    font-weight: 700;
}

.avyra-tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quantity Input Styling */
.avyra-qty-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

.avyra-qty-input::-webkit-outer-spin-button,
.avyra-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Mobile Sticky Cart Bar */
#sticky-cart-bar {
    transform: translateY(100%) !important;
    transition: transform 0.3s ease-in-out;
}

#sticky-cart-bar.visible {
    transform: translateY(0) !important;
}

/* Adjust for WordPress admin bar - no adjustment needed as bar is at bottom */

/* Variable Product Variations */
.variations {
    width: 100%;
    margin-bottom: 1.5rem;
}

.variations tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.variations .label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #292524;
    margin-bottom: 0.5rem;
}

.variations .label label {
    font-weight: 700;
}

.variations .value select {
    width: 100%;
    appearance: none;
    background-color: #fafaf9;
    border: 1px solid #e7e5e4;
    color: #44403c;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-radius: 0.125rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.variations .value select:focus {
    outline: none;
    border-color: #9F1239;
}

.variations .reset_variations {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9F1239;
    text-decoration: underline;
}

.variations .reset_variations:hover {
    text-decoration: none;
}

/* Single Variation Wrap */
.single_variation_wrap {
    margin-top: 1rem;
}

.single_variation_wrap .woocommerce-variation-price {
    margin-bottom: 1rem;
}

.single_variation_wrap .woocommerce-variation-price .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #9F1239;
}

.single_variation_wrap .woocommerce-variation-availability {
    margin-bottom: 1rem;
}

.single_variation_wrap .stock {
    font-size: 0.875rem;
}

.single_variation_wrap .in-stock {
    color: #16a34a;
}

.single_variation_wrap .out-of-stock {
    color: #dc2626;
}

/* Variation Add to Cart */
.woocommerce-variation-add-to-cart {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.woocommerce-variation-add-to-cart .quantity {
    display: flex;
    align-items: center;
    border: 1px solid #d6d3d1;
    border-radius: 0.125rem;
    height: 3rem;
    width: 8rem;
    background: white;
}

.woocommerce-variation-add-to-cart .quantity input {
    width: 100%;
    height: 100%;
    text-align: center;
    border: none;
    outline: none;
    font-weight: 700;
    color: #292524;
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
}

.woocommerce-variation-add-to-cart .quantity input::-webkit-outer-spin-button,
.woocommerce-variation-add-to-cart .quantity input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button {
    flex: 1;
    background-color: #292524;
    color: white;
    height: 3rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button:hover {
    background-color: #9F1239;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button:active {
    transform: scale(0.95);
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button.disabled,
.woocommerce-variation-add-to-cart .single_add_to_cart_button:disabled {
    background-color: #a8a29e;
    cursor: not-allowed;
    box-shadow: none;
}

/* Reviews Section */
#tab-reviews .woocommerce-Reviews {
    padding: 0;
}

#tab-reviews .woocommerce-Reviews-title {
    font-family: 'Lora', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #292524;
    margin-bottom: 1.5rem;
}

#tab-reviews .commentlist {
    list-style: none;
    padding: 0;
    margin: 0;
}

#tab-reviews .commentlist li {
    padding: 1.5rem 0;
    border-bottom: 1px solid #f5f5f4;
}

#tab-reviews .commentlist li:last-child {
    border-bottom: none;
}

#tab-reviews .comment_container {
    display: flex;
    gap: 1rem;
}

#tab-reviews .comment_container img.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

#tab-reviews .comment-text {
    flex: 1;
}

#tab-reviews .star-rating {
    display: flex;
    margin-bottom: 0.5rem;
}

#tab-reviews .woocommerce-review__author {
    font-weight: 700;
    color: #292524;
}

#tab-reviews .woocommerce-review__dash {
    display: none;
}

#tab-reviews .woocommerce-review__published-date {
    font-size: 0.75rem;
    color: #a8a29e;
    display: block;
    margin-top: 0.25rem;
}

#tab-reviews .description p {
    margin-top: 0.75rem;
    color: #57534e;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Review Form */
#tab-reviews #review_form_wrapper {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e7e5e4;
}

#tab-reviews .comment-reply-title {
    font-family: 'Lora', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #292524;
    margin-bottom: 1rem;
}

#tab-reviews .comment-form-rating {
    margin-bottom: 1rem;
}

#tab-reviews .comment-form-rating label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#tab-reviews .comment-form-comment textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e7e5e4;
    border-radius: 0.125rem;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 120px;
}

#tab-reviews .comment-form-comment textarea:focus {
    outline: none;
    border-color: #9F1239;
}

#tab-reviews .form-submit input[type="submit"] {
    background-color: #292524;
    color: white;
    padding: 0.75rem 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

#tab-reviews .form-submit input[type="submit"]:hover {
    background-color: #9F1239;
}

/* Star Rating Display */
.star-rating {
    font-size: 0.875rem;
    line-height: 1;
    color: #eab308;
}

.star-rating::before {
    content: '★★★★★';
    letter-spacing: 2px;
    background: linear-gradient(90deg, #eab308 var(--rating), #d6d3d1 var(--rating));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* Custom Price Range Slider - Match WooCommerce style */
.price-range-slider {
    position: relative;
    height: 4px;
    background: #e7e5e4;
    border-radius: 2px;
    margin: 20px 0;
}

.price-range-track {
    position: absolute;
    height: 100%;
    background: #9F1239;
    border-radius: 2px;
}

.price-range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    top: 0;
    left: 0;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #9F1239;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 0 1px #e7e5e4;
    transition: transform 0.15s ease;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.price-range-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #9F1239;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 0 1px #e7e5e4;
}

.price-slider-container {
    padding: 10px 5px;
}

/* Price slider amount text */
.avyra-price-filter-custom .price_slider_amount,
.avyra-price-filter-custom-mobile .price_slider_amount {
    text-align: left;
}

/* Search Filter Drawer Styles */
#search-filter-drawer.translate-x-full {
    transform: translateX(100%);
}

#search-filter-overlay.opacity-0 {
    opacity: 0;
}

#search-filter-overlay.invisible {
    visibility: hidden;
}

.admin-bar #search-filter-drawer {
    top: 46px;
    height: calc(100% - 46px);
}

.admin-bar #search-filter-overlay {
    top: 46px;
}

@media screen and (min-width: 783px) {
    .admin-bar #search-filter-drawer {
        top: 32px;
        height: calc(100% - 32px);
    }
    
    .admin-bar #search-filter-overlay {
        top: 32px;
    }
}
