/**
 * Products Page Styles
 * Enterprise-grade CSS with accessibility and responsive design
 * Unified stylesheet for both wholesale and all products pages
 * @version 3.0.0
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 30px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #5a6268;
}

h1 {
    color: #333;
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-link {
    color: #4caf50;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.back-link:hover {
    text-decoration: underline;
}

.filters-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.filters-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Filter help icon - FIX ISSUE-005 */
.filter-help-icon {
    font-size: 11px;
    color: #999;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.filter-help-icon:hover {
    opacity: 1;
    color: #4caf50;
}

.filter-group input,
.filter-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #4caf50;
    color: white;
    position: relative;
    min-width: 100px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    background: #45a049;
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(76, 175, 80, 0.3);
}

/* Loading state for buttons - FIX ISSUE-001 & ISSUE-007 */
.btn-primary.loading,
.btn-secondary.loading,
select.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
    position: relative;
}

.btn-primary.loading::after,
.btn-secondary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after {
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #333;
}

/* Enhanced loading state for filter selects - FIX ISSUE-007 & ISSUE-010 */
.filter-group select.loading {
    position: relative;
    padding-right: 35px;
}

.filter-group select.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid rgba(76, 175, 80, 0.3);
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    pointer-events: none;
}

/* Size filter specific loading indicator - FIX ISSUE-010 */
#size-filter.loading {
    background-image: none;
    background-color: #f8f9fa;
}

#size-filter.loading::before {
    content: '⏳';
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

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

/* Filter applying state - FIX ISSUE-007 */
select.applying,
input.applying {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    transition: all 0.3s ease;
    background-color: #f0fdf4;
}

/* Pulse animation for loading indicators */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Search button prominence - FIX ISSUE-002 */
.filter-group-button {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.filter-group-button .btn-primary {
    min-height: 42px;
    font-size: 15px;
    padding: 12px 24px;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
    font-weight: 600;
    position: relative;
}

.filter-group-button .btn-primary::before {
    content: '🔍';
    margin-right: 6px;
    font-size: 14px;
}

.filter-group-button .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.filter-group-button .btn-primary:focus {
    outline: 2px solid #4caf50;
    outline-offset: 2px;
}

/* Tooltip for search button - FIX ISSUE-002 */
.filter-group-button .btn-primary[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 1000;
    pointer-events: none;
}

/* Active filters section - always visible with animation - FIX ISSUE-008 */
.active-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #e3f2fd;
    border-radius: 6px;
    border: 1px solid #90caf9;
    flex-wrap: wrap;
    min-height: 48px;
    animation: slideDown 0.3s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    visibility: visible;
    opacity: 1;
}

.active-filters.active-filters-visible {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.active-filters.hidden {
    display: none;
    visibility: hidden;
    opacity: 0;
}

.active-filters:empty {
    display: none;
}

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

/* Filter combination indicator - FIX ISSUE-006 */
.filter-combination-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
    margin-left: auto;
    font-weight: 500;
    cursor: help;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease-out;
}

.filter-combination-info:hover {
    background: #ffe082;
    border-color: #ffa000;
    transform: scale(1.05);
}

.filter-combination-info::before {
    content: 'ℹ️';
    font-size: 14px;
    margin-right: 4px;
}

.filter-combination-info.visible {
    display: inline-flex !important;
    opacity: 1;
    transform: translateX(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Count update animation - FIX ISSUE-003 & ISSUE-009 */
#stats-info,
#total-products-count {
    transition: opacity 0.2s ease, color 0.3s ease, transform 0.3s ease;
}

#stats-info.updating,
#total-products-count.updating {
    opacity: 0.7;
    position: relative;
    color: #4caf50;
    transform: scale(1.05);
}

#stats-info.updating::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

