/* Product Comparison Site - Frontend Styles */

/* Sticky site header: logo/search bar + categories menu (desktop) stay on top while scrolling */
.site-header-sticky {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.site-header-sticky > .navbar {
    position: relative;
}
.site-header-sticky .site-header-categories {
    background-color: #f8f9fa;
}

/* Mobile header: hamburger same visual height as logo */
.mobile-cats-toggler {
    padding: 0.4rem 0.55rem;
    line-height: 1;
    height: 44px;
    width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

/* Mobile search: full width, magnifying glass button inside field on the right */
.site-header-mobile-search {
    width: 100%;
    padding: 0 0.75rem 0.75rem;
    box-sizing: border-box;
}
.site-header-mobile-search-form {
    position: relative;
    width: 100%;
    display: block;
}
.site-header-mobile-search-input {
    width: 100%;
    padding-right: 2.75rem;
    border-radius: 0.375rem;
}
.site-header-mobile-search-btn {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: #6c757d;
    border-radius: 0 0.375rem 0.375rem 0;
}
.site-header-mobile-search-btn:hover,
.site-header-mobile-search-btn:focus {
    color: #0d6efd;
    background: transparent;
    outline: none;
    box-shadow: none;
}

/* Subcategory nav: full-width select on small screens */
.subcategory-nav .form-select-lg {
    max-width: 100%;
}

/* Sort toolbar: full-width row on mobile, equal-width buttons */
@media (max-width: 767.98px) {
    .sort-btn-group {
        display: flex;
    }
    .sort-btn-group > .btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* Product Card Styles */
.product-card {
    transition: transform 0.2s;
    border: 1px solid #e9ecef;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Book-cover style: portrait, height 1.6 × width */
.product-card .card-img-top {
    width: 100%;
    height: 300px;
    max-height: 300px;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #fff;
}

.product-card .card-img-placeholder {
    height: 300px;
    max-height: 300px;
}

.product-card .card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

a:hover .product-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.price-badge {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    font-weight: bold;
}

.old-price {
    text-decoration: line-through;
    color: #6c757d;
}

.store-badge {
    background: #007bff;
    color: white;
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 12px;
}

.filter-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

/* Offer Card Styles */
.offer-card {
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.offer-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.best-price {
    border: 2px solid #28a745;
    background: linear-gradient(45deg, #f8fff9, #e8f5e8);
}

.price-highlight {
    font-size: 1.5em;
    font-weight: bold;
    color: #28a745;
}

.savings {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.product-image {
    max-height: 300px;
    object-fit: contain;
}

/* Product detail page: ratio 1.6/1 (width/height) */
.product-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1.6 / 1;
}

.product-image-wrapper .product-image {
    max-height: none;
    width: 100%;
    height: 100%;
    display: block;
}

.product-detail-image {
    width: 100%;
    aspect-ratio: 1.6 / 1;
    object-fit: cover;
    display: block;
}

.product-image-clickable {
    cursor: pointer;
}

#productImageModal .product-image-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    cursor: pointer;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.product-detail-image-placeholder {
    aspect-ratio: 1.6 / 1;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Category menu: nested (multi-level) dropdowns on desktop */
.dropdown-submenu {
    position: relative;
}
.dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -0.5rem;
    margin-left: 0.125rem;
}
.dropdown-submenu > .dropdown-toggle::after {
    border-top: 0.3em solid transparent;
    border-bottom: 0.3em solid transparent;
    border-left: 0.3em solid;
    border-right: 0;
    margin-left: 0.4em;
    vertical-align: middle;
}
/* Show nested submenu on hover (desktop only) */
@media (min-width: 992px) {
    .dropdown-submenu:hover > .dropdown-menu {
        display: block;
    }
    .site-header-categories .dropdown-menu {
        padding: 0.625rem 0;
    }
    .site-header-categories .dropdown-menu .dropdown-item {
        padding: 0.5rem 1.35rem;
    }
}

/* Category menu: nested collapsible sections on mobile (offcanvas) */
#mobileCategoriesOffcanvas .menu-mobile-details > summary {
    cursor: pointer;
    list-style: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}
#mobileCategoriesOffcanvas .menu-mobile-details > summary::-webkit-details-marker {
    display: none;
}
#mobileCategoriesOffcanvas .menu-mobile-details > summary::after {
    content: "\f078"; /* fa chevron-down */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    float: right;
    font-size: 0.8em;
    opacity: 0.6;
    transition: transform 0.15s ease;
}
#mobileCategoriesOffcanvas .menu-mobile-details[open] > summary {
    background-color: #e7f1ff;
    color: #0a58ca;
    font-weight: 600;
}
#mobileCategoriesOffcanvas .menu-mobile-details[open] > summary::after {
    transform: rotate(180deg);
    opacity: 1;
}
#mobileCategoriesOffcanvas .menu-mobile-children {
    background-color: #f4f6f8;
    border-left: 3px solid #0d6efd;
    margin: 0;
    padding: 0.25rem 0 0.25rem 0.5rem;
}
#mobileCategoriesOffcanvas .menu-mobile-children > .list-group-item {
    background-color: transparent;
}
#mobileCategoriesOffcanvas a.menu-mobile-nav-link {
    position: relative;
    z-index: 2;
    touch-action: manipulation;
}
#mobileCategoriesOffcanvas a.menu-mobile-see-all {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    text-align: right;
    font-style: italic;
    color: #6c757d;
    padding-right: 1rem;
}
#mobileCategoriesOffcanvas a.menu-mobile-see-all::after {
    content: "\f054"; /* fa chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.8em;
    opacity: 0.6;
    flex-shrink: 0;
}
#mobileCategoriesOffcanvas .menu-mobile-children .menu-mobile-details[open] > summary {
    background-color: #dce8f9;
    color: #084298;
}
#mobileCategoriesOffcanvas .menu-mobile-children .menu-mobile-details[open] > .menu-mobile-children {
    background-color: #e9ecef;
    border-left-color: #6ea8fe;
}
#mobileCategoriesOffcanvas .menu-mobile-children .menu-mobile-children .menu-mobile-details[open] > summary {
    background-color: #cfdcf0;
}
#mobileCategoriesOffcanvas .menu-mobile-children .menu-mobile-children .menu-mobile-details[open] > .menu-mobile-children {
    background-color: #dee2e6;
    border-left-color: #9ec5fe;
}

