/* ----------------------------------------------------------------
	Custom CSS

	Add all your Custom Styled CSS here for New Styles or
	Overwriting Default Theme Styles for Better Handling Updates
-----------------------------------------------------------------*/

/* ========================================
   UNIFIED SQUARE PRODUCT IMAGES
   Force all product images to display as squares
   ======================================== */

/* Reset and force square aspect ratio for all product containers */
.product .product-image,
.grid-item .product-image,
.shop .product-image {
    position: relative !important;
    overflow: hidden !important;
    width: 100% !important;
    padding-bottom: 100% !important; /* 1:1 aspect ratio = square */
    height: 0 !important;
    border-radius: 0.25rem;
}

/* Exception: Don't apply square ratio to single product detail page */
.single-product .product-image,
.product-desc + .product-image,
.col-md-6 > .product-image {
    padding-bottom: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

/* Position image links absolutely within square container */
.product .product-image > a,
.product .product-image .slide a,
.grid-item .product-image > a,
.shop .product-image > a {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    cursor: pointer !important;
    z-index: 10 !important;
}

/* Exception: Reset positioning for single product detail page links */
.single-product .product-image > a,
.col-md-6 > .product-image > a,
.col-md-6 > .product-image .slide a {
    position: relative !important;
    width: auto !important;
    height: auto !important;
}

/* Force all product images to fill square container */
.product .product-image img,
.grid-item .product-image img,
.shop .product-image img,
.product .product-image > a img,
.product .product-image .slide img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Crop to fill square */
    object-position: center !important; /* Center the crop */
    display: block !important;
}

/* Exception: Reset image sizing for single product detail page */
.single-product .product-image img,
.col-md-6 > .product-image img,
.fslider img,
#product-gallery img,
.flexslider img {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Ensure Flexslider carousel works properly */
.fslider {
    width: 100% !important;
    height: auto !important;
    position: relative !important;
}

.flexslider .slider-wrap {
    position: relative !important;
}

.flexslider .slide {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
}

/* Ensure badges and overlays show above Flexslider */
.single-product .product-image .sale-flash,
.single-product .product-image .badge,
.single-product #product-badge,
.col-md-6 > .product-image .sale-flash,
.col-md-6 > .product-image .badge {
    position: absolute !important;
    z-index: 100 !important;
    top: 10px !important;
    right: 10px !important;
}

/* Ensure hover/second image also fills square */
.product-image > a:nth-of-type(2),
.product .product-image > a:nth-of-type(2) {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0;
    z-index: 9 !important;
    cursor: pointer !important;
}

.product-image:hover > a:nth-of-type(2) {
    opacity: 1;
    z-index: 11 !important;
    cursor: pointer !important;
}

.product-image > a:nth-of-type(2) img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Fix for grid containers to ensure uniform sizing */
.shop .product,
.portfolio-item,
.grid-item {
    margin-bottom: 30px; /* Consistent spacing */
}

/* Ensure consistent product card heights */
.product .grid-inner {
    display: flex;
    flex-direction: column;
}

/* Keep other product elements below the square image */
.product .product-desc,
.product .product-title,
.product .product-price {
    position: relative;
    z-index: 1;
}

/* Ensure overlay elements (badges, buttons) are above clickable images */
.product .product-image .bg-overlay,
.product .product-image .bg-overlay-content,
.product .product-image .badge,
.product .product-image .onsale,
.product-overlay,
.product-overlay a {
    position: relative !important;
    z-index: 20 !important;
    pointer-events: auto !important;
}

/* ========================================
   MOBILE BOTTOM NAVIGATION BAR
   Fixed bottom navigation for mobile devices
   ======================================== */

.mobile-bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    display: none; /* Hidden by default */
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 8px;
    z-index: 600;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

/* Show on mobile devices only */
@media (max-width: 767px) {
    .mobile-bottom-tab-bar {
        display: flex;
    }

    /* Add padding to body to prevent content from being hidden under nav bar */
    body {
        padding-bottom: 65px; /* Reduced from 70px to 65px */
    }

    /* Position "Go to Top" button above mobile bottom bar */
    #gotoTop {
        bottom: 80px !important; /* 65px bottom bar + 15px spacing */
    }
}

/* Tab Item Styling */
.mobile-bottom-tab-bar .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 5px 8px 4px; /* Reduced padding: top 5px, bottom 4px */
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
    min-width: 60px;
}

