/**
 * Frontend CSS for Grouped Products Display
 * 
 * Styles for the grouped product display on category pages.
 * Based on the original barrel-size-grouping styles.
 * 
 * @package Honor_Child
 * @version 1.4.0 - Added clickable category header links
 */

/* Main Wrapper */
.honor-grouped-products-wrapper {
    margin: 30px 0;
    clear: both;
}

/* Individual Product Group Section */
.honor-product-group {
    margin-bottom: 60px;
    padding: 30px 0;
}

.honor-product-group:not(:last-child) {
    border-bottom: 3px solid #f0f0f0;
}

/* Group Header */
.honor-group-header {
    margin-bottom: 25px;
}

.honor-group-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 25px 0;
    padding: 15px 20px;
    background: linear-gradient(135deg, #efa758 0%, #e8b12e 100%);
    color: #fff !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.honor-group-title .group-name {
    font-size: 32px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.honor-group-title .group-count {
    font-size: 18px;
    font-weight: 400;
    opacity: 0.9;
}

/* Category Title Link (for clickable category headers) */
.honor-group-title .group-title-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: #fff !important;
    text-decoration: none !important;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.honor-group-title .group-title-link:hover {
    opacity: 0.9;
    transform: translateX(5px);
}

.honor-group-title .group-title-link:focus {
    outline: 2px solid #fff;
    outline-offset: -4px;
    border-radius: 4px;
}

.honor-group-title .group-title-link .group-name,
.honor-group-title .group-title-link .group-count {
    pointer-events: none;
}

/* Group Products Container */
.honor-group-products {
    margin-top: 20px;
}

.honor-group-products .product_table {
    margin-top: 20px;
}

/* Standard WooCommerce Grid Fallback */
.honor-group-products .products {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Color Variations */
.honor-group-title.color-variant-1 {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

.honor-group-title.color-variant-2 {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.honor-group-title.color-variant-3 {
    background: linear-gradient(135deg, #2c5282 0%, #3182ce 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .honor-group-title {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 12px 15px;
    }
    
    .honor-group-title .group-name {
        font-size: 24px;
    }
    
    .honor-group-title .group-count {
        font-size: 16px;
    }
    
    .honor-group-title .group-title-link {
        flex-direction: column;
        gap: 10px;
    }
    
    .honor-group-title .group-title-link:hover {
        transform: none;
        opacity: 0.95;
    }
    
    .honor-product-group {
        margin-bottom: 40px;
        padding: 20px 0;
    }
}

@media (max-width: 480px) {
    .honor-group-title .group-name {
        font-size: 20px;
    }
    
    .honor-group-title .group-count {
        font-size: 14px;
    }
    
    .honor-grouped-products-wrapper {
        margin: 20px 0;
    }
}

/* Print Styles */
@media print {
    .honor-group-title {
        background: #333 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Accessibility */
.honor-group-title:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Loading State (for AJAX enhancements) */
.honor-group-products.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.honor-group-products.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 #3b82f6;
    border-radius: 50%;
    animation: honor-spinner 1s linear infinite;
}

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

/* Empty State */
.honor-group-products .woocommerce-info {
    padding: 20px;
    background: #f9f9f9;
    border-left: 4px solid #2271b1;
    margin: 20px 0;
}

/* Integration with WooProductTable */
.honor-group-products .woo-product-table {
    margin: 20px 0;
}

/* ===================================
   TABLE VIEW STYLES
   =================================== */

.honor-products-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
}

.honor-products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    margin-top: 20px;
    border: 1px solid #e5e5e5;
}

.honor-products-table thead {
    background: #f7f7f7;
}

.honor-products-table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    background: #949493 !important;
    color: #ffffff !important;
    border-bottom: 2px solid #e5e5e5;
}

.honor-products-table tbody tr {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    transition: background 0.2s ease;
}

.honor-products-table tbody tr:hover {
    background: #f9f9f9;
}

.honor-products-table tbody tr:last-child td {
    border-bottom: none;
}

.honor-products-table tbody td {
    padding: 15px;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: middle;
    font-size: 14px;
}

.honor-products-table .product-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.honor-products-table .product-image {
    width: 140px;
    text-align: center;
    padding: 10px;
}

.honor-products-table .product-image img {
    max-width: 120px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 3px;
}

.honor-products-table .product-name {
    min-width: 250px;
}

.honor-products-table .product-name a.product-title-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.honor-products-table .product-name a.product-title-link:hover {
    color: #0073aa;
}

.honor-products-table .product-sku-mobile {
    display: none;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}
    color: #718096;
    margin-top: 5px;
    line-height: 1.4;
}

.honor-products-table .product-sku {
    min-width: 100px;
    color: #666;
    font-size: 13px;
    min-width: 100px;
}

.honor-products-table .product-price {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    min-width: 80px;
}

.honor-products-table .product-price .woocommerce-Price-amount {
    font-weight: 600;
}

.honor-products-table .product-stock {
    min-width: 150px;
}

.honor-products-table .stock-status {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
}

.honor-products-table .stock-status.instock {
    color: #0f834d;
    background: #e7f5ec;
}

.honor-products-table .stock-status.outofstock {
    color: #cc1818;
    background: #ffe9e9;
}

.honor-products-table .stock-status.onbackorder {
    color: #cc5d00;
    background: #fff3e6;
}

.honor-products-table .product-actions {
    min-width: 120px;
    text-align: center;
}

.honor-products-table .product-actions .button {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 3px;
    background: #f9a826;
    color: #fff;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s ease;
    margin: 0;
}

.honor-products-table .product-actions .button:hover {
    background: #e09616;
}

.honor-products-table .product-actions .added_to_cart {
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
}

@media screen and (max-width: 992px) {
    .honor-products-table .product-sku {
        display: none;
    }
    .honor-products-table .product-sku-mobile {
        display: block;
    }
}

@media (max-width: 768px) {
    .honor-products-table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .honor-products-table thead {
        display: none;
    }
    
    .honor-products-table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #e5e5e5;
        border-radius: 5px;
    }
    
    .honor-products-table tbody td {
        display: block;
        width: 100% !important;
        text-align: left;
        padding: 10px;
        border: none;
        position: relative;
        padding-left: 35%;
    }
    
    .honor-products-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 600;
        color: #666;
    }
    
    .honor-products-table .product-checkbox,
    .honor-products-table .product-image {
        padding-left: 10px;
    }
    
    .honor-products-table .product-checkbox:before,
    .honor-products-table .product-image:before {
        display: noneon grouped pages */
body.honor-grouped-display-active .woocommerce-result-count,
body.honor-grouped-display-active .woocommerce-ordering,
body.honor-grouped-display-active .woocommerce-pagination {
    display: none !important;
}

/* Smooth transitions */
.honor-product-group,
.honor-group-header,
.honor-group-products {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Hover effects for group headers */
.honor-group-title {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.honor-group-title:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Custom scrollbar for long product lists */
.honor-group-products::-webkit-scrollbar {
    width: 8px;
}

.honor-group-products::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.honor-group-products::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.honor-group-products::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==================================================
   INLINE VARIABLE PRODUCTS STYLES
   ================================================== */

/* Variations Row */
.honor-products-table .variations-row {
    background: #f9f9f9;
}

.honor-products-table .variations-row td {
    padding: 0 !important;
}

/* Inline Variations Wrapper */
.inline-variations-wrapper {
    padding: 25px 30px;
    background: #fff;
    border: 2px solid #efa758;
    border-radius: 8px;
    margin: 10px;
    position: relative;
    box-shadow: 0 2px 8px rgba(239, 167, 88, 0.15);
}

/* Prevent theme iframe errors */
.inline-variations-wrapper iframe {
    display: none !important;
}

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

.variations-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.5px;
}

.close-variations {
    background: #f5f5f5;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
    font-weight: 300;
}

.close-variations:hover {
    background: #efa758;
    color: #fff;
    transform: rotate(90deg);
}

/* Variations Content */
.variations-content {
    padding: 0;
}

.variations-content .variations_form {
    margin: 0;
}

.variations-content table.variations {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.variations-content table.variations tr {
    background: none;
}

.variations-content table.variations td {
    padding: 10px 15px 10px 0;
    vertical-align: middle;
    border: none;
}

.variations-content table.variations td.label {
    width: 120px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.variations-content table.variations td.value {
    width: auto;
}

.variations-content table.variations select {
    width: 100%;
    max-width: 250px;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: all 0.3s ease;
    color: #333;
}

.variations-content table.variations select:focus {
    border-color: #efa758;
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 167, 88, 0.1);
}

.variations-content table.variations select:hover {
    border-color: #efa758;
}

/* Single Variation Display */
.single_variation_wrap {
    margin-top: 15px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.single_variation {
    margin-bottom: 15px;
}

.single_variation .woocommerce-variation-price {
    font-size: 24px;
    font-weight: 700;
    color: #efa758;
    margin-bottom: 10px;
    line-height: 1.2;
}

.single_variation .woocommerce-variation-price .price {
    color: #efa758;
}

.single_variation .woocommerce-variation-availability {
    margin-bottom: 15px;
    font-size: 14px;
}

.single_variation .woocommerce-variation-availability .stock {
    font-weight: 600;
}

/* Add to Cart Section */
.woocommerce-variation-add-to-cart {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.woocommerce-variation-add-to-cart .quantity {
    margin: 0;
}

.woocommerce-variation-add-to-cart .quantity input[type="number"] {
    width: 70px;
    height: 48px;
    padding: 0 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
}

.woocommerce-variation-add-to-cart .quantity input[type="number"]:focus {
    border-color: #efa758;
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 167, 88, 0.1);
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button {
    padding: 14px 35px;
    background: linear-gradient(135deg, #efa758 0%, #e8b12e 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(239, 167, 88, 0.3);
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button:hover {
    background: linear-gradient(135deg, #e8b12e 0%, #efa758 100%);
    box-shadow: 0 4px 12px rgba(239, 167, 88, 0.4);
    transform: translateY(-1px);
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button:active {
    transform: translateY(0);
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button.disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Reset variations link */
.reset_variations {
    display: inline-block;
    margin-top: 10px;
    color: #efa758;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.reset_variations:hover {
    color: #e8b12e;
    text-decoration: underline;
}

/* Loading state for SELECT OPTIONS button */
.honor-products-table .product_type_variable.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .inline-variations-wrapper {
        margin: 5px;
        padding: 20px 15px;
    }
    
    .variations-header h4 {
        font-size: 16px;
    }
    
    .close-variations {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
    
    .variations-content table.variations td.label {
        width: 100px;
        font-size: 13px;
    }
    
    .variations-content table.variations select {
        max-width: 100%;
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .woocommerce-variation-add-to-cart {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .woocommerce-variation-add-to-cart .quantity input[type="number"] {
        width: 100%;
    }
    
    .woocommerce-variation-add-to-cart .single_add_to_cart_button {
        width: 100%;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .single_variation .woocommerce-variation-price {
        font-size: 20px;
    }
}
        font-size: 16px;
    }
    
    .variations-content table.variations td.label {
        width: 100%;
        display: block;
        padding-bottom: 5px;
    }
    
    .variations-content table.variations td.value {
        width: 100%;
        display: block;
    }
    
    .variations-content table.variations select {
        max-width: 100%;
    }
    
    .woocommerce-variation-add-to-cart {
        flex-direction: column;
        align-items: stretch;
    }
    
    .woocommerce-variation-add-to-cart .quantity input[type="number"] {
        width: 100%;
    }
    
    .woocommerce-variation-add-to-cart .single_add_to_cart_button {
        width: 100%;
    }
}
