/* Elementor Products Table Styles v2.1 - Enhanced with Cart Features */
/* Colors: #fff (white), #212121 (dark gray), #258071 (teal green) */

.products-table-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(33, 33, 33, 0.1);
    overflow: hidden;
    border: 1px solid #212121;
    position: relative;
}

/* Filters Section */
.products-filters {
    background: #258071;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
    border-bottom: 2px solid #212121;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.filter-group input,
.filter-group select {
    padding: 10px 14px;
    border: 2px solid #212121;
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    color: #212121;
    transition: all 0.3s ease;
    outline: none;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.filter-group input::placeholder {
    color: #666666;
}

#clear-filters {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 2px solid #ffffff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#clear-filters:hover {
    background: #ffffff;
    color: #258071;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Table Wrapper */
.products-table-wrapper {
    position: relative;
    min-height: 300px;
    background: #ffffff;
}

/* Loading Spinner */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #258071;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-spinner p {
    color: #212121;
    font-weight: 500;
    margin: 0;
}

/* Table Styles */
.products-table {
    overflow-x: auto;
    background: #ffffff;
}

.products-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.5;
}

.products-table thead th {
    background: #258071;
    color: #ffffff;
    font-weight: 700;
    text-align: left;
    padding: 16px 20px;
    border-bottom: 2px solid #212121;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 5;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

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

.products-table tbody tr {
    background: #ffffff;
    transition: all 0.2s ease;
    border-bottom: 1px solid #e0e0e0;
}

.products-table tbody tr:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 33, 33, 0.1);
}

.products-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.products-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

.products-table td {
    padding: 14px 20px;
    vertical-align: middle;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #f0f0f0;
    color: #212121;
}

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

/* Product Image */
.product-image {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    transition: transform 0.2s ease;
}

.product-image:hover {
    transform: scale(1.1);
    border-color: #258071;
}

/* Product Name Link */
.product-name {
    color: #212121;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    display: block;
}

.product-name:hover {
    color: #258071;
    text-decoration: underline;
}

/* SKU */
.product-sku {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #212121;
    display: inline-block;
    border: 1px solid #e0e0e0;
}

/* Price */
.product-price {
    font-weight: 700;
    color: #258071;
    font-size: 16px;
}

/* Stock Status */
.stock-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-status.instock {
    background: #e8f5e8;
    color: #258071;
    border: 1px solid #258071;
}

.stock-status.outofstock {
    background: #ffeaea;
    color: #d32f2f;
    border: 1px solid #d32f2f;
}

.stock-status.onbackorder {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #f57c00;
}

/* Categories */
.product-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-tag {
    background: #f0f0f0;
    color: #212121;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
    border: 1px solid #e0e0e0;
}

/* Add to Cart Buttons */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    min-width: 120px;
}

.add-to-cart-btn,
.select-options-btn {
    background: #258071;
    color: #ffffff;
    border: 2px solid #258071;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 100px;
    text-align: center;
    white-space: nowrap;
}

.add-to-cart-btn:hover,
.select-options-btn:hover {
    background: #212121;
    border-color: #212121;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.add-to-cart-btn:disabled,
.select-options-btn:disabled {
    background: #cccccc;
    border-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.add-to-cart-btn.loading,
.select-options-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.add-to-cart-btn.loading::after,
.select-options-btn.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 6px;
}

.quantity-input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
}

/* Variations Modal */
.variations-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid #212121;
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #258071;
    color: #ffffff;
    border-radius: 10px 10px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #ffffff;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
}