.mobile-bottom-tab-bar .tab-item i {
    font-size: 20px; /* Reduced from 22px */
    margin-bottom: 2px; /* Reduced from 3px */
    transition: all 0.3s ease;
}

.mobile-bottom-tab-bar .tab-item span {
    font-size: 10px; /* Reduced from 11px */
    font-weight: 500;
    transition: all 0.3s ease;
    line-height: 1.2; /* Tighter line height */
}

/* Active Tab State */
.mobile-bottom-tab-bar .tab-item.active {
    color: var(--primary-color, #9ACCC9);
}

.mobile-bottom-tab-bar .tab-item.active i {
    transform: scale(1.1);
}

/* Hover/Touch Effect */
.mobile-bottom-tab-bar .tab-item:active {
    background: #f8f9fa;
}

/* Cart Badge Styling */
.mobile-bottom-tab-bar .tab-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-bottom-tab-bar .mobile-cart-badge {
    position: absolute;
    top: -6px; /* Adjusted from -8px */
    right: -10px; /* Adjusted from -12px */
    background: #e74c3c;
    color: #fff;
    border-radius: 9px;
    min-width: 16px; /* Reduced from 18px */
    height: 16px; /* Reduced from 18px */
    font-size: 9px; /* Reduced from 10px */
    line-height: 16px;
    text-align: center;
    font-weight: 600;
    padding: 0 4px;
    display: none;
}

/* ========================================
   MOBILE USER MENU MODAL
   Bottom sheet style menu for mobile users
   ======================================== */

.mobile-user-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 700;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: none;
}

.mobile-user-menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Show mobile user menu only on mobile devices */
@media (max-width: 767px) {
    .mobile-user-menu-overlay {
        display: block;
    }
}

.mobile-user-menu {
    position: absolute;
    bottom: 65px; /* Position above mobile bottom bar (reduced from 70px) */
    right: 10px; /* Align to right side */
    left: auto; /* Remove left positioning */
    width: 280px; /* Fixed width for dropdown */
    max-width: calc(100vw - 20px); /* Ensure it fits on screen */
    background: #fff;
    border-radius: 12px; /* Rounded corners all around */
    max-height: 50vh; /* Cut to half of viewport height */
    overflow: hidden; /* Hide overflow to maintain rounded corners */
    transform: translateY(10px) scale(0.95); /* Slide up from below with scale */
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2); /* Stronger shadow for dropdown effect */
}

.mobile-user-menu-overlay.show .mobile-user-menu {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Make content scrollable within dropdown */
.mobile-user-menu-content {
    max-height: calc(50vh - 70px); /* Account for header */
    overflow-y: auto;
}

/* Mobile User Menu Header */
.mobile-user-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 15px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.mobile-user-menu-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.mobile-menu-close-btn {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.mobile-menu-close-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: rotate(90deg);
}

.mobile-menu-close-btn i {
    font-size: 20px;
}

/* Mobile User Menu Content */
.mobile-user-menu-content {
    padding: 10px 0 20px;
}

.mobile-user-menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #444;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.mobile-user-menu-item i {
    font-size: 22px;
    width: 32px;
    color: var(--primary-color, #9ACCC9);
    margin-right: 15px;
}

.mobile-user-menu-item span {
    font-size: 15px;
    font-weight: 500;
}

.mobile-user-menu-item:active {
    background: #f8f9fa;
    border-left-color: var(--primary-color, #9ACCC9);
}

/* User Greeting in Mobile Menu */
.mobile-user-greeting {
    padding: 20px 20px 10px;
    text-align: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.mobile-user-greeting h5 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color, #9ACCC9);
}

.mobile-user-greeting p {
    margin: 0;
    font-size: 13px;
    color: #999;
}

/* Logout Item Styling */
.mobile-user-menu-item.logout {
    border-top: 1px solid #eee;
    margin-top: 10px;
    color: #e74c3c;
}

.mobile-user-menu-item.logout i {
    color: #e74c3c;
}

.mobile-user-menu-item.logout:active {
    background: #fee;
    border-left-color: #e74c3c;
}

/* Auth Links (Login/Register) for non-authenticated users */
.mobile-auth-links {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-auth-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
}

.mobile-auth-link.login {
    background: var(--primary-color, #9ACCC9);
    color: #fff;
}

.mobile-auth-link.login:active {
    background: #88bbb8;
}

.mobile-auth-link.register {
    background: #f8f9fa;
    color: #444;
    border: 2px solid #e5e5e5;
}

.mobile-auth-link.register:active {
    background: #e9ecef;
}
