/* ===== COMPONENTS STYLES ===== */

/* Product Card */
.product-card {
    background: var(--primary-white);
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 6px 20px rgba(31, 32, 41, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

/* New layout: price/title above image, large centered image, arrows bottom-left, action button bottom-right */
.product-info-top {
    padding: 0.5rem 0.75rem 0.4rem 0.75rem;
}

.product-price-row {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 0.5rem;
}

.product-delivery {
    color: var(--accent-pink);
    font-size: 0.85rem;
    margin: 0.15rem 0 0.25rem 0;
}

.product-image-frame {
    width: 100%;
    /* make the frame more square-like for grid thumbnails */
    aspect-ratio: 1.05 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border-radius: 10px;
    overflow: hidden;
}

.product-image-frame {
    /* add inner spacing so images don't touch card edges */
    padding: 0.75rem;
    box-sizing: border-box;
}

.product-image-frame .product-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: none;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(31, 32, 41, 0.08);
}

.product-image-wrapper {
    position: relative;
    /* Default image height reduced slightly for a denser grid */
    height: 280px;
    overflow: hidden;
    background: var(--cream);
}

.product-card .product-image-wrapper {
    border-radius: 10px 10px 0 0;
    margin: 0.5rem;
    overflow: hidden;
    background: #fafafa;
}

.product-card .product-info {
    background: white;
    margin: 0 0.5rem 0.75rem 0.5rem;
    border-radius: 0 0 10px 10px;
    padding: 1rem 1rem 1.25rem 1rem;
}

/* Responsive adjustments for product card sizes */
@media (min-width: 1401px) {
    .product-image-wrapper {
        height: 300px;
    }
}

@media (max-width: 1400px) {
    .product-image-wrapper {
        height: 260px;
    }
    .product-name {
        font-size: 1.125rem;
    }
    .product-price {
        font-size: 1.25rem;
    }
}

@media (max-width: 992px) {
    .product-image-wrapper {
        height: 220px;
    }
    .product-info {
        padding: 0.9rem;
    }
    .product-name {
        font-size: 1.05rem;
    }
    .product-price {
        font-size: 1.125rem;
    }
}

@media (max-width: 576px) {
    /* For 2-column mobile layout, more compact cards */
    .product-image-wrapper {
        height: 160px;
    }
    .product-info {
        padding: 0.5rem;
    }
    .product-name {
        font-size: 0.98rem;
    }
    .product-price {
        font-size: 0.98rem;
    }
    .product-action-btn {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    .product-image-wrapper {
        height: 140px;
    }
    .product-name {
        font-size: 0.88rem;
    }
    .product-price {
        font-size: 0.88rem;
    }
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

.product-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary-gold);
    color: var(--primary-white);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
}

.product-carousel-arrows {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 8px;
    z-index: 4;
}

.product-carousel-arrows button {
    width: 36px;
    height: 36px;
    background: var(--primary-white);
    border: 1px solid var(--cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(31,32,41,0.06);
}

.product-carousel-arrows button i { color: var(--primary-black); }

.product-image-wrapper .product-action-btn.view-action {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: var(--primary-white);
    color: var(--primary-black);
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(31,32,41,0.08);
    z-index: 5;
}

.product-info-bottom {
    padding: 0.4rem 0.75rem 1rem 0.75rem;
}

/* make product cards visually match reference: subtle border, minimal rounded corners */
.product-card {
    background: var(--primary-white);
    border-radius: 10px;
    border: 1px solid var(--cream);
    box-shadow: 0 6px 18px rgba(31,32,41,0.04);
}

.product-card .product-info-top .product-price {
    font-weight: 700;
    color: var(--primary-black);
    font-size: 1rem;
}

.product-name {
    font-size: 0.95rem;
    margin: 0.2rem 0 0.4rem 0;
}

.product-category {
    font-size: 0.8rem;
    color: #9b8656; /* gold-ish small label */
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.product-badge.new {
    background: var(--accent-burgundy);
}

.product-badge.trending {
    background: var(--accent-navy);
}

.product-actions {
    position: absolute;
    bottom: 10px;
    left: 10px;
    transform: none;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    z-index: 3;
    transition: opacity var(--transition-normal);
}

.product-card:hover .product-actions {
    opacity: 1;
}

.product-action-btn {
    width: 50px;
    height: 50px;
    background: var(--primary-white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary-black);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.product-action-btn:hover {
    background: var(--primary-gold);
    color: var(--primary-white);
    transform: scale(1.1);
}

/* Hide wishlist and cart buttons */
.wishlist-action,
.cart-action {
    display: none;
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(26, 26, 26, 0.6) 0%, transparent 40%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.product-info {
    padding: 1.5rem;
}

.product-category {
    font-size: 0.85rem;
    color: var(--primary-gold);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.product-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-black);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.product-price {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--primary-black);
    font-family: var(--font-primary);
}

/* Short excerpt under product title (hidden in grid, shown in list view) */
.product-excerpt {
    display: none;
    color: var(--soft-black);
    margin: 0.5rem 0 1rem 0;
    line-height: 1.6;
}

/* List view: stacked large cards (image full-width, content below) */
.list-view .products-grid {
    display: block;
}

.list-view .product-card {
    display: block;
    width: 100%;
    margin-bottom: 1.5rem;
}

.list-view .product-image-wrapper {
    width: 100%;
    height: 420px; /* larger hero-like image */
    margin: 0 0 0.75rem 0;
    border-radius: 12px;
    overflow: hidden;
}

.list-view .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-view .product-info {
    padding: 2rem 2.5rem;
    background: white;
    border-radius: 0 0 12px 12px;
    margin-bottom: 1.5rem;
}

.list-view .product-excerpt {
    display: block;
}

.list-view .product-name {
    font-size: 1.25rem;
}

.list-view .product-price {
    font-size: 1.25rem;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.product-stars {
    display: flex;
    gap: 0.25rem;
}

.product-stars i {
    color: var(--primary-gold);
    font-size: 0.875rem;
}

.product-reviews {
    font-size: 0.85rem;
    color: var(--soft-black);
}

/* Collection Card */
.collection-card {
    position: relative;
    height: 500px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.collection-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.collection-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.collection-card:hover .collection-image {
    transform: scale(1.15);
}

.collection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(26, 26, 26, 0.9) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
}

.collection-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-white);
    margin-bottom: 0.5rem;
}

.collection-count {
    font-size: 1rem;
    color: var(--primary-gold);
    margin-bottom: 1rem;
}

.collection-link {
    color: var(--primary-white);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.collection-link:hover {
    gap: 1rem;
}

/* Banner */
.banner {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: var(--spacing-lg) 0;
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.7) 0%, rgba(26, 26, 26, 0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-content {
    text-align: center;
    color: var(--primary-white);
    max-width: 700px;
    padding: 2rem;
}

.banner-title {
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--primary-white);
    margin-bottom: 1rem;
}

.banner-description {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--primary-white);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid var(--cream);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.75rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--soft-black);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--cream);
    color: var(--primary-black);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 2rem;
    border-top: 1px solid var(--cream);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Branch Selector */
.branch-selector {
    background: var(--cream);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.branch-tabs {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.branch-tab {
    padding: 1rem 2rem;
    background: var(--primary-white);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.branch-tab:hover {
    border-color: var(--primary-gold);
}

.branch-tab.active {
    background: var(--primary-gold);
    color: var(--primary-white);
    border-color: var(--primary-gold);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: var(--spacing-md);
}

.pagination-btn,
.pagination-number {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-white);
    border: 2px solid var(--cream);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover,
.pagination-number:hover {
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.pagination-number.active {
    background: var(--primary-gold);
    color: var(--primary-white);
    border-color: var(--primary-gold);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--primary-grey);
    font-weight: 600;
    -webkit-user-select: none;
    user-select: none;
}

.filter-sidebar {
    background: var(--primary-white);
    padding: clamp(1.5rem, 3vw, 2rem);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    /* layout/position handled by page-specific CSS (collection.css) to allow off-canvas behavior */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    transition: all 0.3s ease;
}

.filter-header {
    display: flex; /* show header by default so off-canvas panel has close button */
    justify-content: space-between;
    align-items: center;
}

.filter-close-btn {
    display: inline-block;
    z-index: 1100;
}
.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: var(--cream);
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 3px;
}

.filter-group {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--cream);
}

.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-title {
    font-size: clamp(1rem, 2vw, 1.125rem);
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-black);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.filter-option:hover {
    background-color: rgba(212, 175, 55, 0.05);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-gold);
    flex-shrink: 0;
}

/* Mobile apply bar inside filter drawer */
.filter-apply-bar {
    display: none;
}

@media (max-width: 991px) {
    .filter-apply-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0.75rem 1rem;
        background: var(--primary-white);
        box-shadow: 0 -6px 18px rgba(10,10,10,0.06);
        gap: 0.75rem;
        z-index: 2200;
        justify-content: space-between;
        align-items: center;
    }
    .filter-sidebar { padding-bottom: 72px; }
}

/* On small phones, center the primary Apply button and hide Clear for simpler UI */
@media (max-width: 576px) {
    .filter-apply-bar {
        justify-content: center;
        padding: 0.75rem 1rem;
    }
    .filter-apply-bar #filterClearBtn { display: none; }
    .filter-apply-bar .apply-filters-btn {
        min-width: 86%;
        max-width: 92%;
        text-align: center;
    }
}

.filter-option label {
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    color: var(--soft-black);
    cursor: pointer;
    flex: 1;
    -webkit-user-select: none;
    user-select: none;
}

/* View toggle buttons */
.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

/* FORCE GRID ONLY: hide view toggle UI and neutralize list-view rules
   This ensures pages that still include list-view markup or buttons
   will render the dense grid layout like the provided design. */
.view-toggle { display: none !important; }

/* Neutralize list-view container switch so grid remains active */
.list-view .products-grid,
.products-grid,
.products-list {
    display: grid !important;
    /* let page-specific styles control the number of columns via media queries */
    gap: 1rem;
}

/* Ensure product-cards within 'list-view' keep the grid card styles */
.list-view .product-card,
.product-card {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
}

/* Keep excerpt hidden to reduce vertical clutter */
.list-view .product-excerpt,
.product-excerpt { display: none !important; }

/* Additional overrides to prevent stacked/list styling from taking effect */
/* Reduce large list-view image heights and keep thumbnails square/compact */
.list-view .product-image-wrapper,
.product-image-wrapper {
    height: auto !important;
    min-height: 180px !important;
    aspect-ratio: 1.05 / 1 !important;
    overflow: hidden !important;
    margin: 0 !important;
    background: #fafafa !important;
}

.list-view .product-image,
.product-image-frame .product-image {
    /* keep thumbnails filling the frame in forced-grid mode */
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
}

/* Reduce hover zoom so images don't become oversized in grid */
.product-card:hover .product-image {
    transform: scale(1.05) !important;
}

/* Keep product info compact in forced grid */
.list-view .product-info,
.product-info {
    padding: 0.6rem 0.75rem 0.9rem 0.75rem !important;
}

.list-view .product-name,
.product-name {
    font-size: 0.95rem !important;
    margin-bottom: 0.35rem !important;
}

.list-view .product-price,
.product-price {
    font-size: 1rem !important;
}

/* Hide the dark overlay that can obscure thumbnails */
.product-overlay { opacity: 0 !important; }

/* Floating WhatsApp button: improved positioning for mobile and safe-area aware */
.whatsapp-float {
    position: fixed;
    right: 20px;
    /* place above any bottom controls and account for safe area by default */
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.18);
    z-index: 11000; /* ensure it's above sticky elements */
    z-index: 1800; /* not as high as header/nav so it won't block mobile menu */
    text-decoration: none;
    transition: transform 0.12s ease, right 0.12s ease, bottom 0.12s ease;
}

