/**
 * Ultra-Modern & Compact Frontend CSS for Elementor WooCommerce Products Table
 * Enhanced RTL support, glassmorphism effects, and micro-interactions
 * Optimized for performance and accessibility
 */

/* Enhanced CSS Variables */
:root {
    --ewpt-primary: #6366f1;
    --ewpt-primary-dark: #4f46e5;
    --ewpt-primary-light: #a5b4fc;
    --ewpt-secondary: #8b5cf6;
    --ewpt-accent: #06b6d4;
    --ewpt-success: #10b981;
    --ewpt-warning: #f59e0b;
    --ewpt-danger: #ef4444;
    --ewpt-dark: #1f2937;
    --ewpt-gray: #6b7280;
    --ewpt-light: #f9fafb;
    --ewpt-white: #ffffff;
    --ewpt-glass-bg: rgba(255, 255, 255, 0.95);
    --ewpt-glass-border: rgba(255, 255, 255, 0.2);
    --ewpt-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ewpt-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ewpt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ewpt-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --ewpt-border-radius: 12px;
    --ewpt-border-radius-sm: 8px;
    --ewpt-border-radius-lg: 16px;
    --ewpt-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ewpt-transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ewpt-backdrop-blur: blur(12px);
    --ewpt-spacing-xs: 4px;
    --ewpt-spacing-sm: 8px;
    --ewpt-spacing-md: 12px;
    --ewpt-spacing-lg: 16px;
    --ewpt-spacing-xl: 24px;
    --ewpt-mobile-breakpoint: 768px; /* Added mobile breakpoint variable */
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --ewpt-dark: #f9fafb;
        --ewpt-gray: #d1d5db;
        --ewpt-light: #111827;
        --ewpt-white: #1f2937;
        --ewpt-glass-bg: rgba(31, 41, 55, 0.95);
        --ewpt-glass-border: rgba(255, 255, 255, 0.1);
    }
}

/* Enhanced RTL Support */
.ewpt-products-table-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: var(--ewpt-spacing-xl) 0;
    background: var(--ewpt-glass-bg);
    border-radius: var(--ewpt-border-radius-lg);
    padding: var(--ewpt-spacing-xl);
    box-shadow: var(--ewpt-shadow-lg);
    backdrop-filter: var(--ewpt-backdrop-blur);
    border: 1px solid var(--ewpt-glass-border);
    position: relative;
    overflow: hidden;
}

.ewpt-products-table-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
    rgba(99, 102, 241, 0.03) 0%,
    rgba(139, 92, 246, 0.03) 100%);
    pointer-events: none;
}

/* Enhanced RTL Support */
[dir="rtl"] .ewpt-products-table-wrapper,
.ewpt-products-table-wrapper[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .ewpt-table th,
[dir="rtl"] .ewpt-table td,
.ewpt-table[dir="rtl"] th,
.ewpt-table[dir="rtl"] td {
    text-align: right;
}

[dir="rtl"] .ewpt-search-wrapper,
.ewpt-search-wrapper[dir="rtl"] {
    justify-content: flex-end;
}

[dir="rtl"] .ewpt-add-to-cart,
.ewpt-add-to-cart[dir="rtl"] {
    flex-direction: row-reverse;
}

[dir="rtl"] .ewpt-pagination-wrapper,
.ewpt-pagination-wrapper[dir="rtl"] {
    flex-direction: row-reverse;
}

[dir="rtl"] .ewpt-page-link,
[dir="rtl"] .ewpt-pagination-wrapper .ewpt-current,
.ewpt-page-link[dir="rtl"],
.ewpt-pagination-wrapper[dir="rtl"] .ewpt-current {
    direction: rtl;
}

[dir="rtl"] .ewpt-notification,
.ewpt-notification[dir="rtl"] {
    right: auto;
    left: 20px;
}

/* Filters Wrapper */
.ewpt-filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

/* Search Wrapper */
.ewpt-search-wrapper {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.ewpt-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: var(--ewpt-transition);
    background: var(--ewpt-white);
    color: var(--ewpt-dark);
}

.ewpt-search-input:focus {
    outline: none;
    border-color: var(--ewpt-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ewpt-search-input::placeholder {
    color: var(--ewpt-gray);
    font-weight: 400;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ewpt-filters-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ewpt-search-wrapper {
        max-width: 100%;
    }
}

/* Ultra-Modern Table Container */
.ewpt-table-container {
    border-radius: var(--ewpt-border-radius);
    overflow: hidden;
    background: var(--ewpt-white);
    transition: var(--ewpt-transition-slow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
}

.ewpt-table-container:hover {
    transform: translateY(-2px);
}

/* Enhanced Loading Animation */
.ewpt-table-wrapper.ewpt-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
    backdrop-filter: blur(4px);
    border-radius: var(--ewpt-border-radius-lg);
}

.ewpt-table-wrapper.ewpt-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--ewpt-primary);
    border-radius: 50%;
    animation: ewpt-spin 0.6s linear infinite;
    z-index: 11;
}

/* Persian Table Design */
.ewpt-table-wrapper {
    /*outline: 2px solid #efefef !important;*/
    border: 2px solid #efefef !important;
    border-radius: 12px;
    overflow: hidden;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

.ewpt-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
    height: 100% !important;
    font-weight: 400;
    border: 1px solid #c6ceda !important;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin-block-end: 0 !important;
    outline-color: transparent !important;
}

.ewpt-table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    text-align: center;
    padding: 12px 10px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    white-space: nowrap;
    position: relative;
    transition: all 0.3s ease;
}

