/**
 * Frontend styles for Advanced Woo Product Table Pro
 */

:root {
    --awptp-primary: #3858e9;
    --awptp-primary-hover: #2544c7;
    --awptp-font-primary: 'Inter', sans-serif;
    --awptp-font-heading: 'Outfit', sans-serif;
    --awptp-border-radius: 8px;
    --awptp-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.awptp-table-wrapper {
    font-family: var(--awptp-font-primary);
    margin: 20px 0;
    position: relative;
    color: #333333;
}

/* Control area (Search, Bulk Buttons) */
.awptp-table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.awptp-search-box-wrap {
    position: relative;
    width: 100%;
    max-width: 350px;
}

.awptp-search-input {
    width: 100% !important;
    padding: 10px 40px 10px 15px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 30px !important;
    background: #ffffff !important;
    font-size: 14px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02) !important;
    transition: var(--awptp-transition) !important;
}

.awptp-search-input:focus {
    border-color: var(--awptp-primary) !important;
    box-shadow: 0 0 0 3px rgba(56, 88, 233, 0.15) !important;
    outline: none !important;
}

.awptp-search-box-wrap .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #8c8f94;
    pointer-events: none;
}

/* Bulk actions */
.awptp-bulk-add-btn {
    background: var(--awptp-primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--awptp-transition) !important;
}

.awptp-bulk-add-btn:hover:not(:disabled) {
    background: var(--awptp-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(56, 88, 233, 0.2);
}

.awptp-bulk-add-btn:disabled {
    background: #e9ecef !important;
    color: #adb5bd !important;
    cursor: not-allowed;
}

/* Responsive Table layout */
.awptp-table-responsive-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: var(--awptp-border-radius);
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    position: relative;
}

/* Table element */
.awptp-table-el {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    text-align: left;
    font-size: 14px;
}

/* Headers */
.awptp-table-el thead th {
    background: #f8f9fa;
    padding: 15px 20px;
    font-family: var(--awptp-font-heading);
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    user-select: none;
    position: relative;
}

.awptp-table-el thead th.sortable {
    cursor: pointer;
    padding-right: 35px;
    transition: background 0.2s ease;
}

.awptp-table-el thead th.sortable:hover {
    background: #e9ecef;
}

.awptp-table-el thead th .sort-indicator {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #adb5bd;
}

.awptp-table-el thead th.sorted-asc .sort-indicator,
.awptp-table-el thead th.sorted-desc .sort-indicator {
    color: var(--awptp-primary);
}

/* Table Rows */
.awptp-table-el tbody tr {
    border-bottom: 1px solid #dee2e6;
    transition: var(--awptp-transition);
}

.awptp-table-el tbody tr:last-child {
    border-bottom: none;
}

.awptp-table-el tbody tr:hover {
    background-color: #fafbfc;
}

.awptp-table-el tbody td {
    padding: 15px 20px;
    vertical-align: middle;
}

/* Row elements styling */
.awptp-product-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.awptp-product-link {
    font-family: var(--awptp-font-heading);
    font-weight: 600;
    color: #212529;
    text-decoration: none;
    transition: color 0.2s ease;
}

.awptp-product-link:hover {
    color: var(--awptp-primary);
}

/* Price */
.awptp-table-el .price {
    font-weight: 600;
    color: #212529;
}

.awptp-table-el .price del {
    color: #8c8f94;
    font-weight: 400;
    margin-right: 5px;
    font-size: 0.9em;
}

.awptp-table-el .price ins {
    text-decoration: none;
    color: #d9534f;
}

/* Stock status */
.awptp-stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: center;
}

.awptp-stock-badge.in-stock {
    background: #d1e7dd;
    color: #0f5132;
}

.awptp-stock-badge.out-stock {
    background: #f8d7da;
    color: #842029;
}

.awptp-stock-badge.backorder {
    background: #fff3cd;
    color: #664d03;
}

/* Cart cell controls */
.awptp-cart-cell-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.awptp-qty-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #ffffff;
    overflow: hidden;
}

.awptp-qty-wrap .qty-btn {
    background: #f8f9fa;
    border: none;
    width: 30px;
    height: 32px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.awptp-qty-wrap .qty-btn:hover {
    background: #e9ecef;
}

.awptp-qty-wrap .awptp-qty-input {
    width: 45px !important;
    height: 32px !important;
    border: none !important;
    border-left: 1px solid #dee2e6 !important;
    border-right: 1px solid #dee2e6 !important;
    text-align: center !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    -moz-appearance: textfield !important;
}

.awptp-qty-input::-webkit-outer-spin-button,
.awptp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.awptp-add-to-cart-btn {
    background: var(--awptp-primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: var(--awptp-transition) !important;
}

.awptp-add-to-cart-btn:hover {
    background: var(--awptp-primary-hover) !important;
}

.awptp-add-to-cart-btn.added {
    background: #198754 !important;
}

.awptp-add-to-cart-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

/* Skeleton Loading Screens */
.awptp-table-skeleton-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.awptp-table-wrapper.loading .awptp-table-skeleton-overlay {
    display: flex;
}

.awptp-skeleton-loader {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--awptp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Pagination styles */
.awptp-table-footer {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}

.awptp-pagination-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.awptp-pagination-list a.pagi-link {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #212529;
    text-decoration: none;
    font-weight: 500;
    transition: var(--awptp-transition);
}

.awptp-pagination-list a.pagi-link:hover {
    border-color: var(--awptp-primary);
    color: var(--awptp-primary);
}

.awptp-pagination-list a.pagi-link.active {
    background: var(--awptp-primary);
    border-color: var(--awptp-primary);
    color: #ffffff;
}

/* Load More button */
.awptp-load-more-btn {
    background: #ffffff !important;
    border: 1px solid var(--awptp-primary) !important;
    color: var(--awptp-primary) !important;
    border-radius: 30px !important;
    padding: 12px 30px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: var(--awptp-transition) !important;
}

.awptp-load-more-btn:hover {
    background: var(--awptp-primary) !important;
    color: #ffffff !important;
}

/* Theme Presets: Glassmorphism */
.awptp-theme-glassmorphism .awptp-table-responsive-container {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

.awptp-theme-glassmorphism thead th {
    background: rgba(255, 255, 255, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25) !important;
}

.awptp-theme-glassmorphism tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Responsive Cards on mobile screen size */
@media (max-width: 768px) {
    .awptp-table-responsive-container {
        border: none;
        box-shadow: none;
    }
    
    .awptp-table-el,
    .awptp-table-el thead,
    .awptp-table-el tbody,
    .awptp-table-el th,
    .awptp-table-el td,
    .awptp-table-el tr {
        display: block;
    }

    .awptp-table-el thead {
        display: none; /* Hide standard headers */
    }

    .awptp-table-el tbody tr {
        background: #ffffff;
        border: 1px solid #dee2e6;
        border-radius: var(--awptp-border-radius);
        margin-bottom: 20px;
        padding: 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    }

    .awptp-table-el tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        text-align: right;
    }

    .awptp-table-el tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-family: var(--awptp-font-heading);
        text-align: left;
        color: #646970;
    }
    
    .awptp-col-bulk-check {
        justify-content: flex-start !important;
    }

    .awptp-col-bulk-check::before {
        content: "Select Product" !important;
    }
}
