/**
 * WooCommerce Product Grid Styles
 * Fully responsive design with automatic scaling
 */

/* Reset and Base */
* {
    box-sizing: border-box;
}

.wc-product-grid-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: clamp(10px, 2vw, 20px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
    position: relative;
}

.wc-product-grid-wrapper {
    position: relative;
    min-height: 200px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Filter Section */
.wc-product-grid-filter {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wc-product-grid-filter-toggle {
    display: none;
    width: 100%;
    padding: 12px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.wc-product-grid-filter-toggle:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.wc-product-grid-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    animation: fadeInDown 0.5s ease;
}

.wc-product-grid-filter-list.hidden {
    display: none;
}

.filter-btn {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.filter-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.filter-btn .count {
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.8;
}

/* Product Grid - Auto Responsive - Default 3 Columns */
.wc-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(15px, 2.5vw, 30px);
    animation: fadeIn 0.6s ease;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* If no data-columns attribute, default to 3 */
.wc-product-grid:not([data-columns]) {
    grid-template-columns: repeat(3, 1fr);
}

.wc-product-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.wc-product-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(10px, 1.5vw, 20px);
}

.wc-product-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.wc-product-grid-item {
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease backwards;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.wc-product-grid-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Product Card */
.product-inner {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
}

.product-inner:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
}

.product-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

.product-inner:hover .product-image {
    transform: scale(1.1);
}

.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    background: #ff4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

.product-badge.featured-badge {
    background: #ffa500;
}

[dir="rtl"] .product-badge {
    right: auto;
    left: 12px;
}

/* Wishlist Button */
.wishlist-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
    color: #666;
    opacity: 0;
    transform: scale(0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    text-decoration: none;
}

[dir="rtl"] .wishlist-btn {
    left: auto;
    right: 12px;
}

.product-image-wrapper:hover .wishlist-btn {
    opacity: 1;
    transform: scale(1);
}

.wishlist-btn:hover {
    background: #fff;
    color: #ff4444;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.wishlist-btn.active,
.wishlist-btn.added {
    background: #ff4444;
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

.product-image-wrapper:hover .wishlist-btn.active,
.product-image-wrapper:hover .wishlist-btn.added {
    opacity: 1;
    transform: scale(1);
}

.wishlist-btn.active:hover,
.wishlist-btn.added:hover {
    background: #ff6666;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 68, 68, 0.5);
}

.wishlist-btn svg {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wishlist-btn.active svg,
.wishlist-btn.added svg {
    fill: currentColor;
    stroke: currentColor;
}

.wishlist-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.wishlist-btn.loading svg {
    animation: spin 1s linear infinite;
}

.wishlist-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #333;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    z-index: 10;
    font-weight: 500;
}

.wishlist-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.wishlist-btn:hover .wishlist-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .wishlist-btn {
        width: 40px;
        height: 40px;
        top: 10px;
        left: 10px;
    }
    
    [dir="rtl"] .wishlist-btn {
        left: auto;
        right: 10px;
    }
    
    .wishlist-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Product Info */
.product-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.product-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #0073aa;
}

.product-price {
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 700;
    color: #000;
}

.product-price del {
    color: #999;
    font-size: 16px;
    font-weight: 400;
    margin-right: 8px;
}

/* Product Actions */
.product-actions {
    margin-top: auto;
    width: 100%;
    max-width: 100%;
}

.product-buttons-wrapper {
    display: flex;
    gap: clamp(8px, 1.2vw, 12px);
    position: relative;
    width: 100%;
    max-width: 100%;
}

.product-buttons-wrapper .button {
    flex: 1 1 0%;
    min-width: 0;
    position: relative;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.product-buttons-wrapper .add-to-cart-btn {
    transition: all 0.3s ease;
}

.product-buttons-wrapper .add-to-cart-btn:hover {
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    min-width: auto;
    flex: 1.2 1 0%;
}

.product-buttons-wrapper .buy-now-btn {
    transition: all 0.3s ease;
    flex: 1 1 0%;
}

.product-buttons-wrapper .buy-now-btn:hover {
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    min-width: auto;
}

.product-buttons-wrapper .add-to-cart-btn:hover ~ .buy-now-btn {
    flex: 0.8 1 0%;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: clamp(14px, 1.8vw, 16px) clamp(12px, 1.5vw, 16px);
    background: #000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: clamp(12px, 1.4vw, 14px);
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 44px;
}

.button:hover {
    background: #333;
    transform: scale(1.05);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.add-to-cart-btn.loading .btn-text,
.buy-now-btn.loading .btn-text {
    display: none;
}

.add-to-cart-btn.loading .btn-loader,
.buy-now-btn.loading .btn-loader {
    display: inline-block !important;
}

.add-to-cart-btn.success {
    background: #28a745;
}

.buy-now-btn {
    background: #000;
    font-weight: 700;
}

.select-options-btn,
.view-product-btn {
    background: #6c757d;
}

.out-of-stock-btn {
    background: #dc3545;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Loading & Empty States */
.wc-product-grid-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.wc-product-grid-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
}

/* Pagination - Professional Design */
.wc-product-grid-pagination {
    margin-top: 60px;
    text-align: center;
    padding: 40px 0;
    clear: both;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    background: #f8f9fa;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 12px 16px;
    margin: 60px auto 0;
    max-width: fit-content;
}

.wc-product-grid-pagination::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
}

.wc-product-grid-pagination .page-numbers {
    display: inline-flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.wc-product-grid-pagination .page-numbers li {
    display: inline-block;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wc-product-grid-pagination > .page-numbers,
.wc-product-grid-pagination .page-numbers a,
.wc-product-grid-pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    padding: 0 18px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    color: #333333;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    margin: 0 3px;
}

.wc-product-grid-pagination > .page-numbers::before,
.wc-product-grid-pagination .page-numbers a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 115, 170, 0.15) 0%, rgba(0, 115, 170, 0.05) 100%);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
    z-index: 0;
}

.wc-product-grid-pagination > .page-numbers:hover::before,
.wc-product-grid-pagination .page-numbers a:hover::before {
    width: 200px;
    height: 200px;
}

.wc-product-grid-pagination > .page-numbers:hover,
.wc-product-grid-pagination .page-numbers a:hover {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #ffffff;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 115, 170, 0.35);
    z-index: 2;
}

.wc-product-grid-pagination > .page-numbers.current,
.wc-product-grid-pagination .page-numbers.current {
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-weight: 700;
    position: relative;
    z-index: 1;
    transform: scale(1.08);
}

.wc-product-grid-pagination > .page-numbers.current::after,
.wc-product-grid-pagination .page-numbers.current::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 10px;
    pointer-events: none;
}

.wc-product-grid-pagination > .page-numbers.current::before,
.wc-product-grid-pagination .page-numbers.current::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, rgba(0, 115, 170, 0.3), rgba(0, 115, 170, 0.1));
    border-radius: 14px;
    z-index: -1;
    opacity: 0.6;
}

