/* === Category Page Redesign === */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --border-color: #dee2e6;
    --white: #fff;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 8px;
}

body {
    background-color: var(--light-gray);
}

.category-header {
    padding: 4rem 0;
    background-size: cover;
    background-position: center;
    color: var(--white);
    text-align: center;
    position: relative;
}

.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.category-header .container-full {
    position: relative;
    z-index: 1;
}

.category-header .heading {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.category-header .breadcrumbs {
    font-size: 1rem;
}
.category-header .breadcrumbs .link {
    color: var(--white);
    opacity: 0.8;
    transition: opacity 0.3s;
}
.category-header .breadcrumbs .link:hover {
    opacity: 1;
}
.category-header .breadcrumbs li {
    color: var(--white);
}


.category-page-container {
    display: flex;
    gap: 2rem;
    padding: 2rem 0;
}

/* --- Sidebar --- */
.category-sidebar {
    flex: 0 0 280px;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    align-self: flex-start;
}

.sidebar-widget {
    margin-bottom: 2rem;
}
.sidebar-widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subcategory-list li a {
    display: block;
    padding: 0.5rem 0;
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s, transform 0.3s;
    font-weight: 500;
}

.subcategory-list li a:hover {
    color: var(--primary-color);
    transform: translateX(5px);
}

/* --- Main Content --- */
.category-main-content {
    flex: 1;
}

.shop-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
}

.product-count {
    font-weight: 500;
    color: var(--secondary-color);
}

.shop-view-options {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.layout-switcher button {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--secondary-color);
    transition: all 0.3s;
}

.layout-switcher button.active,
.layout-switcher button:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.sort-dropdown {
    position: relative;
}

.sort-dropdown .dropdown-toggle {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-dropdown .dropdown-toggle .sort-label {
    font-weight: 500;
}

.sort-dropdown .dropdown-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    min-width: 200px;
    z-index: 100;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
}

.sort-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sort-dropdown .dropdown-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.sort-dropdown .dropdown-item:hover {
    background-color: var(--light-gray);
}

/* --- Product Container --- */
.product-grid-container {
    display: grid;
    gap: 1.5rem;
}

/* Grid View */
.product-grid-container.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* List View */
.product-grid-container.list-view .product-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.product-grid-container.list-view .product-card .product-image {
    flex: 0 0 200px;
    height: 200px;
}

.product-grid-container.list-view .product-card .product-info {
    text-align: left;
}

.product-grid-container.list-view .product-card .product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* --- Product Card --- */
.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.product-image .main-img,
.product-image .hover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.product-image .hover-img {
    opacity: 0;
}

.product-card:hover .product-image .hover-img {
    opacity: 1;
}

.sale-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
}

.product-info {
    padding: 1rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-gray);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.product-price {
    margin-bottom: 1rem;
}

.product-price .current-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-price .old-price {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.product-description {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-actions {
    margin-top: auto;
}

.btn-add-to-cart {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
    width: 100%;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-add-to-cart:hover {
    background-color: #0056b3;
}

.product-quick-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2;
    transform: translateX(150%);
    transition: transform 0.4s;
}

.product-card:hover .product-quick-actions {
    transform: translateX(0);
}

.quick-action-btn {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dark-gray);
    transition: all 0.3s;
    position: relative;
}

.quick-action-btn:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.quick-action-btn .tooltip {
    position: absolute;
    left: 120%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--dark-gray);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.quick-action-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Responsive */

/* Large tablets and small desktops */
@media (max-width: 1199px) {
    .category-page-container {
        gap: 1.5rem;
    }
    
    .category-sidebar {
        flex: 0 0 260px;
    }
    
    .product-grid-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Tablets */
@media (max-width: 991px) {
    .category-header {
        padding: 3rem 0;
    }
    
    .category-header .heading {
        font-size: 2.5rem;
    }
    
    .category-page-container {
        flex-direction: column;
        padding: 1.5rem 0;
    }
    
    .category-sidebar {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .product-grid-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

/* Mobile devices */
@media (max-width: 767px) {
    .category-header {
        padding: 2.5rem 0;
    }
    
    .category-header .heading {
        font-size: 2rem;
    }
    
    .shop-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .shop-controls-left,
    .shop-controls-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .view-toggle {
        order: -1;
    }
    
    .product-grid-container.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-card {
        border-radius: 6px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .product-name {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
    
    .product-rating {
        font-size: 0.85rem;
    }
    
    .btn-add-to-cart {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    /* List view adjustments */
    .product-grid-container.list-view {
        grid-template-columns: 1fr;
    }
    
    .product-grid-container.list-view .product-card {
        flex-direction: column;
    }
    
    .product-grid-container.list-view .product-card .product-image {
        flex: 0 0 auto;
        width: 100%;
        height: 220px;
    }
    
    .product-grid-container.list-view .product-info {
        padding: 1rem;
    }
    
    /* Hide quick actions on mobile, show them always */
    .product-quick-actions {
        transform: translateX(0);
        opacity: 0.95;
    }
    
    .quick-action-btn .tooltip {
        display: none;
    }
}

/* Small mobile devices */
@media (max-width: 575px) {
    .category-header .heading {
        font-size: 1.75rem;
    }
    
    .category-sidebar {
        padding: 1rem;
    }
    
    .widget-title {
        font-size: 1.1rem;
    }
    
    .product-grid-container.grid-view {
        gap: 0.5rem;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-info {
        padding: 0.6rem;
    }
    
    .product-name {
        font-size: 0.9rem;
    }
    
    .product-price {
        font-size: 0.95rem;
    }
    
    .quick-action-btn {
        width: 35px;
        height: 35px;
    }
}
