/* --- Custom Product Table Styles --- */

/* 1. Table Header Styling */
#custom-wcpt-table thead th {
    /* Set the requested background color */
    background-color: #134bcd; 
    color: #ffffff; /* Ensure text is white for contrast */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 12px 10px;
    border: none; /* Remove any default borders */
}

#custom-wcpt-table thead th:first-child {
    border-top-left-radius: 18px;
}

#custom-wcpt-table thead th:last-child {
    border-top-right-radius: 18px;
}

/* 2. Table Body and Rows */
#custom-wcpt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px; /* Add small vertical space between rows */
    margin-top: 20px;
}

#custom-wcpt-table tbody tr {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s;
    border-radius: 8px; /* Slight rounding for rows */
}

#custom-wcpt-table tbody tr:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#custom-wcpt-table tbody td {
    padding: 10px;
    vertical-align: middle;
}

/* Specific Column Adjustments */

/* Image Column */
#custom-wcpt-table .product-table-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

/* Price Column */
#custom-wcpt-table .cwpt-col-price {
    font-weight: 600;
    color: #1a1a1a;
}

/* 3. Quantity Input Box Styling */
#custom-wcpt-table .cwpt-col-add-to-cart .quantity input.qty {
    /* Set the requested width */
    width: 3.6em; 
    height: 40px;
    /* Set the requested radius */
    border-radius: 18px; 
    border: 1px solid #ccc;
    text-align: center;
    padding: 5px 0;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-sizing: border-box; /* Crucial for width calculation */
}

#custom-wcpt-table .cwpt-col-add-to-cart .quantity input.qty:focus {
    border-color: #134bcd;
    outline: none;
}

/* 4. Add to Cart Button Styling */
#custom-wcpt-table .cwpt-col-add-to-cart  {
    min-width: 160px;
}
#custom-wcpt-table .ajax_add_to_cart {
    /* Set the requested background color (same as header) */
    background-color: #134bcd !important; 
    color: #ffffff !important;
    border: none !important;
    padding: 13px 15px;
    border-radius: 18px; /* Consistent rounding */
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s;
    text-decoration: none;
    white-space: nowrap; /* Prevent text from wrapping */
    text-align: center;
    display: inline-flex; /* Better vertical centering */
    align-items: center;
    justify-content: center;
    line-height: 1; /* Perfect alignment */
}

#custom-wcpt-table .ajax_add_to_cart:hover,
#custom-wcpt-table .ajax_add_to_cart.loading {
    background-color: #0f3f9f !important; /* Slightly darker blue on hover/loading */
}

/* Filters Bar Layout */
#cwpt-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.cwpt-filter-control-wrapper {
    flex-grow: 1;
    min-width: 150px;
}

.cwpt-filter-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
}

/* Loading State Overlay */
#custom-wcpt-wrapper.is-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

#custom-wcpt-wrapper.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    margin-left: -20px;
    border-radius: 50%;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #134bcd;
    animation: spin 1s linear infinite;
}

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