.wc-product-grid-pagination > .page-numbers.next,
.wc-product-grid-pagination > .page-numbers.prev,
.wc-product-grid-pagination .page-numbers.next,
.wc-product-grid-pagination .page-numbers.prev {
    font-weight: 700;
    font-size: 18px;
    min-width: 52px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
}

.wc-product-grid-pagination > .page-numbers.next:hover,
.wc-product-grid-pagination > .page-numbers.prev:hover,
.wc-product-grid-pagination .page-numbers.next:hover,
.wc-product-grid-pagination .page-numbers.prev:hover {
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
    border-color: #000000;
    color: #ffffff;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.wc-product-grid-pagination > .page-numbers.dots,
.wc-product-grid-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    color: #999;
    cursor: default;
    font-weight: 500;
    box-shadow: none;
    min-width: auto;
    padding: 0 8px;
}

.wc-product-grid-pagination > .page-numbers.dots:hover,
.wc-product-grid-pagination .page-numbers.dots:hover {
    background: transparent;
    border: none;
    transform: none;
    box-shadow: none;
    color: #999;
}

/* Notifications */
.wc-product-grid-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

[dir="rtl"] .wc-product-grid-notification {
    right: auto;
    left: 20px;
    transform: translateX(-400px);
}

.wc-product-grid-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design - Auto Scaling */
@media (max-width: 1400px) {
    .wc-product-grid-container {
        padding: clamp(10px, 1.5vw, 18px);
    }
    
    .wc-product-grid[data-columns="3"] {
        gap: clamp(10px, 1.2vw, 18px);
    }
}

