/**
 * WooCommerce Products Table - Public Styles
 */

/* Table Container */
.wpt-products-table-wrapper {
    margin: 30px 0;
    clear: both;
}

.wpt-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

/* Table Styles */
.wpt-products-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wpt-products-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.wpt-products-table thead th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.wpt-products-table thead th:hover {
    background: #e9ecef;
}

/* Sort Indicators */
.wpt-sort-indicator {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
}

.wpt-sort-indicator::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #212529;
    margin-bottom: 2px;
}

.wpt-sort-indicator::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #212529;
}

.wpt-products-table thead th.wpt-sorted-asc .wpt-sort-indicator::before,
.wpt-products-table thead th.wpt-sorted-desc .wpt-sort-indicator::after {
    opacity: 1;
}

.wpt-products-table thead th.wpt-sorted-asc .wpt-sort-indicator,
.wpt-products-table thead th.wpt-sorted-desc .wpt-sort-indicator {
    opacity: 1;
}

/* Table Body */
.wpt-products-table tbody tr {
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s;
}

.wpt-products-table tbody tr:hover {
    background: #f8f9fa;
}

.wpt-products-table tbody td {
    padding: 15px 12px;
    vertical-align: middle;
    font-size: 14px;
    color: #495057;
}

/* Column Specific Styles */
.wpt-column-image {
    width: 100px;
    text-align: center;
}

.wpt-column-image img {
    max-width: 80px;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

.wpt-column-title {
    min-width: 200px;
}

.wpt-product-title {
    font-weight: 600;
    color: #212529;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 5px;
}

.wpt-product-title:hover {
    color: #0066cc;
    text-decoration: underline;
}

.wpt-product-excerpt {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    line-height: 1.4;
}

.wpt-column-price {
    min-width: 100px;
    font-weight: 600;
}

.wpt-column-price .price {
    font-size: 16px;
    color: #28a745;
}

.wpt-column-price del {
    opacity: 0.6;
    margin-right: 5px;
}

.wpt-column-price ins {
    text-decoration: none;
    font-weight: 700;
}

.wpt-column-stock {
    min-width: 120px;
}

.wpt-stock-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.wpt-stock-instock {
    background: #d4edda;
    color: #155724;
}

.wpt-stock-outofstock {
    background: #f8d7da;
    color: #721c24;
}

.wpt-stock-onbackorder {
    background: #fff3cd;
    color: #856404;
}

.wpt-stock-qty {
    font-weight: normal;
    opacity: 0.8;
}

.wpt-column-add_to_cart {
    min-width: 140px;
    text-align: center;
}

.wpt-column-add_to_cart .button {
    width: 100%;
    max-width: 130px;
    padding: 8px 15px;
    font-size: 13px;
}

/* Mobile Responsive - Scroll */
@media screen and (max-width: 768px) {
    .wpt-products-table-wrapper[data-mobile-behavior="scroll"] .wpt-table-container {
        border: 1px solid #dee2e6;
        border-radius: 4px;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="scroll"] .wpt-products-table {
        min-width: 800px;
    }
}

/* Mobile Responsive - Stack */
@media screen and (max-width: 768px) {
    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table,
    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table thead,
    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table tbody,
    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table th,
    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table td,
    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table tr {
        display: block;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table tbody tr {
        margin-bottom: 20px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table tbody tr:hover {
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table td {
        border: none;
        position: relative;
        padding: 10px 10px 10px 45%;
        text-align: left;
        min-height: 40px;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-products-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 10px;
        font-weight: 600;
        color: #212529;
        white-space: nowrap;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-column-image {
        text-align: left;
        padding-top: 15px;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-column-image img {
        max-width: 120px;
        margin: 0;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-column-add_to_cart {
        padding-top: 15px;
        text-align: left;
    }

    .wpt-products-table-wrapper[data-mobile-behavior="stack"] .wpt-column-add_to_cart .button {
        max-width: 100%;
    }
}

/* Loading State */
.wpt-products-table-wrapper.wpt-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wpt-products-table-wrapper.wpt-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: wpt-spin 1s linear infinite;
}

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

/* Empty State */
.wpt-no-products {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 4px;
    color: #6c757d;
}

.wpt-no-products p {
    margin: 0;
    font-size: 16px;
}

/* Print Styles */
@media print {
    .wpt-column-add_to_cart,
    .wpt-sort-indicator {
        display: none;
    }

    .wpt-products-table tbody tr:hover {
        background: transparent;
    }
}

/* Lightbox Styles */
#wpt-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

#wpt-lightbox.wpt-lightbox-active {
    display: block;
}

.wpt-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.wpt-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.wpt-lightbox-image {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    animation: lightboxZoomIn 0.3s ease-out;
}

@keyframes lightboxZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wpt-lightbox-caption {
    color: #fff;
    font-size: 16px;
    margin-top: 20px;
    text-align: center;
    max-width: 90%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.wpt-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #fff;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpt-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.wpt-lightbox-prev,
.wpt-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #fff;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpt-lightbox-prev {
    left: 30px;
}

.wpt-lightbox-next {
    right: 30px;
}

.wpt-lightbox-prev:hover,
.wpt-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.wpt-lightbox-open {
    overflow: hidden;
}

/* Product image cursor */
.wpt-product-image.wpt-lightbox {
    cursor: zoom-in;
}

/* Mobile lightbox adjustments */
@media screen and (max-width: 768px) {
    .wpt-lightbox-image {
        max-width: 95%;
        max-height: 80vh;
    }

    .wpt-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 30px;
        line-height: 34px;
    }

    .wpt-lightbox-prev,
    .wpt-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 30px;
        line-height: 34px;
    }

    .wpt-lightbox-prev {
        left: 10px;
    }

    .wpt-lightbox-next {
        right: 10px;
    }

    .wpt-lightbox-caption {
        font-size: 14px;
        margin-top: 15px;
    }
}