.whatsapp-float:hover { transform: scale(1.05); }

/* Medium / small screens: keep button compact and vertically above other fixed controls (like back-to-top) */
@media (max-width: 992px) {
    .whatsapp-float {
        right: 18px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4.5rem);
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* Extra small phones: slightly smaller and nudged closer to the right edge, still above gesture area */
@media (max-width: 420px) {
    .whatsapp-float {
        right: 14px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4rem);
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

.view-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-white);
    border: 1px solid var(--cream);
    color: var(--primary-black);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn.active,
.view-btn:hover {
    background: var(--primary-gold);
    color: var(--primary-white);
    border-color: var(--primary-gold);
}

.collections-header .view-toggle {
    float: right;
}

.apply-filters-btn {
    width: 100%;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--soft-black);
}

.breadcrumb a {
    color: var(--soft-black);
    transition: var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary-gold);
}

.breadcrumb-separator {
    color: var(--primary-gold);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--cream);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-image-wrapper {
        height: 280px;
    }
    
    .collection-card {
        height: 400px;
    }
    
    .banner {
        height: 300px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.5rem;
    }
    
    .filter-sidebar {
        padding: 1.5rem;
        /* preserve off-canvas positioning from page-specific CSS; do not force static */
        max-height: none;
    }
    
    .filter-group {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .filter-title {
        font-size: 1rem;
    }
    
    .filter-option {
        padding: 0.4rem;
    }
    
    .filter-option label {
        font-size: 0.9rem;
    }
}