.ewpt-table th:first-child {
    border-top-right-radius: 12px;
}

.ewpt-table th:last-child {
    border-top-left-radius: 12px;
}

.ewpt-table td {
    padding: 10px 8px;
    border: 1px solid #e0e0e0;
    vertical-align: middle;
    transition: all 0.3s ease;
    position: relative;
    text-align: right;
}

.ewpt-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.ewpt-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.ewpt-table tbody tr:last-child td {
    border-bottom: 1px solid #e0e0e0;
}

.ewpt-table tbody tr {
    transition: all 0.3s ease;
}

.ewpt-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.ewpt-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Table row base styles */
.ewpt-table tbody tr {
    position: relative;
    transition: all 0.2s ease-in-out;
    background-color: transparent !important; /* Reset any background */
}

/* Table row hover effect */
.ewpt-table tbody tr:hover {
    background: var(--table-row-hover-bg, rgba(0, 0, 0, 0.02)) !important;
}

/* Ensure hover works on all cells */
.ewpt-table tbody tr td {
    position: relative;
    background: inherit !important; /* Inherit from row */
    transition: inherit;
}

/* Reset any conflicting backgrounds */
.ewpt-table tbody tr:nth-child(odd) {
    background-color: transparent !important;
}

/* Add a pseudo-element for better hover handling */
.ewpt-table tbody tr::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: -1;
    transition: inherit;
}

.ewpt-table tbody tr:hover::after {
    background: var(--table-row-hover-bg, rgba(0, 0, 0, 0.02));
}

/* Enhanced Sortable Headers */
.ewpt-table th.ewpt-sortable {
    cursor: pointer;
    user-select: none;
}

.ewpt-table th.ewpt-sortable:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    transform: translateY(-1px);
}

.ewpt-table th.ewpt-sortable::after {
    content: '⇅';
    margin-left: var(--ewpt-spacing-xs);
    opacity: 0.4;
    transition: var(--ewpt-transition);
    font-size: 10px;
}

.ewpt-table th.ewpt-sortable:hover::after {
    opacity: 0.7;
}

.ewpt-table th.ewpt-sortable[data-order="asc"]::after {
    content: '↑';
    opacity: 1;
    color: var(--ewpt-primary);
    transform: scale(1.1);
}

.ewpt-table th.ewpt-sortable[data-order="desc"]::after {
    content: '↓';
    opacity: 1;
    color: var(--ewpt-primary);
    transform: scale(1.1);
}

/* Persian Product Cells */
.ewpt-image-cell {
    width: 70px;
    padding: 8px !important;
    text-align: center;
}

.ewpt-product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ewpt-product-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-color: #3498db;
}

.ewpt-product-title {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.6em;
    line-height: 1.3;
    text-align: right;
    word-break: break-word;
    hyphens: auto;
}

.ewpt-product-title:hover {
    color: #3498db;
    transform: translateX(-2px);
}

[dir="rtl"] .ewpt-product-title:hover {
    transform: translateX(2px);
}

.ewpt-product-meta {
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 2px;
    font-weight: 400;
    text-align: right;
}