@media (max-width: 1366px) {
    .wc-product-grid-container {
        padding: clamp(8px, 1.2vw, 15px);
    }
    
    .wc-product-grid[data-columns="3"] {
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(8px, 1vw, 15px);
    }
    
    .product-info {
        padding: 15px;
    }
    
    .button {
        font-size: clamp(11px, 1.3vw, 13px);
        padding: clamp(12px, 1.5vw, 14px) clamp(10px, 1.2vw, 12px);
    }
}

@media (max-width: 1280px) {
    .wc-product-grid-container {
        padding: clamp(6px, 1vw, 12px);
    }
    
    .wc-product-grid[data-columns="3"] {
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(6px, 0.8vw, 12px);
    }
    
    .product-info {
        padding: 12px;
    }
    
    .button {
        font-size: clamp(11px, 1.2vw, 12px);
        padding: clamp(12px, 1.4vw, 13px) clamp(8px, 1vw, 10px);
    }
}

@media (max-width: 1024px) {
    .wc-product-grid-container {
        padding: clamp(8px, 1.5vw, 15px);
    }
    
    .wc-product-grid[data-columns="3"] {
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(10px, 1.5vw, 15px);
    }
    
    .wc-product-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(10px, 1.5vw, 15px);
    }
}

@media (max-width: 992px) {
    .wc-product-grid-container {
        padding: clamp(8px, 1.2vw, 12px);
    }
    
    .wc-product-grid[data-columns="3"] {
        grid-template-columns: repeat(3, 1fr);
        gap: clamp(8px, 1.2vw, 12px);
    }
    
    .wc-product-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(8px, 1.2vw, 12px);
    }
}

@media (max-width: 768px) {
    .wc-product-grid-container {
        padding: clamp(8px, 1vw, 12px);
        overflow-x: hidden;
    }
    
    .wc-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(10px, 1.5vw, 15px);
    }
    
    .wc-product-grid[data-columns="3"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wc-product-grid-filter-toggle {
        display: block;
    }
    
    .wc-product-grid-filter-list {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .product-info {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .wc-product-grid-container {
        padding: clamp(6px, 0.8vw, 10px);
    }
    
    .wc-product-grid {
        grid-template-columns: 1fr;
        gap: clamp(8px, 1.2vw, 15px);
    }
    
    .product-buttons-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .product-buttons-wrapper .button {
        width: 100%;
        max-width: 100%;
    }
    
    .product-buttons-wrapper .add-to-cart-btn:hover {
        flex: 1;
    }
    
    .product-buttons-wrapper .add-to-cart-btn:hover ~ .buy-now-btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .wc-product-grid-container {
        padding: clamp(5px, 0.6vw, 8px);
    }
    
    .wc-product-grid {
        gap: clamp(6px, 1vw, 12px);
    }
    
    .product-info {
        padding: 12px;
    }
    
    .wc-product-grid-pagination {
        margin-top: 40px;
        padding: 30px 0;
    }
    
    .wc-product-grid-pagination .page-numbers {
        padding: 6px;
        gap: 4px;
    }
    
    .wc-product-grid-pagination .page-numbers a,
    .wc-product-grid-pagination .page-numbers span {
        min-width: 40px;
        height: 40px;
        padding: 0 12px;
        font-size: 14px;
        border-radius: 10px;
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body .wc-product-grid-container,
body .wc-product-grid-wrapper,
body .wc-product-grid {
    max-width: 100vw;
    overflow-x: hidden;
}