/* Smooth count transition - FIX ISSUE-009 */
.count-updating {
    transition: color 0.3s ease-in-out, transform 0.3s ease-in-out;
    color: #4caf50;
    transform: scale(1.1);
    font-weight: 600;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Search input loading state - FIX ISSUE-001 */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper.loading {
    position: relative;
}

.search-input-wrapper.loading::after {
    content: '';
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(76, 175, 80, 0.3);
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 1;
}

.search-input-wrapper.loading .search-input {
    padding-right: 60px;
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

/* Enhanced search input feedback */
#search-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    outline: none;
}

/* Progress indicator enhancements */
.loading-progress-container {
    margin: 15px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.progress-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls select,
.items-per-page-controls select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

.items-per-page-controls {
    display: flex;
    align-items: center;
}

.btn-icon {
    padding: 6px 12px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.selection-hint {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
    font-style: italic;
}

.active-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #e3f2fd;
    border-radius: 6px;
    border: 1px solid #90caf9;
    flex-wrap: wrap;
}

.active-filters-label {
    font-size: 13px;
    color: #1976d2;
    font-weight: 500;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: white;
    border: 1px solid #1976d2;
    border-radius: 16px;
    font-size: 12px;
    color: #1976d2;
}

.filter-chip .chip-label {
    font-weight: 500;
}

.filter-chip .chip-remove {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    transition: background 0.2s;
}

.filter-chip .chip-remove:hover {
    background: #1976d2;
    color: white;
}

/* Color coding for filter chips */
.filter-chip.status-active {
    background: #E8F5E9;
    border-color: #4CAF50;
    color: #2E7D32;
}

.filter-chip.status-draft {
    background: #FFF3E0;
    border-color: #FF9800;
    color: #E65100;
}

.filter-chip.status-archived {
    background: #F5F5F5;
    border-color: #9E9E9E;
    color: #616161;
}

.filter-chip.sales-channel-pos-only {
    background: #E3F2FD;
    border-color: #2196F3;
    color: #1565C0;
}

.filter-chip.sales-channel-online-only {
    background: #F3E5F5;
    border-color: #9C27B0;
    color: #6A1B9A;
}

.filter-chip.sales-channel-online-store {
    background: #E1F5FE;
    border-color: #03A9F4;
    color: #0277BD;
}

/* Smooth transitions for active filters container */
.active-filters {
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.active-filters.active-filters-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Count update animation */
#total-products-count.count-updating {
    animation: countUpdate 0.5s ease;
    color: #2196F3;
}

@keyframes countUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #1976D2; }
    100% { transform: scale(1); }
}

/* Empty state styles */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 40px 0;
    display: none;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 12px;
    font-weight: 600;
}

.empty-state-message {
    font-size: 16px;
    color: #666;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.empty-state-message .btn-link {
    font-weight: 600;
    text-decoration: underline;
    margin: 0 4px;
}

/* Filter change feedback */
.filter-select {
    transition: all 0.2s ease;
}

