/* Merchandise Subcategory Page Styles */

.merchandise-subcategory-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Helvetica Neue Condensed', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Breadcrumb Navigation */
.merchandise-breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #666;
}

.merchandise-breadcrumb a {
    color: #003c71;
    text-decoration: none;
    transition: color 0.3s ease;
}

.merchandise-breadcrumb a:hover {
    color: #0f2f4f;
    text-decoration: underline;
}

.merchandise-breadcrumb .separator {
    margin: 0 8px;
    color: #999;
}

.merchandise-breadcrumb .current {
    color: #333;
    font-weight: 500;
}

/* Page Header */
.merchandise-subcategory-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.merchandise-subcategory-header .page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #003c71;
    margin: 0 0 15px 0;
}

.category-description {
    font-size: 1.1rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Controls Bar */
.merchandise-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.controls-left {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* Sorting Options */
.sorting-options {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sort-btn {
    padding: 10px 20px;
    background: white;
    border: 1px solid #ddd;
    border-right: none;
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.sort-btn:last-child {
    border-right: 1px solid #ddd;
    border-radius: 0 6px 6px 0;
}

.sort-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.sort-btn:hover {
    background: #f0f0f0;
}

.sort-btn.active {
    background: #003c71;
    color: white;
    border-color: #003c71;
}

.sort-btn.active + .sort-btn {
    border-left-color: #003c71;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.view-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.view-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.view-btn:hover {
    background: #f0f0f0;
}

.view-btn.active {
    background: #003c71;
    color: white;
    border-color: #003c71;
}

.view-btn.active + .view-btn {
    border-left-color: #003c71;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 300px;
    flex: 1;
    max-width: 400px;
}

.product-search-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: #333;
}

.product-search-input::placeholder {
    color: #999;
}

.search-btn {
    padding: 10px 15px;
    background: #003c71;
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: #0f2f4f;
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.results-count {
    color: #666;
    font-size: 0.95rem;
}

.results-count span {
    font-weight: 600;
    color: #333;
}

.clear-filters {
    padding: 6px 15px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.clear-filters:hover {
    background: #e63333;
}

/* Products Container */
.merchandise-products-container {
    margin-bottom: 40px;
}

/* Grid View */
.merchandise-products-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* Table View */
.merchandise-products-container.table-view {
    display: block;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Product Item */
.product-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
}

.product-item.hidden {
    display: none;
}

/* Product Image - Grid View */
.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* Changed from 100% to 75% for better aspect ratio */
    overflow: hidden;
    background: #fff;
}

.product-image-wrapper img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Changed from cover to contain to prevent cropping */
    transition: transform 0.3s ease;
}

.product-item:hover .product-image-wrapper img {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Badges */
.sale-badge,
.featured-badge {
    position: absolute;
    top: 10px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    z-index: 2;
}

.sale-badge {
    right: 10px;
    background: #ff4444;
    color: white;
}

.featured-badge {
    left: 10px;
    background: #ffa500;
    color: white;
}

/* Quick View */
.product-quick-view {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(22, 65, 112, 0.95);
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.product-item:hover .product-quick-view {
    transform: translateY(0);
}

.quick-view-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: white;
    border: 1px solid white;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-view-btn:hover {
    background: white;
    color: #003c71;
}

/* Product Info */
.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title a:hover {
    color: #003c71;
}

.product-sku {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 8px;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #003c71;
    margin-bottom: 10px;
}

.product-price del {
    color: #999;
    font-weight: 400;
    font-size: 1rem;
    margin-right: 8px;
}

.product-price ins {
    text-decoration: none;
}

/* Fix for GST suffix text */
.merchandise-products-container .product-price .woocommerce-price-suffix,
.merchandise-products-container .product-item .woocommerce-price-suffix,
.merchandise-products-container .woocommerce-Price-amount + .woocommerce-price-suffix,
.merchandise-subcategory-container .woocommerce-price-suffix {
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    color: #666 !important;
    display: inline-block !important;
    margin-left: 4px !important;
}

/* Rating */
.product-rating {
    margin-bottom: 10px;
}

.product-rating .star-rating {
    font-size: 0.9rem;
    color: #ffa500;
}

/* Product Excerpt */
.product-excerpt {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    margin-bottom: 15px;
    flex: 1;
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.product-actions .button,
.product-actions .add_to_cart_button,
.view-details-btn {
    flex: 1;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-actions .button,
.product-actions .add_to_cart_button {
    background: #003c71;
    color: white;
    border: 1px solid #003c71;
}

.product-actions .button:hover,
.product-actions .add_to_cart_button:hover {
    background: #0f2f4f;
    border-color: #0f2f4f;
}

.view-details-btn {
    background: white;
    color: #003c71;
    border: 1px solid #003c71;
}

.view-details-btn:hover {
    background: #003c71;
    color: white;
}

/* No Products Found */
.no-products-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.no-products-found h2 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 15px;
}

.no-products-found p {
    color: #666;
    margin-bottom: 30px;
}

.btn-back {
    display: inline-block;
    padding: 12px 30px;
    background: #003c71;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.btn-back:hover {
    background: #0f2f4f;
}

/* ============================================
   TABLE VIEW STYLES
   ============================================ */

/* Hide/Show elements based on view */
.merchandise-products-container.grid-view .table-header,
.merchandise-products-container.grid-view .table-cell {
    display: none;
}

.merchandise-products-container.table-view .product-image-wrapper,
.merchandise-products-container.table-view .product-info,
.merchandise-products-container.table-view .product-quick-view {
    display: none;
}

/* Table Header */
.table-header {
    display: grid;
    grid-template-columns: 100px 1fr 120px 120px 120px 200px;
    gap: 15px;
    padding: 15px 20px;
    background: #003c71;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 2px solid #0f2f4f;
}

.table-header > div {
    display: flex;
    align-items: center;
}

/* Table Product Item */
.merchandise-products-container.table-view .product-item {
    display: grid;
    grid-template-columns: 100px 1fr 120px 120px 120px 200px;
    gap: 15px;
    padding: 15px 20px;
    border-radius: 0;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: none;
    align-items: center;
}

.merchandise-products-container.table-view .product-item:hover {
    transform: none;
    background: #f8f9fa;
}

.merchandise-products-container.table-view .product-item:last-child {
    border-bottom: none;
}

/* Table Cells */
.table-cell {
    display: flex;
    align-items: center;
}

.table-image img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: #f5f5f5;
    padding: 5px;
    border-radius: 4px;
}

.table-title {
    flex-direction: column;
    align-items: flex-start;
}

.table-title a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.table-title a:hover {
    color: #003c71;
}

.table-title .product-description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.table-sku {
    color: #666;
    font-size: 0.9rem;
}

.table-price {
    font-weight: 600;
    color: #003c71;
    font-size: 1.1rem;
}

.table-price del {
    color: #999;
    font-weight: 400;
    font-size: 0.9rem;
    margin-right: 5px;
}

/* Fix GST suffix in table view */
.table-price .woocommerce-price-suffix {
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    color: #666 !important;
    display: inline-block !important;
    margin-left: 4px !important;
}

.table-stock .in-stock {
    color: #46a546;
    font-size: 0.9rem;
}

.table-stock .out-of-stock {
    color: #dc3545;
    font-size: 0.9rem;
}

.table-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.table-actions .button,
.table-actions .view-details-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    text-align: center;
}

.table-actions .button {
    background: #003c71;
    color: white;
    border: none;
    text-decoration: none;
}

.table-actions .button:hover {
    background: #0f2f4f;
}

.table-actions .view-details-btn {
    background: white;
    color: #003c71;
    border: 1px solid #003c71;
    text-decoration: none;
}

.table-actions .view-details-btn:hover {
    background: #003c71;
    color: white;
}

/* Responsive Table View */
@media (max-width: 1200px) {
    .table-header,
    .merchandise-products-container.table-view .product-item {
        grid-template-columns: 80px 1fr 100px 100px 100px 180px;
    }
}

@media (max-width: 992px) {
    .table-header {
        display: none;
    }
    
    .merchandise-products-container.table-view .product-item {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 20px;
        border-bottom: 2px solid #e0e0e0;
    }
    
    .table-cell {
        display: block;
        width: 100%;
    }
    
    .table-image {
        text-align: center;
        margin-bottom: 10px;
    }
    
    .table-title {
        margin-bottom: 10px;
    }
    
    .table-sku:before {
        content: "SKU: ";
        font-weight: 600;
    }
    
    .table-price {
        margin: 10px 0;
    }
    
    .table-stock {
        margin-bottom: 10px;
    }
    
    .table-actions {
        flex-direction: row;
        gap: 10px;
    }
    
    .table-actions .button,
    .table-actions .view-details-btn {
        flex: 1;
    }
}

/* Pagination */
.merchandise-pagination {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.merchandise-pagination ul {
    display: flex;
    list-style: none;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.merchandise-pagination li {
    margin: 0;
}

.merchandise-pagination a,
.merchandise-pagination span {
    display: inline-block;
    padding: 10px 15px;
    background: white;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.merchandise-pagination a:hover {
    background: #003c71;
    color: white;
    border-color: #003c71;
}

.merchandise-pagination .current span {
    background: #003c71;
    color: white;
    border-color: #003c71;
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 40px 0;
}

.load-more-btn {
    padding: 15px 40px;
    background: #003c71;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.load-more-btn:hover {
    background: #0f2f4f;
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #003c71;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 992px) {
    .merchandise-controls-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sorting-options {
        width: 100%;
        justify-content: center;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .merchandise-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .merchandise-subcategory-header .page-title {
        font-size: 2rem;
    }
    
    .sorting-options {
        flex-wrap: wrap;
    }
    
    .sort-btn {
        flex: 1 1 calc(50% - 1px);
        border-radius: 0 !important;
        border-right: 1px solid #ddd !important;
    }
    
    .sort-btn:nth-child(2) {
        border-right: none !important;
    }
    
    .sort-btn:nth-child(3) {
        border-top: none;
    }
    
    .sort-btn:nth-child(4) {
        border-top: none;
        border-right: none !important;
    }
    
    .merchandise-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .merchandise-subcategory-container {
        padding: 15px;
    }
    
    .merchandise-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .product-title {
        font-size: 1rem;
    }
    
    .product-price {
        font-size: 1.1rem;
    }
}