/**
 * Sample Product Table Styles
 * 
 * Responsive styling for the WooCommerce sample product table
 * Inherits from Kadence theme variables where available
 */

/* Main table wrapper */
.sample-product-table-wrapper {
    position: relative;
    overflow-x: auto;
    margin: 20px 0;
    border-radius: var(--global-border-radius, 6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Search functionality */
.sample-table-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: var(--global-border-radius, 6px);
}

.sample-table-search .woocommerce-ordering {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sample-search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sample-search-input:focus {
    outline: none;
    border-color: var(--global-palette1, #0073aa);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* Removed custom .orderby styling to prevent conflicts with Kadence theme */
/* The theme handles select styling including the dropdown arrow icon */

/* ==========================================================================
   LOADING SKELETON STYLES - Prevent styling flash
   ========================================================================== */

/* Skeleton loader that matches Tabulator appearance */
.sample-table-loading-skeleton {
    background: white !important;
    border: 1px solid #e1e1e1 !important;
    border-radius: var(--global-border-radius, 6px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.sample-skeleton-header {
    background: #f8f9fa !important;
    border-bottom: 2px solid #e1e1e1 !important;
    padding: 12px !important;
}

.sample-skeleton-search-bar {
    height: 32px !important;
    background: #e1e1e1 !important;
    border-radius: 4px !important;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate !important;
}

.sample-skeleton-table {
    width: 100% !important;
    display: table !important;
}

.sample-skeleton-row {
    display: table-row !important;
}

.sample-skeleton-header-row {
    background: #f8f9fa !important;
    border-bottom: 1px solid #e1e1e1 !important;
}

.sample-skeleton-cell {
    display: table-cell !important;
    padding: 12px 8px !important;
    vertical-align: middle !important;
    border-right: 1px solid #f0f0f0 !important;
}

/* Skeleton content placeholders */
.sample-skeleton-thumb,
.sample-skeleton-thumb-content {
    width: 70px !important;
    text-align: center !important;
}

.sample-skeleton-thumb-content {
    height: 20px !important;
    background: #e1e1e1 !important;
    border-radius: 4px !important;
    margin: 0 auto !important;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate !important;
}

.sample-skeleton-title-content {
    height: 20px !important;
    background: #e1e1e1 !important;
    border-radius: 4px !important;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate !important;
    animation-delay: 0.1s !important;
}

.sample-skeleton-price,
.sample-skeleton-price-content {
    width: 80px !important;
    text-align: right !important;
}

.sample-skeleton-price-content {
    height: 20px !important;
    background: #e1e1e1 !important;
    border-radius: 4px !important;
    margin-left: auto !important;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate !important;
    animation-delay: 0.2s !important;
}

.sample-skeleton-qty,
.sample-skeleton-qty-content {
    width: 80px !important;
    text-align: center !important;
}

.sample-skeleton-qty-content {
    height: 20px !important;
    background: #e1e1e1 !important;
    border-radius: 4px !important;
    margin: 0 auto !important;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate !important;
    animation-delay: 0.3s !important;
}

.sample-skeleton-action,
.sample-skeleton-action-content {
    width: 120px !important;
    text-align: center !important;
}

.sample-skeleton-action-content {
    height: 28px !important;
    background: var(--global-palette1, #0073aa) !important;
    opacity: 0.3 !important;
    border-radius: 4px !important;
    margin: 0 auto !important;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate !important;
    animation-delay: 0.4s !important;
}

/* Skeleton animation */
@keyframes skeleton-pulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    100% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

/* Hide skeleton when Tabulator is initialized */
.tabulator ~ .sample-table-loading-skeleton,
.tabulator.sample-table-loading-skeleton .sample-skeleton-header,
.tabulator.sample-table-loading-skeleton .sample-skeleton-table {
    display: none !important;
}

/* ==========================================================================
   TABULATOR INTEGRATION STYLES
   ========================================================================== */

/* Tabulator wrapper and theme integration */
.tabulator {
    background: white !important;
    border: 1px solid #e1e1e1 !important;
    border-radius: var(--global-border-radius, 6px) !important;
    font-family: inherit !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    width: 100% !important;  /* Force full width */
    display: block !important;  /* Force block display for proper fitColumns layout */
    min-width: 100% !important;  /* Override Tabulator's default min-width */
}

/* Header styling - Keep structure but hide title text */
.tabulator .tabulator-header {
    background: #f8f9fa !important;
    border-bottom: 2px solid #e1e1e1 !important;
    font-weight: 600 !important;
}

.tabulator .tabulator-col-title {
    display: none !important;
}

.tabulator .tabulator-col {
    border-right: 1px solid #e1e1e1 !important;
}

.tabulator .tabulator-col-title {
    color: #333 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* Header filter inputs */
.tabulator .tabulator-header-filter input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    /* Let Tabulator calculate width */
}

.tabulator .tabulator-header-filter input:focus {
    outline: none !important;
    border-color: var(--global-palette1, #0073aa) !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1) !important;
}

/* Row styling */
.tabulator .tabulator-row {
    border-bottom: 1px solid #f0f0f0 !important;
}

.tabulator .tabulator-row:hover {
    background: #f8f9fa !important;
}

.tabulator .tabulator-row.tabulator-row-even {
    background: #fdfdfd !important;
}

.tabulator .tabulator-row.tabulator-row-even:hover {
    background: #f5f5f5 !important;
}

/* Cell styling */
.tabulator .tabulator-cell {
    border-right: 1px solid #f0f0f0 !important;
    padding: 12px 8px !important;
    vertical-align: middle !important;
}

/* Column-specific styling - Let Tabulator handle layout */
.tabulator .thumbnail-col {
    text-align: center;
}

.tabulator .title-col-content .product-title {
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 4px;
    white-space: nowrap;  /* Prevent wrapping to ensure single line */
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabulator .title-col-content .product-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.tabulator .price-col {
    font-weight: 600;
}

/* Let Tabulator handle column alignment via column config */

/* Quantity input styling in Tabulator */
.tabulator .quantity input.qty {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    /* Let Tabulator handle width */
}

.tabulator .quantity input.qty:focus {
    outline: none !important;
    border-color: var(--global-palette1, #0073aa) !important;
}

.tabulator .quantity-disabled {
    color: #999 !important;
    font-style: italic !important;
}

/* Button styling in Tabulator */
.tabulator .add-sample-btn {
    background: var(--global-palette1, #0073aa) !important;
    color: white !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-width: 70px !important;
    white-space: nowrap !important;
}

.tabulator .add-sample-btn:hover:not(:disabled) {
    background: var(--global-palette1-hover, #005a87) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.tabulator .add-sample-btn:disabled,
.tabulator .add-sample-btn.disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Pagination styling */
.tabulator .tabulator-footer {
    background: #f8f9fa !important;
    border-top: 1px solid #e1e1e1 !important;
    padding: 12px !important;
}

.tabulator .tabulator-paginator {
    color: #666 !important;
    font-size: 13px !important;
}

.tabulator .tabulator-page {
    background: white !important;
    border: 1px solid #ddd !important;
    color: #666 !important;
    margin: 0 2px !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.tabulator .tabulator-page:hover {
    background: #f0f0f0 !important;
    border-color: #ccc !important;
}

.tabulator .tabulator-page.active {
    background: var(--global-palette1, #0073aa) !important;
    border-color: var(--global-palette1, #0073aa) !important;
    color: white !important;
}

.tabulator .tabulator-page[disabled] {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Enhanced responsive collapsed rows */
.tabulator .tabulator-responsive-collapse {
    padding: 12px 16px !important;
    background: #f8f9fa !important;
    border-top: 1px solid #e1e1e1 !important;
    margin: 4px 0 !important;
    border-radius: 4px !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.tabulator .tabulator-responsive-collapse-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.tabulator .tabulator-responsive-collapse-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 6px 8px !important;
    background: white !important;
    border-radius: 4px !important;
    border: 1px solid #e1e1e1 !important;
    font-size: 13px !important;
}

.tabulator .tabulator-responsive-collapse-item strong {
    color: #555 !important;
    font-weight: 600 !important;
    min-width: 80px !important;
    flex-shrink: 0 !important;
}

.tabulator .tabulator-responsive-collapse-toggle {
    background: var(--global-palette1, #0073aa) !important;
    border: 2px solid white !important;
    color: white !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.tabulator .tabulator-responsive-collapse-toggle:hover {
    background: var(--global-palette1-hover, #005a87) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15) !important;
}

.tabulator .tabulator-responsive-collapse-toggle:before {
    content: "+" !important;
    font-size: 16px !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

.tabulator .tabulator-responsive-collapse-toggle.open:before {
    content: "−" !important;
}

/* Notification styles for Tabulator integration */
.wc-sample-notice {
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
    animation: slideInDown 0.3s ease-out !important;
}

.wc-sample-success {
    background: #d4edda !important;
    color: #155724 !important;
    border: 1px solid #c3e6cb !important;
}

.wc-sample-error {
    background: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb !important;
}

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

/* Enhanced mobile optimizations for Tabulator - Tablet & Mobile */
@media (max-width: 768px) {
    .tabulator {
        font-size: 14px !important;
        border-radius: 8px !important;
    }
    
    .tabulator .tabulator-cell {
        padding: 10px 8px !important;
        font-size: 14px !important;
    }
    
    .tabulator .tabulator-header .tabulator-col {
        padding: 8px !important;
        font-size: 13px !important;
    }
    
    /* Row header (toggle button) styling for tablet */
    .tabulator .tabulator-row-handle {
        width: 35px !important;
        min-width: 35px !important;
    }
    
    .tabulator .tabulator-responsive-collapse-toggle {
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
    }
    
    /* Button and input optimizations */
    .tabulator .add-sample-btn {
        padding: 8px 12px !important;
        font-size: 13px !important;
        min-width: 80px !important;
        white-space: nowrap !important;
    }
    
    .tabulator .quantity input.qty {
        width: 50px !important;
        padding: 6px 4px !important;
        text-align: center !important;
    }
    
    /* Title column text optimization for tablet */
    .tabulator .title-col-content .product-title {
        font-size: 14px !important;
        line-height: 1.3 !important;
        word-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* Search input optimization */
    .tabulator .tabulator-header-filter input {
        padding: 8px 6px !important;
        font-size: 14px !important;
    }
}

/* Mobile phone optimizations */
@media (max-width: 480px) {
    .tabulator {
        font-size: 13px !important;
        border-radius: 6px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }
    
    .tabulator .tabulator-cell {
        padding: 10px 8px !important;
        font-size: 13px !important;
        line-height: 1.4 !important;
    }
    
    .tabulator .tabulator-header {
        background: #f5f5f5 !important;
        border-bottom: 2px solid #e0e0e0 !important;
    }
    
    .tabulator .tabulator-header .tabulator-col {
        padding: 8px 6px !important;
        font-size: 12px !important;
    }
    
    /* Row header for mobile */
    .tabulator .tabulator-row-handle {
        width: 32px !important;
        min-width: 32px !important;
        background: #f8f9fa !important;
    }
    
    .tabulator .tabulator-responsive-collapse-toggle {
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
        margin: 0 auto !important;
        background: var(--global-palette1, #0073aa) !important;
        color: white !important;
        border: 2px solid white !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    }
    
    /* Improved collapsed content for mobile - enhanced styling */
    .tabulator .tabulator-responsive-collapse {
        padding: 12px 16px !important;
        margin: 6px 0 !important;
        background: #f8f9fa !important;
        border-radius: 8px !important;
        border: 1px solid #e0e0e0 !important;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }
    
    .tabulator .tabulator-responsive-collapse-item {
        padding: 10px 12px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
        margin-bottom: 6px !important;
        background: white !important;
        border: 1px solid #e0e0e0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .tabulator .tabulator-responsive-collapse-item strong {
        min-width: 80px !important;
        font-size: 13px !important;
        color: #333 !important;
        font-weight: 600 !important;
    }
    
    /* Mobile button optimization - improved touch targets */
    .tabulator .add-sample-btn {
        padding: 12px 16px !important;
        font-size: 13px !important;
        min-width: 100px !important;
        min-height: 44px !important;  /* WCAG touch target requirement */
        border-radius: 8px !important;
        font-weight: 600 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.2s ease !important;
    }
    
    .tabulator .add-sample-btn:hover:not(:disabled) {
        transform: none !important;  /* Remove transform on mobile for better performance */
        box-shadow: 0 4px 8px rgba(0, 115, 170, 0.2) !important;
    }
    
    /* Mobile quantity input - better touch targets */
    .tabulator .quantity input.qty {
        width: 50px !important;
        padding: 10px 6px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
        min-height: 40px !important;  /* Better touch target */
        border: 2px solid #ddd !important;
        text-align: center !important;
    }
    
    /* Mobile title column - improved readability */
    .tabulator .title-col-content .product-title {
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        margin-bottom: 4px !important;
        overflow: visible !important;
        white-space: normal !important;
        text-overflow: clip !important;
        color: #333 !important;
        word-break: break-word !important;
    }
    
    /* Mobile search input - enhanced for mobile interaction */
    .tabulator .tabulator-header-filter input {
        padding: 12px 16px !important;
        font-size: 16px !important;  /* Prevent zoom on iOS */
        border-radius: 8px !important;
        border: 2px solid #ddd !important;
        min-height: 44px !important;  /* WCAG touch target */
        background: white !important;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }
    
    .tabulator .tabulator-header-filter input:focus {
        border-color: var(--global-palette1, #0073aa) !important;
        box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1) !important;
    }
    
    /* Mobile pagination - enhanced touch targets */
    .tabulator .tabulator-footer {
        padding: 12px 16px !important;
        background: #f8f9fa !important;
        border-top: 1px solid #e0e0e0 !important;
        display: block !important;
        width: 100% !important;
    }
    
    .tabulator .tabulator-footer .tabulator-info {
        display: block !important;
        text-align: center !important;
        margin-bottom: 8px !important;
        font-size: 12px !important;
        color: #666 !important;
    }
    
    .tabulator .tabulator-paginator {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Hide page numbers on mobile, only show prev/next */
    .tabulator .tabulator-page {
        display: none !important;
    }
    
    /* Show only prev and next buttons */
    .tabulator .tabulator-page[data-page="prev"],
    .tabulator .tabulator-page[data-page="next"] {
        display: inline-flex !important;
        padding: 8px 10px !important;
        font-size: 11px !important;
        min-width: 45px !important;  /* Even smaller to prevent stacking */
        max-width: 60px !important;  /* Prevent buttons from getting too wide */
        min-height: 36px !important; /* Reduced height */
        margin: 2px !important;
        border-radius: 6px !important;
        border: 1px solid #ddd !important;
        background: white !important;
        color: #333 !important;
        font-weight: 600 !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.2s ease !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }
    
    .tabulator .tabulator-page[data-page="prev"]:hover,
    .tabulator .tabulator-page[data-page="next"]:hover {
        background: #f0f0f0 !important;
        border-color: #999 !important;
        transform: translateY(-1px) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
    }
    
    .tabulator .tabulator-page[data-page="prev"][disabled],
    .tabulator .tabulator-page[data-page="next"][disabled] {
        opacity: 0.4 !important;
        cursor: not-allowed !important;
        transform: none !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    }
}

.sample-search-button {
    padding: 8px 16px;
    background: var(--global-palette1, #0073aa);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sample-search-button:hover {
    background: var(--global-palette1-hover, #005a87);
    transform: translateY(-1px);
}

.sample-clear-filters {
    padding: 8px 16px;
    background: #666;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.sample-clear-filters:hover {
    background: #333;
    color: white;
}

/* Table container */
.sample-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Main table styling with 60px row optimization */
.sample-product-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: #ffffff;
    font-family: var(--global-body-font-family, inherit);
    font-size: var(--global-body-font-size, 16px);
    line-height: 1.6;
    table-layout: fixed;
}

.sample-product-table th {
    background: var(--global-palette9, #f8f9fa);
    color: var(--global-palette-btn-bg, #2d3748);
    font-weight: 600;
    text-align: left;
    padding: 15px 12px;
    border-bottom: 2px solid var(--global-border-color, #e1e5e9);
    white-space: normal;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sample-product-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--global-border-color-light, #f1f3f4);
    vertical-align: middle;
    transition: background-color 0.2s ease;
}

/* Clean table row styling */
.sample-product-table tbody tr {
    height: 60px;
    line-height: 1.2;
    border-spacing: 0;
}

/* Clean cell styling */
.sample-product-table tbody td {
    vertical-align: middle;
    padding: 6px 8px;
    max-height: 48px;
    overflow: visible;
    box-sizing: border-box;
}

/* Row hover effects */
.sample-product-table tbody tr:hover {
    background-color: var(--global-row-hover-color, #f8f9fa);
}

.sample-product-table tbody tr.unavailable {
    opacity: 0.6;
    background-color: #f9f9f9;
}

.sample-product-table tbody tr.unavailable:hover {
    background-color: #f5f5f5;
}

/* Column-specific styling */
.sample-product-table .thumbnail-col {
    width: 100px;
    text-align: center;
}

.sample-thumbnail {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: var(--global-border-radius, 4px);
    border: 1px solid var(--global-border-color-light, #e1e5e9);
    transition: transform 0.2s ease;
    display: block;
    margin: 0 auto;
}

.sample-thumbnail:hover {
    transform: scale(1.05);
}

.sample-thumbnail-placeholder {
    width: 28px;
    height: 28px;
    background: var(--global-palette9, #f8f9fa);
    border: 1px solid var(--global-border-color, #e1e5e9);
    border-radius: var(--global-border-radius, 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--global-palette5, #8e9aaf);
    margin: 0 auto;
}

.sample-thumbnail-placeholder .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.title-col {
    /* Let Tabulator control width; no max width cap */
}

.sample-product-table .title-col-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    max-height: 48px;
    min-height: 48px;
    overflow: visible;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.product-title {
    font-weight: 500;
    color: var(--global-palette-btn-bg, #2d3748);
    display: block;
    margin: 0 0 2px 0;
    line-height: 1.3;
    font-size: 13px;
    overflow: visible;
    text-overflow: initial;
    white-space: normal;
    max-width: 100%;
    word-wrap: break-word;
    hyphens: auto;
}

.product-excerpt {
    font-size: 11px;
    color: var(--global-palette5, #718096);
    line-height: 1.2;
    margin: 0;
    overflow: visible;
    text-overflow: initial;
    white-space: normal;
    max-width: 100%;
    word-wrap: break-word;
    hyphens: auto;
}

.price-col {
    /* Let Tabulator control width */
    text-align: center;
}

.retail-price {
    font-size: 12px;
    line-height: 1.3;
    margin: 0;
    font-weight: 600;
    color: var(--global-palette-btn-bg, #2d3748);
}

.original-price {
    display: block;
    text-decoration: line-through;
    color: var(--global-palette5, #999);
    font-size: 14px;
    margin-bottom: 2px;
}

.sample-indicator {
    color: var(--global-palette3, #d63638);
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(214, 54, 56, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.action-col {
    /* Let Tabulator control width */
    text-align: center;
}

/* Compact button styling for 60px rows */
.add-sample-btn {
    padding: 6px 10px;
    background: var(--global-palette1, #0073aa);
    color: var(--global-palette-btn-bg-txt, #ffffff);
    border: none;
    border-radius: var(--button-border-radius, 4px);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 80px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    position: relative;
    overflow: visible;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    box-sizing: border-box;
}

.add-sample-btn:hover:not(.disabled) {
    background: var(--global-palette1-hover, #005a87);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.add-sample-btn:active:not(.disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.add-sample-btn.disabled {
    background: var(--global-palette7, #a0aec0);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none !important;
    box-shadow: none !important;
}

.add-sample-btn.loading {
    pointer-events: none;
}

.add-sample-btn.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: var(--global-palette-btn-bg-txt, #ffffff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Cart item styling */
.sample-quantity-locked {
    color: var(--global-palette5, #718096);
    font-style: italic;
}

.sample-badge {
    background: var(--global-palette3, #d63638);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Pagination */
.sample-table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: var(--global-palette9, #f8f9fa);
    border-radius: var(--global-border-radius, 6px);
    flex-wrap: wrap;
    gap: 15px;
}

.sample-table-pagination .woocommerce-pagination {
    display: flex;
    gap: 5px;
}

.sample-table-pagination .page-numbers {
    padding: 8px 12px;
    background: var(--global-palette-btn-bg-txt, #ffffff);
    color: var(--global-palette-btn-bg, #2d3748);
    text-decoration: none;
    border: 1px solid var(--global-border-color, #e1e5e9);
    border-radius: var(--global-border-radius, 4px);
    transition: all 0.2s ease;
    font-size: 14px;
}

.sample-table-pagination .page-numbers:hover,
.sample-table-pagination .page-numbers.current {
    background: var(--global-palette1, #0073aa);
    color: var(--global-palette-btn-bg-txt, #ffffff);
    border-color: var(--global-palette1, #0073aa);
}

.sample-table-pagination-info {
    color: var(--global-palette5, #718096);
    font-size: 14px;
}

/* Loading states */
.sample-table-loading {
    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: 999;
    border-radius: var(--global-border-radius, 6px);
}

.sample-loading-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--global-palette5, #718096);
}

.sample-loading-spinner .spinner {
    width: 20px;
    height: 20px;
}

/* Messages */
.sample-table-messages {
    margin: 15px 0;
}

.sample-table-messages .notice {
    padding: 12px 15px;
    margin: 5px 0;
    border-radius: var(--global-border-radius, 4px);
    font-size: 14px;
}

.sample-table-messages .notice-success {
    background: rgba(72, 187, 120, 0.1);
    color: var(--global-palette4, #2f855a);
    border-left: 4px solid var(--global-palette4, #48bb78);
}

.sample-table-messages .notice-error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--global-palette3, #c53030);
    border-left: 4px solid var(--global-palette3, #f56565);
}

/* No products message */
.no-products-message {
    text-align: center;
    color: var(--global-palette5, #718096);
    font-style: italic;
    padding: 40px 20px;
}

/* Mobile-First Responsive Design */

/* Tablet view (768px and below) */
@media (max-width: 768px) {
    .sample-product-table-wrapper {
        margin: 15px 0;
        border-radius: var(--global-border-radius, 6px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .sample-table-controls {
        padding: 12px;
    }

    .sample-table-search .woocommerce-ordering {
        flex-direction: column;
        gap: 12px;
    }

    .sample-search-input {
        min-width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .sample-search-button {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px; /* Touch target size */
    }

    .sample-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sample-product-table {
        min-width: 600px;
        font-size: 14px;
    }

    /* Hide thumbnails on smaller screens but keep table structure for tablets */
    .thumbnail-col {
        width: 80px;
    }
    
    .sample-thumbnail {
        width: 40px;
        height: 40px;
    }

    .sample-thumbnail-placeholder {
        width: 40px;
        height: 40px;
    }

    .add-sample-btn {
        padding: 10px 12px;
        font-size: 12px;
        min-width: 80px;
        min-height: 44px; /* Touch target */
    }
}

/* Mobile card layout (480px and below) */
@media (max-width: 480px) {
    .sample-product-table-wrapper {
        margin: 10px 0;
        box-shadow: none;
        border: 1px solid var(--global-border-color, #e1e5e9);
    }

    .sample-table-controls {
        padding: 15px;
        margin-bottom: 0;
        border-bottom: 1px solid var(--global-border-color, #e1e5e9);
    }

    /* Hide the traditional table on mobile and switch to cards */
    .sample-table-container {
        overflow: visible;
    }

    /* Transform table into mobile card layout */
    .sample-product-table {
        display: block;
        width: 100%;
    }

    /* Hide table header elements */
    .sample-product-table thead,
    .sample-product-table thead tr,
    .sample-product-table thead th {
        display: none;
    }

    /* Create mobile card layout */
    .sample-product-table tbody {
        display: block;
        width: 100%;
    }

    .sample-product-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid var(--global-border-color-light, #f1f3f4);
        border-radius: var(--global-border-radius, 6px);
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        height: auto;
        position: relative;
    }

    .sample-product-table tbody tr:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        background-color: #fff;
    }

    .sample-product-table tbody tr.unavailable {
        opacity: 0.7;
        background-color: #f9f9f9;
    }

    /* Hide all table cells and recreate as blocks */
    .sample-product-table td {
        display: block;
        padding: 0;
        border: none;
        width: auto;
        max-height: none;
        overflow: visible;
    }

    /* Hide thumbnail column completely on mobile */
    .sample-product-table .thumbnail-col {
        display: none !important;
    }

    /* Product title and description */
    .sample-product-table .title-col {
        margin-bottom: 12px;
        border-bottom: 1px solid var(--global-border-color-light, #f1f3f4);
        padding-bottom: 12px;
    }

    .title-col-content {
        max-height: none;
        min-height: auto;
    }

    .product-title {
        font-size: 16px;
        font-weight: 600;
        line-height: 1.4;
        margin-bottom: 4px;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
    }

    .product-excerpt {
        font-size: 13px;
        line-height: 1.3;
        color: var(--global-palette5, #718096);
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: visible;
        margin: 0;
    }

    /* Price section */
    .sample-product-table .price-col {
        display: block;
        margin-bottom: 15px;
        padding: 8px 12px;
        background: var(--global-palette9, #f8f9fa);
        border-radius: var(--global-border-radius, 4px);
        position: relative;
        width: 100%;
        box-sizing: border-box;
        overflow: visible;
        white-space: normal;
    }

    .sample-product-table .price-col::before {
        content: "Price: ";
        font-weight: 600;
        color: var(--global-palette-btn-bg, #2d3748);
        display: inline-block;
        margin-right: 8px;
    }

    /* Ensure price content displays properly */
    .sample-product-table .price-col .retail-price,
    .sample-product-table .price-col .sample-indicator,
    .sample-product-table .price-col > * {
        display: inline-block;
        vertical-align: middle;
    }

    .retail-price {
        font-size: 14px;
        font-weight: 700;
    }

    .sample-indicator {
        font-size: 11px;
        padding: 3px 6px;
        margin-left: 8px;
    }

    /* Quantity section (if enabled) */
    .sample-product-table .quantity-col {
        display: block;
        margin-bottom: 15px;
        padding: 8px 12px;
        background: var(--global-palette9, #f8f9fa);
        border-radius: var(--global-border-radius, 4px);
        position: relative;
    }

    .sample-product-table .quantity-col::before {
        content: "Quantity: ";
        font-weight: 600;
        color: var(--global-palette-btn-bg, #2d3748);
        display: inline-block;
        margin-right: 8px;
    }

    /* Ensure quantity content displays properly */
    .sample-product-table .quantity-col .sample-quantity-locked,
    .sample-product-table .quantity-col input,
    .sample-product-table .quantity-col select,
    .sample-product-table .quantity-col > * {
        display: inline-block;
        vertical-align: middle;
    }

    /* Action button - full width and prominent */
    .sample-product-table .action-col {
        margin-top: 15px;
        width: auto;
        display: block;
    }

    .add-sample-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 14px;
        font-weight: 600;
        min-height: 48px; /* Larger touch target for mobile */
        border-radius: var(--global-border-radius, 6px);
        text-transform: none;
        letter-spacing: 0;
        white-space: normal; /* Allow button text to wrap if needed */
        word-wrap: break-word;
        overflow: visible;
        box-sizing: border-box;
        display: block;
        text-align: center;
        line-height: 1.3;
    }

    .add-sample-btn:hover:not(.disabled) {
        transform: none; /* Remove transform on mobile for better performance */
        box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
    }

    /* No products message styling for mobile */
    .no-products-row {
        display: block;
        text-align: center;
        padding: 40px 20px;
        border: 2px dashed var(--global-border-color, #e1e5e9);
        border-radius: var(--global-border-radius, 8px);
        margin: 20px 0;
    }

    .no-products-row td {
        display: block;
        padding: 0;
    }

    .no-products-message {
        color: var(--global-palette5, #718096);
        font-size: 16px;
        font-style: italic;
    }

    /* Pagination adjustments for mobile */
    .sample-table-pagination {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        text-align: center;
    }

    .sample-table-pagination .woocommerce-pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

    .sample-table-pagination .page-numbers {
        padding: 10px 16px;
        margin: 2px;
        font-size: 14px;
        min-width: 44px; /* Touch target */
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sample-table-pagination-info {
        font-size: 14px;
        margin-top: 0;
    }

    /* Loading state adjustments */
    .sample-loading-spinner {
        padding: 20px;
        font-size: 16px;
    }

    /* Search controls mobile optimization */
    .sample-table-search .woocommerce-ordering {
        gap: 15px;
    }

    .sample-table-search .orderby {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
        border-radius: var(--global-border-radius, 6px);
    }

    .sample-clear-filters {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--global-border-radius, 6px);
    }
}

/* Extra small screens (375px and below) - iPhone SE, etc. */
@media (max-width: 375px) {
    .sample-product-table-wrapper {
        margin: 5px 0;
    }

    .sample-table-controls {
        padding: 12px;
    }

    .sample-product-table tbody tr {
        margin-bottom: 12px;
        padding: 12px;
    }

    .product-title {
        font-size: 15px;
    }

    .product-excerpt {
        font-size: 12px;
    }

    .add-sample-btn {
        padding: 12px 16px;
        font-size: 13px;
        min-height: 44px;
    }

    .sample-table-pagination {
        padding: 12px;
    }

    .sample-table-pagination .page-numbers {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 40px;
        min-height: 40px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sample-product-table {
        border: 2px solid #000000;
    }

    .sample-product-table th {
        background: #000000;
        color: #ffffff;
        border-bottom: 2px solid #000000;
    }

    .sample-product-table td {
        border-bottom: 1px solid #666666;
    }

    .add-sample-btn {
        border: 2px solid #000000;
    }

    .add-sample-btn.disabled {
        border-color: #666666;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .add-sample-btn,
    .sample-thumbnail,
    .sample-search-input,
    .sample-search-button {
        transition: none;
    }

    .add-sample-btn:hover:not(.disabled) {
        transform: none;
    }

    .sample-thumbnail:hover {
        transform: none;
    }

    @keyframes spin {
        0% { transform: none; }
        100% { transform: none; }
    }
}

/* Focus styles for accessibility */
.add-sample-btn:focus,
.sample-search-input:focus,
.sample-search-button:focus {
    outline: 2px solid var(--global-palette1, #0073aa);
    outline-offset: 2px;
}


/* Mobile-specific adjustments for Tabulator */
@media (max-width: 480px) {
    .tabulator .tabulator-tableholder .tabulator-table .tabulator-cell.title-col .product-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .tabulator .tabulator-tableholder .tabulator-table .tabulator-cell.actions-col .add-sample-btn {
        width: 100% !important;
        padding: 8px 10px !important;
        font-size: 14px !important;
        white-space: normal !important;
    }
    .tabulator .tabulator-tableholder .tabulator-table .tabulator-cell {
        padding: 8px 8px !important;
    }
}

/* Print styles */
@media print {
    .sample-product-table-wrapper {
        box-shadow: none;
        border: 1px solid #000000;
    }

    .sample-table-search,
    .add-sample-btn,
    .sample-table-pagination,
    .sample-table-loading {
        display: none;
    }

    .sample-product-table {
        border-collapse: collapse;
    }

    .sample-product-table th,
    .sample-product-table td {
        border: 1px solid #000000;
        padding: 8px;
    }

    .sample-thumbnail {
        width: 40px;
        height: 40px;
    }
}