.filter-select.applying {
    background-color: #E3F2FD;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.filter-select:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

.filter-loading-spinner {
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}

.filter-loading-spinner .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

/* Enhanced performance metrics */
.performance-info {
    position: relative;
    cursor: help;
}

.performance-info:hover .performance-details {
    display: block;
}

.performance-details {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    margin-bottom: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.performance-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.performance-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.performance-label {
    font-weight: 500;
    min-width: 100px;
}

.performance-value {
    font-weight: 600;
    color: #4CAF50;
}

.performance-bar {
    height: 4px;
    background: #4CAF50;
    border-radius: 2px;
    min-width: 20px;
}

.btn-link {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
    margin-left: auto;
}

.btn-link:hover {
    color: #1565c0;
}

/* Smooth selection animations */
.product-card {
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.product-card:hover:not(.selected) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.product-card.selected {
    transform: scale(1.02);
    animation: selectPulse 0.3s ease;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.product-card:hover::before {
    opacity: 0.05;
    background: #1976d2;
}

@keyframes selectPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1.02);
    }
}

.selection-toolbar {
    animation: slideDown 0.3s ease;
}

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

/* Export progress indicator */
.export-progress,
.preview-progress {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 4px;
}

.export-progress.active,
.preview-progress.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Improved loading skeleton */
.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Responsive skeleton layout */
@media (max-width: 1024px) {
    .loading-skeleton {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .loading-skeleton {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .loading-skeleton {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .loading-skeleton {
        grid-template-columns: repeat(3, 1fr);
    }
}

.skeleton-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-content {
    padding: 15px;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 8px;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-line.short {
    width: 60%;
}

@keyframes skeletonPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes skeletonShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Enterprise-grade image lazy loading styles */
.product-image-lazy {
    /* Native lazy loading handles the loading state */
    /* We just provide a subtle background while loading */
    transition: opacity 0.3s ease-in-out;
}

.product-image-lazy.product-image-loaded {
    /* Image has loaded successfully */
    opacity: 1;
}

/* Error state: Only apply grayscale to images that actually failed to load */
.product-image-error {
    /* Only show error styling for actual failed images, not placeholders */
    opacity: 0.7;
    /* Removed grayscale filter - let placeholder image show naturally */
    /* If you want to indicate error, use a different visual cue like a border */
    border: 2px dashed #ccc;
}

.selection-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 4px;
    border: 1px solid #90caf9;
    flex-wrap: wrap;
    gap: 15px;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #1976d2;
    font-weight: 500;
}

.selection-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-export {
    background: #1976d2;
    color: white;
}

.btn-export:hover {
    background: #1565c0;
}

.btn-export:disabled {
    background: #90caf9;
    cursor: not-allowed;
}

.product-card {
    position: relative;
}

.product-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    accent-color: #1976d2;
}

.product-card.selected {
    border: 2px solid #1976d2;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.stats-info {
    color: #666;
    font-size: 14px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.product-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-image {
    width: 100%;
    height: 250px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 15px;
}

.product-title {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-details {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.product-details strong {
    color: #333;
}

.inventory-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.inventory-high {
    background: #e8f5e9;
    color: #2e7d32;
}

.inventory-medium {
    background: #fff3e0;
    color: #e65100;
}

.inventory-low {
    background: #ffebee;
    color: #c62828;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-inactive {
    background: #f5f5f5;
    color: #999;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pagination button:hover:not(:disabled) {
    background: #f5f5f5;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.pagination-loading {
    position: relative;
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.pagination-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: pagination-spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

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

.pagination .page-info {
    padding: 8px 16px;
    color: #666;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.error {
    padding: 15px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    margin-bottom: 20px;
}

.warning {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    margin-bottom: 20px;
}

.success {
    padding: 15px;
    background: #d4edda;
    border: 1px solid #28a745;
    border-radius: 4px;
    color: #155724;
    margin-bottom: 20px;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus,
a:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #ddd;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Disabled state */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-visible {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10000 !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
    z-index: 1001;
}

.modal-content-small {
    max-width: 500px;
}

.modal-content-medium {
    max-width: 600px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.product-detail-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.product-detail-image img {
    width: 100%;
    height: auto;
    display: block;
}

.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.product-detail-section {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.product-detail-section h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.variants-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.variants-table th,
.variants-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.variants-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 12px;
    text-transform: uppercase;
}

.variants-table tr:hover {
    background: #f8f9fa;
}

@media (max-width: 768px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Print styles */
@media print {
    .header,
    .filters-section,
    .selection-toolbar,
    .stats-bar,
    .pagination,
    .product-checkbox,
    .modal {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        box-shadow: none;
        padding: 0;
    }
}

.size-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.size-badge {
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 11px;
    color: #666;
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    .product-checkbox {
        width: 28px;
        height: 28px;
    }
    
    .btn,
    .filter-chip .chip-remove {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    .filter-chip {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 20px;
    }

    .filters-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .filter-group:last-of-type {
        grid-column: 1 / -1;
    }

    .filter-group-button {
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
    }

    .btn-clear-filters {
        font-size: 12px;
        padding: 6px 12px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    h1 {
        font-size: 24px;
    }

    .filters-section {
        padding: 15px;
    }

    .filters-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .filter-group:last-of-type {
        grid-column: 1;
    }

    .filter-group label {
        font-size: 11px;
    }

    .filter-group input,
    .filter-group select {
        padding: 8px;
        font-size: 14px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .last-checked {
        width: 100%;
    }

    .stats-info {
        font-size: 13px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-image {
        height: 200px;
    }

    .product-info {
        padding: 12px;
    }

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

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

    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagination button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .pagination .page-info {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* SKU/Barcode Enhancement Styles */
.sku-barcode-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sku-value,
.barcode-value {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.custom-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-sku-badge {
    background: #e3f2fd;
    color: #1976d2;
}

.custom-barcode-badge {
    background: #f3e5f5;
    color: #7b1fa2;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-qr-code {
    padding: 4px 12px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-qr-code:hover {
    background: #45a049;
}

.btn-qr-code:focus {
    outline: 2px solid #4caf50;
    outline-offset: 2px;
}

.variant-actions {
    display: flex;
    gap: 8px;
}

.btn-edit-sku-barcode {
    padding: 4px 12px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-edit-sku-barcode:hover {
    background: #1976d2;
}

.btn-edit-sku-barcode:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* QR Code Modal Styles */
.qr-code-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.qr-code-info p {
    margin: 8px 0;
    font-size: 14px;
}

.qr-code-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    min-height: 250px;
}

.qr-code-placeholder {
    padding: 20px;
    text-align: center;
    color: #666;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

/* Edit SKU/Barcode Modal Styles */
.edit-sku-barcode-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.variant-info-display {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
}

.variant-info-display p {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.form-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.form-hint {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.variants-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.variants-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid #e0e0e0;
}

.variants-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    vertical-align: middle;
}

.variants-table tr:hover {
    background: #f8f9fa;
}

.variant-row {
    transition: background-color 0.2s;
}

/* Responsive adjustments for variants table */
@media (max-width: 768px) {
    .variants-table {
        font-size: 12px;
    }
    
    .variants-table th,
    .variants-table td {
        padding: 8px;
    }
    
    .sku-barcode-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .custom-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px;
        border-radius: 4px;
    }

    h1 {
        font-size: 20px;
    }

    .back-link {
        font-size: 13px;
    }

    .filters-section {
        padding: 12px;
    }

    .filters-row {
        gap: 10px;
    }

    .stats-bar {
        padding: 10px;
    }

    .stats-info {
        font-size: 12px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .product-image {
        height: 180px;
    }

    .product-title {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .product-details {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .size-list {
        gap: 4px;
    }

    .size-badge {
        padding: 2px 5px;
        font-size: 10px;
    }

    .inventory-badge,
    .status-badge {
        font-size: 10px;
        padding: 3px 6px;
    }

    .pagination {
        flex-direction: column;
        width: 100%;
    }

    .pagination button {
        width: 100%;
        padding: 10px;
    }

    .pagination .page-info {
        width: 100%;
        text-align: center;
        padding: 8px;
    }

    .empty-state {
        padding: 40px 15px;
    }

    .empty-state svg {
        width: 48px;
        height: 48px;
    }

    .loading {
        padding: 30px 15px;
        font-size: 14px;
    }
}

/* Tablet specific adjustments */
@media (min-width: 481px) and (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-image {
        height: 150px;
    }
}

/* PDF Fields Modal Styles - Moved from inline styles for enterprise-grade compliance */
.pdf-fields-modal-description {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

.pdf-fields-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.field-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
    background: #fafafa;
}

.field-checkbox:hover {
    border-color: #1976d2;
    background: #f0f7ff;
}

.field-checkbox input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1976d2;
}

.field-checkbox-label {
    font-weight: 500;
}

.field-checkbox-hint {
    font-size: 11px;
    color: #888;
    margin-left: 6px;
}

.pdf-fields-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-fields-actions-left {
    display: flex;
    gap: 10px;
}

.pdf-fields-actions-right {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.pdf-fields-btn-small {
    font-size: 13px;
}

.pdf-fields-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Hidden by default - shown via JavaScript */
.hidden {
    display: none !important;
}

/* Utility classes for common display states */
.display-none {
    display: none;
}

.display-block {
    display: block;
}

.display-flex {
    display: flex;
}

/* Responsive adjustments for PDF fields modal */
@media (max-width: 768px) {
    .pdf-fields-selection {
        grid-template-columns: 1fr;
    }
    
    .pdf-fields-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .pdf-fields-actions-right {
        width: 100%;
    }
}

/* Noscript fallback styles */
.noscript-fallback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.noscript-fallback-content h1 {
    margin-bottom: 20px;
    color: #333;
}

.noscript-fallback-content p {
    margin-bottom: 15px;
    color: #666;
    line-height: 1.6;
}

.noscript-fallback-content a {
    color: #1976d2;
    text-decoration: underline;
}

/* Empty state styles - moved from inline styles */
.empty-state-message {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.empty-state-action {
    margin-top: 15px;
}

/* Error message help text */
.error-help-text {
    margin-top: 10px;
    font-size: 13px;
}

/* Last checked status indicator */
.last-checked-status {
    margin-left: 8px;
}

/* Inventory by size section */
.inventory-by-size {
    margin-top: 10px;
}

.inventory-size-list {
    margin-top: 5px;
}