/* Persian Price Display */
.ewpt-price-cell .price {
    font-size: 14px;
    font-weight: 700;
    color: #27ae60;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    direction: ltr;
}

.ewpt-price-cell .price del {
    color: #95a5a6;
    font-size: 12px;
    font-weight: 400;
    text-decoration: line-through;
    opacity: 0.8;
}

.ewpt-price-cell .price ins {
    text-decoration: none;
    color: #e74c3c;
    font-weight: 700;
    position: relative;
}

.ewpt-price-cell .price ins::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ewpt-danger), transparent);
    border-radius: 1px;
    opacity: 0.3;
}

/* Persian Stock Status */
.ewpt-stock .stock-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: center;
}

.stock-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: ewpt-pulse 2s infinite;
}

.stock-status.instock {
    background: #27ae60;
}

.stock-status.outofstock {
    background: #e74c3c;
}

/* Stock Status Chips */
.ewpt-stock-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ewpt-stock-chip.ewpt-stock-instock {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.ewpt-stock-chip.ewpt-stock-outofstock {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.ewpt-stock-chip.ewpt-stock-onbackorder {
    background-color: #fff8e1;
    color: #ff8f00;
    border: 1px solid #ffe082;
}

.ewpt-stock-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.ewpt-stock-chip i {
    margin-right: 4px;
    font-size: 14px;
}

/* Enhanced Action Cell */
.ewpt-action {
    min-width: 140px;
}

.ewpt-add-to-cart {
    display: flex;
    align-items: center;
    gap: var(--ewpt-spacing-sm);
}

.ewpt-quantity {
    width: 50px !important;
    padding: 6px !important;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px !important;
    border: 1px solid #bdc3c7;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #2c3e50;
}

.ewpt-quantity:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #ffffff;
    transform: scale(1.02);
}

.ewpt-add-to-cart-btn {
    /* WordPress Dashicon cart styles */
    background: var(--e-global-color-primary, #3498db);
    color: white;
    border: none;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin-left: 10px;
    text-align: center;
}

.ewpt-add-to-cart-btn:before {
    line-height: 1;
    vertical-align: middle;
}

.ewpt-add-to-cart-btn:hover:not(:disabled) {
    background: var(--e-global-color-secondary, #2980b9);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.ewpt-add-to-cart-btn:active {
    transform: scale(0.95);
}

.ewpt-add-to-cart-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

/* Loading state animation */
.ewpt-add-to-cart-btn.ewpt-loading-spin {
    background-color: #f39c12;
}

.ewpt-add-to-cart-btn.ewpt-loading-spin:before {
    animation: ewpt-spin 1s linear infinite;
}

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

/* Success state styling */
.ewpt-add-to-cart-btn.ewpt-success-icon {
    background-color: #27ae60;
}

.ewpt-add-to-cart-btn.ewpt-success-icon:before {
    animation: ewpt-pulse 0.5s ease-in-out;
}

@keyframes ewpt-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Modern Pagination */
.ewpt-pagination {
    margin: 20px 0;
    text-align: center;
}

.ewpt-pagination-wrapper {
    display: inline-flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
}

.ewpt-pagination-wrapper a {
    padding: 8px 15px;
    margin: 0 2px;
    background: var(--pagination-bg, transparent);
    color: var(--pagination-color, #3498db);
    text-decoration: none;
    border: 1px solid var(--pagination-border, #e0e0e0);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    height: 40px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
}

/* Active/Current Page */
.ewpt-pagination-wrapper .ewpt-current,
.ewpt-pagination-wrapper .ewpt-current:hover {
    /* These will be overridden by inline styles from Elementor */
    background-color: var(--e-global-color-primary, #3498db) !important;
    color: #ffffff !important;
    border-color: var(--e-global-color-primary, #3498db) !important;
    font-weight: 600;
    cursor: default;
    transform: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
    padding: 8px 15px !important; /* Ensure consistent padding */
    margin: 0 2px !important; /* Ensure consistent margin */
    min-width: 40px !important; /* Match other buttons */
    height: 40px !important; /* Match other buttons */
}

/* Hover State - Only for non-active buttons */
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper a:not(.ewpt-current):hover,
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper a:not(.ewpt-current):focus {
    /* These will be overridden by Elementor controls */
    background-color: var(--pagination-bg-hover, rgba(0, 0, 0, 0.05)) !important;
    color: var(--pagination-color-hover, var(--e-global-color-primary, #3498db)) !important;
    border-color: var(--pagination-border-hover, var(--e-global-color-primary, #3498db)) !important;
    transform: translateY(-1px);
    z-index: 2;
    position: relative;
    opacity: 1 !important;
}

/* Ensure active state always wins */
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-current {
    pointer-events: none;
    /* Force these styles to prevent any hover state interference */
    background-color: var(--pagination-bg-active, var(--e-global-color-primary, #3498db)) !important;
    color: var(--pagination-color-active, #ffffff) !important;
    border-color: var(--pagination-border-active, var(--e-global-color-primary, #3498db)) !important;
    opacity: 1 !important;
}

/* Force override any conflicting styles */
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-current,
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-current:hover {
    background-color: var(--e-global-color-primary, #3498db) !important;
    color: #ffffff !important;
    border-color: var(--e-global-color-primary, #3498db) !important;
    opacity: 1 !important;
}

/* Disabled State */
.ewpt-pagination-wrapper a.ewpt-disabled,
.ewpt-pagination-wrapper a.ewpt-disabled:hover {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    background: transparent !important;
}

/* Navigation Arrows */
.ewpt-prev,
.ewpt-next {
    min-width: 40px !important;
    padding: 8px 12px !important;
    margin: 0 2px !important;
    height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all var(--pagination-transition, 200ms) ease !important;
}

/* Hover state for navigation arrows */
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-prev:not(.disabled):hover,
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-next:not(.disabled):hover,
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-prev:not(.disabled):focus,
.elementor-widget-ewpt-products-table .ewpt-pagination-wrapper .ewpt-next:not(.disabled):focus {
    background-color: var(--pagination-bg-hover, rgba(0, 0, 0, 0.05)) !important;
    border-color: var(--pagination-border-hover, var(--e-global-color-primary, #3498db)) !important;
    color: var(--pagination-color-hover, var(--e-global-color-primary, #3498db)) !important;
    transform: translateY(-1px);
    z-index: 2;
    position: relative;
    opacity: 1 !important;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .ewpt-pagination-wrapper {
        gap: 4px;
    }
    
    .ewpt-pagination-wrapper a {
        min-width: 32px;
        min-height: 32px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .ewpt-pagination-wrapper {
        gap: 4px;
    }
    
    .ewpt-pagination-wrapper a {
        min-width: 32px;
        min-height: 32px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Enhanced Notifications */
.ewpt-notification {
    position: fixed;
    top: 40px;
    right: 20px;
    padding: var(--ewpt-spacing-lg) var(--ewpt-spacing-xl);
    border-radius: var(--ewpt-border-radius);
    color: var(--ewpt-white);
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    animation: ewpt-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--ewpt-shadow-xl);
    backdrop-filter: var(--ewpt-backdrop-blur);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 300px;
}

.ewpt-notification.ewpt-success {
    background: linear-gradient(135deg, var(--ewpt-success), #059669);
}

.ewpt-notification.ewpt-error {
    background: linear-gradient(135deg, var(--ewpt-danger), #dc2626);
}

/* Enhanced Animations */
@keyframes ewpt-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes ewpt-slide-in {
    from {
        transform: translateX(110%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes ewpt-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .ewpt-products-table-wrapper {
        padding: var(--ewpt-spacing-lg);
        margin: var(--ewpt-spacing-lg) 0;
    }

    .ewpt-table th,
    .ewpt-table td {
        padding: 8px 6px;
        font-size: 11px;
    }

    .ewpt-image-cell {
        width: 50px;
    }

    .ewpt-product-image {
        width: 40px;
        height: 40px;
    }

    .ewpt-add-to-cart {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--ewpt-spacing-xs);
    }

    .ewpt-quantity {
        width: 40px !important;
    }

    .ewpt-add-to-cart-btn {
        font-size: 10px;
        padding: var(--ewpt-spacing-xs) var(--ewpt-spacing-sm) !important;
    }

    .ewpt-search-input {
        width: 200px;
        max-width: 100%;
    }

    .ewpt-pagination-wrapper a {
        padding: 8px 10px;
        min-width: 36px;
        min-height: 36px;
        font-size: 11px;
        background: transparent !important;
        color: #3498db !important;
        border-color: #3498db !important;
    }

    .ewpt-pagination-wrapper .ewpt-current {
        padding: 8px 10px;
        min-width: 36px;
        min-height: 36px;
        font-size: 11px;
        background: #3498db !important;
        color: #ffffff !important;
        border-color: #3498db !important;
    }
}

@media (max-width: 480px) {
    .ewpt-table {
        font-size: 11px;
    }

    .ewpt-search-input {
        font-size: 12px;
        width: 100%;
        max-width: 100%;
    }

    .ewpt-search-wrapper {
        justify-content: center;
    }

    .ewpt-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .ewpt-pagination-wrapper a {
        padding: var(--ewpt-spacing-xs) var(--ewpt-spacing-sm);
        min-width: 32px;
        min-height: 32px;
        font-size: 11px;
        margin: 2px;
        background: transparent !important;
        color: #3498db !important;
        border-color: #3498db !important;
    }

    .ewpt-pagination-wrapper .ewpt-current {
        padding: var(--ewpt-spacing-xs) var(--ewpt-spacing-sm);
        min-width: 32px;
        min-height: 32px;
        font-size: 11px;
        margin: 2px;
        background: #3498db !important;
        color: #ffffff !important;
        border-color: #3498db !important;
    }

    .ewpt-pagination-wrapper {
        gap: var(--ewpt-spacing-xs);
        padding: var(--ewpt-spacing-sm);
    }
}

/* Enhanced Print Styles */
@media print {
    .ewpt-search-wrapper,
    .ewpt-pagination,
    .ewpt-add-to-cart {
        display: none !important;
    }

    .ewpt-table {
        border: 1px solid #000;
        font-size: 10pt;
        box-shadow: none;
    }

    .ewpt-table th,
    .ewpt-table td {
        border: 1px solid #ccc;
        padding: 4px;
        background: none !important;
    }

    .ewpt-products-table-wrapper {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Enhanced Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --ewpt-primary: #0000ff;
        --ewpt-danger: #ff0000;
        --ewpt-success: #008000;
        --ewpt-warning: #ff8c00;
    }
}

/* Focus management for better accessibility */
.ewpt-table th:focus-visible,
.ewpt-page-link:focus-visible,
.ewpt-add-to-cart-btn:focus-visible,
.ewpt-quantity:focus-visible,
.ewpt-search-input:focus-visible {
    outline: 2px solid var(--ewpt-primary);
    outline-offset: 2px;
}

/* Enhanced loading state */
.ewpt-table-container.ewpt-loading {
    pointer-events: none;
}

.ewpt-table-container.ewpt-loading .ewpt-table {
    opacity: 0.6;
    filter: blur(1px);
}

/* Micro-interactions for enhanced UX */
.ewpt-table tbody tr:hover .ewpt-product-image {
    transform: scale(1.05);
}

.ewpt-table tbody tr:hover .ewpt-add-to-cart-btn {
    transform: translateY(-1px);
}

.ewpt-table tbody tr:hover .stock-status {
    transform: scale(1.02);
}

/* Enhanced empty state */
.ewpt-table tbody:empty::after {
    content: 'No products found';
    display: block;
    text-align: center;
    padding: var(--ewpt-spacing-xl);
    color: var(--ewpt-gray);
    font-style: italic;
}

/* Performance optimizations */
.ewpt-table {
    contain: layout style;
}

.ewpt-product-image {
    contain: layout;
}

/* Enhanced border styles for better definition */
.ewpt-table th {
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.ewpt-table th:last-child {
    border-right: none;
}

.ewpt-table td {
    border-right: 1px solid rgba(0, 0, 0, 0.03);
}

.ewpt-table td:last-child {
    border-right: none;
}

.ewpt-prev {
    width: 40px !important;
    height: 40px !important;
    border: none !important;

}

.ewpt-next {
    width: 40px !important;
    height: 40px !important;
    border: none !important;
}

/* Category Chips Styling */
.ewpt-categories-cell {
    text-align: center;
    padding: 8px !important;
}

.ewpt-categories-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
}

/* Category chips - Background colors are controlled by Elementor */
.ewpt-category-chip {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--category-chip-bg, #e3f2fd); /* Fallback color */
    background-image: none !important; /* Remove any gradient */
    color: var(--category-chip-color, #1976d2);
    border: 1px solid var(--category-chip-border-color, #90caf9);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ewpt-category-chip:hover,
.elementor-widget-ewpt-woo-products-table .ewpt-category-chip:hover {
    background-color: var(--category-chip-bg-hover, #1976d2) !important;
    background-image: none !important;
    color: var(--category-chip-color-hover, #ffffff) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
    border-color: var(--category-chip-border-color-hover, #1976d2) !important;
}

.ewpt-no-categories {
    color: #9e9e9e;
    font-size: 11px;
    font-style: italic;
}

/* RTL Support for Categories */
[dir="rtl"] .ewpt-categories-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .ewpt-category-chip {
    text-align: right;
}

/* Responsive Category Chips */
@media (max-width: 768px) {
    .ewpt-categories-wrapper {
        gap: 2px;
    }

    .ewpt-category-chip {
        padding: 3px 6px;
        font-size: 10px;
        max-width: 80px;
    }
}

@media (max-width: 480px) {
    .ewpt-categories-wrapper {
        gap: 1px;
    }

    .ewpt-category-chip {
        padding: 2px 4px;
        font-size: 9px;
        max-width: 60px;
        border-radius: 8px;
    }
}

/* Variant Selector Styling */
.ewpt-variant-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Variant selector button - inherits styles from Add to Cart button */
.ewpt-select-variant-btn {
    /* WordPress Dashicon variant selection styles */
    background: var(--e-global-color-primary, #3498db);
    color: white;
    border: none;
    padding: 0;
    width: 36px!important;
    height: 36px!important;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin-left: 10px;
    text-align: center;
}

.ewpt-select-variant-btn:before {
    line-height: 1;
    vertical-align: middle;
}

.ewpt-select-variant-btn:hover:not(:disabled) {
    background: var(--e-global-color-secondary, #2980b9);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.ewpt-select-variant-btn:active {
    transform: scale(0.95);
}

.ewpt-select-variant-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.ewpt-variant-options {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.ewpt-variant-loading {
    text-align: center;
    color: #666;
    font-size: 12px;
    padding: 8px;
}

.ewpt-variant-attribute {
    margin-bottom: 12px;
}

.ewpt-variant-attribute:last-child {
    margin-bottom: 0;
}

.ewpt-variant-attribute-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    text-align: right;
}

.ewpt-variant-attribute-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ewpt-variant-option {
    padding: 4px 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 40px;
}

.ewpt-variant-option:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.ewpt-variant-option.selected {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
}

.ewpt-variant-option.disabled {
    background: #f8f9fa;
    color: #adb5bd;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.5;
}

.ewpt-variant-selected {
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
    text-align: center;
}

.ewpt-variant-selected-text {
    font-size: 11px;
    font-weight: 600;
    color: #28a745;
}

.ewpt-variant-price {
    font-size: 12px;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 8px;
    text-align: center;
}

.ewpt-variant-add-to-cart {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ewpt-variant-quantity {
    width: 50px !important;
    padding: 4px 6px !important;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
}

.ewpt-variant-add-to-cart-btn {
    background: var(--e-global-color-primary, #3498db);
    color: white;
    border: none;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin-left: 10px;
    text-align: center;
}

.ewpt-variant-add-to-cart-btn:before {
    line-height: 1;
    vertical-align: middle;
}

.ewpt-variant-add-to-cart-btn:hover:not(:disabled) {
    background: var(--e-global-color-secondary, #2980b9);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.ewpt-variant-add-to-cart-btn:active {
    transform: scale(0.95);
}

.ewpt-variant-add-to-cart-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

/* Loading state animation for variant add-to-cart */
.ewpt-variant-add-to-cart-btn.ewpt-loading-spin {
    background-color: #f39c12;
}

.ewpt-variant-add-to-cart-btn.ewpt-loading-spin:before {
    animation: ewpt-spin 1s linear infinite;
}

/* Success state styling for variant add-to-cart */
.ewpt-variant-add-to-cart-btn.ewpt-success-icon {
    background-color: #27ae60;
}

.ewpt-variant-add-to-cart-btn.ewpt-success-icon:before {
    animation: ewpt-pulse 0.5s ease-in-out;
}

/* RTL Support for Variant Selector */
[dir="rtl"] .ewpt-variant-attribute-label {
    text-align: left;
}

[dir="rtl"] .ewpt-variant-option {
    text-align: center;
}

/* Responsive Variant Selector */
/* Mobile Expand/Collapse Rows */
/* Hide mobile elements by default on desktop */
.ewpt-expand-cell,
.ewpt-mobile-actions-row {
display: none;
}

/* Responsive Column Visibility */
.ewpt-hide-mobile,
.ewpt-hide-tablet {
    display: table-cell !important;
}

/* Hide on mobile */
@media (max-width: 480px) {
    .ewpt-hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
@media (min-width: 481px) and (max-width: 1024px) {
    .ewpt-hide-tablet {
        display: none !important;
    }
}

/* Show mobile elements only on mobile */
@media (max-width: 768px) {
    .ewpt-expand-cell {
        display: table-cell !important;
        text-align: center !important;
        vertical-align: middle !important;
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        padding: 8px !important;
        border-top: 1px solid #eee;
    }
    
    .ewpt-mobile-actions-row {
        display: table-row !important;
    }
    
    .ewpt-mobile-actions-row:not(.expanded) {
        display: none !important;
    }

.ewpt-row-expand {
    background: none;
    border: 1px solid var(--e-global-color-primary, #3498db);
    color: var(--e-global-color-primary, #3498db);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    margin: 8px auto;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 90%;
}

.ewpt-row-expand:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.ewpt-row-expand .ewpt-icon-chevron-down {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.ewpt-row-expand[aria-expanded="true"] .ewpt-icon-chevron-down {
    transform: rotate(180deg);
}

.ewpt-mobile-actions {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin-top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.ewpt-mobile-actions-row.expanded .ewpt-mobile-actions {
    max-height: 500px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ewpt-mobile-actions {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin-top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.ewpt-mobile-actions.expanded {
    max-height: 200px;
    padding: 15px;
    opacity: 1;
    visibility: visible;
    margin-top: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
    border-top: 1px solid rgba(0,0,0,0.05);
}

.ewpt-mobile-actions .ewpt-add-to-cart {
    flex-direction: column;
    gap: 10px;
}

.ewpt-mobile-actions .ewpt-quantity {
    width: 100% !important;
    max-width: 120px;
    margin: 0 auto;
}

.ewpt-mobile-actions .ewpt-add-to-cart-btn,
.ewpt-mobile-actions .ewpt-select-variant-btn {
    width: 100%;
    justify-content: center;
}

.ewpt-not-purchasable {
    text-align: center;
    padding: 12px;
    color: #666;
    font-style: italic;
}

.ewpt-row-expand i {
    transition: transform 0.3s ease;
}

.ewpt-row-expand.active i {
    transform: rotate(180deg);
}

.ewpt-row-actions {
    display: none;
    padding: 12px;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.05);
}

.ewpt-row-actions.expanded {
    display: block;
    animation: slideDown 0.3s ease-out;
}

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

/* Hide actions column on mobile */
@media (max-width: 768px) {
    .ewpt-actions-cell {
        display: none;
    }
    
    .ewpt-row-expand {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    
    .ewpt-variant-options {
        padding: 8px;
    }

    .ewpt-variant-attribute-options {
        gap: 2px;
    }

    .ewpt-variant-option {
        padding: 3px 6px;
        font-size: 9px;
        min-width: 35px;
    }

    .ewpt-variant-add-to-cart {
        flex-direction: column;
        gap: 4px;
    }

    .ewpt-variant-quantity {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .ewpt-variant-options {
        padding: 6px;
    }

    .ewpt-variant-option {
        padding: 2px 4px;
        font-size: 8px;
        min-width: 30px;
    }

    .ewpt-select-variant-btn {
        font-size: 11px;
        padding: 6px 8px !important;
    }
}

/* Add to Cart Below Variant Selection */
.ewpt-variant-add-to-cart-below {
    margin-top: var(--ewpt-spacing-md);
    padding: var(--ewpt-spacing-md);
    background: var(--ewpt-light);
    border-radius: var(--ewpt-border-radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: var(--ewpt-spacing-sm);
    transition: var(--ewpt-transition);
    position: relative;
    z-index: 5;
}

.ewpt-variant-add-to-cart-below:hover {
    background: var(--ewpt-white);
    box-shadow: var(--ewpt-shadow-sm);
}

.ewpt-variant-quantity-below {
    width: 60px;
    padding: var(--ewpt-spacing-sm) var(--ewpt-spacing-md);
    border: 1px solid #e5e7eb;
    border-radius: var(--ewpt-border-radius-sm);
    font-size: 14px;
    text-align: center;
    background: var(--ewpt-white);
    color: var(--ewpt-dark);
    transition: var(--ewpt-transition);
}

.ewpt-variant-quantity-below:focus {
    outline: none;
    border-color: var(--ewpt-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ewpt-variant-add-to-cart-btn-below {
    flex: 1;
    padding: var(--ewpt-spacing-sm) var(--ewpt-spacing-lg);
    background: var(--ewpt-primary);
    color: var(--ewpt-white);
    border: none;
    border-radius: var(--ewpt-border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ewpt-transition);
    position: relative;
    overflow: hidden;
}

.ewpt-variant-add-to-cart-btn-below:hover:not(:disabled) {
    background: var(--ewpt-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--ewpt-shadow-md);
}

.ewpt-variant-add-to-cart-btn-below:active {
    transform: translateY(0);
}

.ewpt-variant-add-to-cart-btn-below:disabled {
    background: var(--ewpt-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* RTL Support for Add to Cart Below */
[dir="rtl"] .ewpt-variant-add-to-cart-below {
    flex-direction: row-reverse;
}

[dir="rtl"] .ewpt-variant-quantity-below {
    text-align: center;
}

/* Mobile Responsive for Add to Cart Below */
@media (max-width: 768px) {
    .ewpt-variant-add-to-cart-below {
        flex-direction: column;
        gap: var(--ewpt-spacing-md);
    }

    .ewpt-variant-quantity-below {
        width: 100%;
    }

    .ewpt-variant-add-to-cart-btn-below {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ewpt-variant-add-to-cart-below {
        padding: var(--ewpt-spacing-sm);
    }

    .ewpt-variant-add-to-cart-btn-below {
        padding: var(--ewpt-spacing-sm) var(--ewpt-spacing-md);
        font-size: 13px;
    }
}

/* Pagination Ellipsis Style */
.ewpt-pagination-wrapper .ewpt-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    margin: 0 4px;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 2px;
    user-select: none;
}

/* Responsive styles for ellipsis */
@media (max-width: 768px) {
    .ewpt-pagination-wrapper .ewpt-ellipsis {
        min-width: 36px;
        min-height: 36px;
        font-size: 11px;
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .ewpt-pagination-wrapper .ewpt-ellipsis {
        min-width: 32px;
        min-height: 32px;
        font-size: 11px;
        padding: 4px 8px;
        margin: 2px;
    }
}

/* Mobile Button Display - Show buttons directly in the table */
@media (max-width: 768px) {
    /* Make sure the action buttons are visible on mobile */
    .ewpt-actions-cell {
        display: table-cell !important;
    }
    
    /* Hide the expand button since we're showing the actions directly */
    .ewpt-expand-cell {
        display: none !important;
    }
    
    /* Hide the mobile actions row since we're showing actions in the main row */
    .ewpt-mobile-actions-row {
        display: none !important;
    }
    
    /* Make the action buttons more mobile-friendly */
    .ewpt-add-to-cart {
        display: flex;
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }
    
    .ewpt-add-to-cart-btn,
    .ewpt-select-variant-btn {
        width: 100%;
        padding: 8px 5px;
        font-size: 12px;
        white-space: nowrap;
        text-align: center;
    }
    
    .ewpt-quantity {
        width: 100%;
        padding: 5px;
        font-size: 12px;
    }
    
    /* Optimize table layout for mobile */
    .ewpt-table td {
        padding: 8px 5px;
    }
    
    /* Make sure the action column has enough width */
    .ewpt-actions-cell {
        min-width: 90px;
    }
}

/* Smaller mobile screens */
@media (max-width: 480px) {
    .ewpt-add-to-cart-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .ewpt-add-to-cart-btn::before {
        font-size: 14px;
    }
    .ewpt-select-variant-btn {
        padding: 6px 3px;
        font-size: 11px;
    }
    
    .ewpt-quantity {
        padding: 4px;
        font-size: 11px;
    }
    
    /* Further optimize table layout */
    .ewpt-table td {
        padding: 6px 3px;
    }
    
    /* Make sure the action column has enough width */
    .ewpt-actions-cell {
        min-width: 80px;
    }
}