/**
 * WooCommerce Custom Styles
 * 
 * @package MediaTronixs Ultra
 */

/* Product Gallery Styles */
.woocommerce-product-gallery {
    position: relative;
    margin-bottom: 2rem;
}

.woocommerce-product-gallery__wrapper {
    margin: 0;
    padding: 0;
}

.woocommerce-product-gallery__image {
    width: 100%;
    margin-bottom: 1rem;
}

.woocommerce-product-gallery__image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Flex slider fixes */
.flex-viewport {
    max-height: none !important;
}

.flex-control-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.flex-control-thumbs li {
    width: calc(25% - 0.375rem);
    cursor: pointer;
}

.flex-control-thumbs img {
    width: 100%;
    height: auto;
    border-radius: 0.25rem;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.flex-control-thumbs img:hover,
.flex-control-thumbs img.flex-active {
    border-color: #3b82f6;
}

/* Single Product Image */
.single-product .product-gallery img {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Fix Product Grid on Shop Page */
.products.grid .product-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.products.grid .product-item .relative.aspect-square {
    width: 100%;
    padding-bottom: 100%; /* Creates 1:1 aspect ratio */
    position: relative;
    overflow: hidden;
}

.products.grid .product-item .relative.aspect-square img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fix pinched product layout */
.products.grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .products.grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .products.grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .products.grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Product Card Improvements */
.product-item {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Mini Cart Dropdown Styles */
.mini-cart-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 20rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-height: 28rem;
    overflow-y: auto;
}

.mini-cart-dropdown.active {
    display: block;
}

.mini-cart-dropdown:hover {
    display: block;
}

/* WooCommerce Button Styles */
.woocommerce button.button,
.woocommerce a.button,
.woocommerce button.button.alt,
.woocommerce a.button.alt,
.woocommerce input.button,
.woocommerce input.button.alt,
.woocommerce #respond input#submit,
.woocommerce #respond input#submit.alt {
    background-color: #3b82f6;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    display: inline-block;
}

.woocommerce button.button:hover,
.woocommerce a.button:hover,
.woocommerce button.button.alt:hover,
.woocommerce a.button.alt:hover {
    background-color: #2563eb;
    color: white;
}

/* Add to Cart Button */
.single_add_to_cart_button,
.ajax_add_to_cart,
.add_to_cart_button {
    background-color: #10b981 !important;
    color: white !important;
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.single_add_to_cart_button:hover,
.ajax_add_to_cart:hover,
.add_to_cart_button:hover {
    background-color: #059669 !important;
}

.single_add_to_cart_button.loading,
.ajax_add_to_cart.loading,
.add_to_cart_button.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Quantity Input */
.quantity {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    overflow: hidden;
    width: fit-content;
}

.quantity input[type="number"] {
    width: 60px;
    text-align: center;
    border: none;
    padding: 0.5rem;
    -moz-appearance: textfield;
}

.quantity input[type="number"]::-webkit-outer-spin-button,
.quantity input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-minus,
.quantity-plus {
    background: #f3f4f6;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.quantity-minus:hover,
.quantity-plus:hover {
    background: #e5e7eb;
}

/* Breadcrumb Styles */
.woocommerce-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: #6b7280;
}

.woocommerce-breadcrumb a {
    color: #3b82f6;
    transition: color 0.2s;
}

.woocommerce-breadcrumb a:hover {
    color: #2563eb;
}

/* Product Meta */
.product_meta {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 2rem;
    font-size: 0.875rem;
}

.product_meta > span {
    display: block;
    margin-bottom: 0.5rem;
}

/* Tabs */
.woocommerce-tabs {
    margin-top: 3rem;
}

.woocommerce-tabs ul.tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin: 0;
    padding: 0;
    list-style: none;
}

.woocommerce-tabs ul.tabs li {
    margin: 0;
    padding: 0;
}

.woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 1rem 1.5rem;
    color: #6b7280;
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.woocommerce-tabs ul.tabs li.active a,
.woocommerce-tabs ul.tabs li a:hover {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.woocommerce-tabs .panel {
    padding: 2rem 0;
}

/* Messages and Notices */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.woocommerce-message {
    background: #10b981;
    color: white;
}

.woocommerce-info {
    background: #3b82f6;
    color: white;
}

.woocommerce-error {
    background: #ef4444;
    color: white;
}

/* Sale Badge */
.onsale {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
}

/* Loading Spinner */
.products-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}