.variation-option {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.variation-option:hover {
    border-color: #258071;
    background: #f8f9fa;
}

.variation-option.selected {
    border-color: #258071;
    background: #e8f5e8;
}

.variation-name {
    font-weight: 600;
    color: #212121;
    margin-bottom: 4px;
}

.variation-price {
    color: #258071;
    font-weight: 700;
}

.variation-sku {
    font-size: 12px;
    color: #666666;
    font-family: monospace;
}

.quantity-group {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.quantity-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #212121;
}

#product-quantity {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

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

.modal-cancel,
.modal-add-to-cart {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid;
}

.modal-cancel {
    background: #ffffff;
    color: #212121;
    border-color: #212121;
}

.modal-cancel:hover {
    background: #f0f0f0;
}

.modal-add-to-cart {
    background: #258071;
    color: #ffffff;
    border-color: #258071;
}

.modal-add-to-cart:hover:not(:disabled) {
    background: #1e6b5c;
    border-color: #1e6b5c;
}

.modal-add-to-cart:disabled {
    background: #cccccc;
    border-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

/* Cart Notification */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

.notification-content {
    background: #258071;
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 2px solid #212121;
}

.notification-content.error {
    background: #d32f2f;
}

.notification-content.success {
    background: #258071;
}

.notification-message {
    flex: 1;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Pagination */
.products-pagination {
    background: #f8f9fa;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #212121;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    color: #212121;
    font-size: 14px;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-controls button {
    background: #ffffff;
    border: 2px solid #212121;
    color: #212121;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-controls button:hover:not(:disabled) {
    background: #258071;
    color: #ffffff;
    border-color: #258071;
    transform: translateY(-1px);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    color: #999999;
}

#page-numbers {
    display: flex;
    gap: 4px;
}

.page-number {
    background: #ffffff;
    border: 2px solid #212121;
    color: #212121;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background: #f0f0f0;
    border-color: #258071;
}

.page-number.active {
    background: #258071;
    color: #ffffff;
    border-color: #258071;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #212121;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #212121;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
    color: #666666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .products-filters {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .filter-group {
        min-width: auto;
        width: 100%;
    }
    
    .products-table {
        font-size: 12px;
    }
    
    .products-table thead th,
    .products-table td {
        padding: 10px 8px;
    }
    
    .product-image {
        width: 40px;
        height: 40px;
    }
    
    .products-pagination {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .product-actions {
        min-width: 100px;
    }
    
    .add-to-cart-btn,
    .select-options-btn {
        padding: 6px 12px;
        font-size: 11px;
        min-width: 90px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .cart-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    /* Hide less important columns on mobile */
    .products-table .hide-mobile {
        display: none;
    }
}

@media (max-width: 480px) {
    .products-table-container {
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
    }
    
    .products-filters {
        padding: 12px;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 8px 12px;
    }
    
    .products-table thead th,
    .products-table td {
        padding: 8px 6px;
    }
    
    .product-categories {
        flex-direction: column;
    }
    
    .category-tag {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .add-to-cart-btn,
    .select-options-btn {
        padding: 4px 8px;
        font-size: 10px;
        min-width: 80px;
    }
}

/* Animation for table rows */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.products-table tbody tr {
    animation: fadeInUp 0.3s ease forwards;
}

.products-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.products-table tbody tr:nth-child(2) { animation-delay: 0.2s; }
.products-table tbody tr:nth-child(3) { animation-delay: 0.3s; }
.products-table tbody tr:nth-child(4) { animation-delay: 0.4s; }
.products-table tbody tr:nth-child(5) { animation-delay: 0.5s; }

/* Focus states for accessibility */
.products-table-container input:focus,
.products-table-container select:focus,
.products-table-container button:focus {
    outline: 2px solid #258071;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .products-table-container {
        border: 3px solid #212121;
    }
    
    .products-filters {
        border-bottom: 3px solid #212121;
    }
    
    .products-table thead th {
        border-bottom: 3px solid #212121;
    }
}


/* Quantity field styling in modal */
.quantity-group {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.quantity-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #212121;
    font-size: 14px;
}

.quantity-group input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid #258071;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    background: #ffffff;
    color: #212121;
    transition: all 0.3s ease;
}

.quantity-group input[type="number"]:focus {
    outline: none;
    border-color: #212121;
    box-shadow: 0 0 0 3px rgba(37, 128, 113, 0.1);
}

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

.quantity-group input[type="number"] {
    -moz-appearance: textfield;
}

/* Quantity input in table */
.product-actions .quantity-input {
    width: 60px;
    padding: 4px 8px;
    margin-right: 8px;
    border: 1px solid #258071;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.product-actions .quantity-input:focus {
    outline: none;
    border-color: #212121;
}

/* Modal improvements */
.modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.variations-modal .modal-content {
    max-width: 500px;
    margin: 5% auto;
}

@media (max-width: 768px) {
    .variations-modal .modal-content {
        margin: 10% 20px;
        max-width: none;
    }
    
    .quantity-group {
        margin: 15px 0;
        padding: 12px;
    }
    
    .quantity-group input[type="number"] {
        width: 80px;
        font-size: 14px;
    }
}

