/* Additional custom styles for BMJ Commerce */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Banner with background image - Extended styles */
.banner-with-bg {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll; /* Ensures compatibility on mobile */
    min-height: 400px; /* Minimum height for mobile */
    padding-top: 120px;
}

.banner-with-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #FE5764;
    opacity: 0.5;
    z-index: 0;
}

.banner-with-bg > .container {
    position: relative;
    z-index: 1;
}

/* Mobile-specific banner styles */
@media (max-width: 768px) {
    .banner-with-bg {
        background-size: cover;
        background-position: center center;
        background-attachment: scroll;
        min-height: 300px;
        padding-top: 120px !important; /* Account for fixed header */
        padding-bottom: 60px !important;
    }
    
    .banner-with-bg::before {
        opacity: 0.6; /* Slightly more overlay on mobile for better text readability */
    }
}

@media (max-width: 480px) {
    .banner-with-bg {
        min-height: 250px;
        padding-top: 100px !important;
        padding-bottom: 40px !important;
    }
}

/* Custom animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-down {
    animation: fadeInDown 1s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 1s ease-out;
}

/* Header transparency and backdrop blur */
.header-transparent {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-solid {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Text shadows for better readability on transparent backgrounds */
.text-white {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Ensure header text remains visible */
#header .text-white {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Header navigation hover effects for white text */
#header .text-white:hover {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Navigation link states */
.nav-link {
    color: rgb(55 65 81);
    position: relative;
}

.nav-link:hover {
    color: rgb(30 41 59);
}

.nav-link.active {
    color: rgb(30 41 59);
    font-weight: 600;
}

.mobile-nav-link {
    color: rgb(55 65 81);
    position: relative;
    border: 1px solid transparent;
}

.mobile-nav-link:hover {
    color: rgb(17 24 39);
    border-color: rgba(254, 87, 100, 0.2);
    box-shadow: 0 4px 15px rgba(254, 87, 100, 0.1);
}

.mobile-nav-link.active {
    color: rgb(254, 87, 100);
    border-color: rgba(254, 87, 100, 0.3);
    box-shadow: 0 8px 25px rgba(254, 87, 100, 0.15);
}

/* Cart badge positioning */
.cart-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: linear-gradient(135deg, #fe5764, #ff6b7a);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(254, 87, 100, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Header visibility and styling */
#header {
    min-height: 80px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Mobile menu button improvements */
#mobile-menu-button {
    position: relative;
    overflow: hidden;
}

#mobile-menu-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(254, 87, 100, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

#mobile-menu-button:active::before {
    width: 100px;
    height: 100px;
}

/* Ensure header content is visible */
#header .text-2xl {
    color: rgb(17 24 39) !important;
    font-weight: 700;
}

/* Mobile menu gradient background */
#mobile-menu {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(254, 87, 100, 0.05) 50%, rgba(255, 107, 122, 0.05) 100%);
    backdrop-filter: blur(20px);
}

/* Cart icon styling */
#header [onclick*="cart"] {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#header [onclick*="cart"]:hover {
    background-color: rgba(30, 41, 59, 0.1);
    transform: scale(1.05);
}

/* Toast notification */
.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-hide {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* Mobile menu accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu-show,
    .mobile-menu-hide,
    .mobile-nav-item,
    .mobile-menu-button {
        transition: none;
    }
    
    .mobile-nav-item {
        transform: none;
        opacity: 1;
    }
}

/* Focus states for accessibility */
.mobile-nav-link:focus {
    outline: 2px solid #fe5764;
    outline-offset: 2px;
}

.mobile-menu-button:focus {
    outline: 2px solid #fe5764;
    outline-offset: 2px;
}

/* Product card hover effects */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Category card hover effects */
.category-card {
    transition: transform 0.3s ease;
}

.category-card:hover {
    transform: translateY(-8px);
}

.category-card img {
    transition: transform 0.3s ease;
}

.category-card:hover img {
    transform: scale(1.1);
}

/* Button hover effects */
.btn-primary {
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.05);
}

/* Mobile menu overlay */
.mobile-menu-show {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

.mobile-menu-hide {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95) translateY(-10px);
}

/* Mobile menu items animation */
.mobile-nav-item {
    transform: translateX(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-show .mobile-nav-item {
    transform: translateX(0);
    opacity: 1;
}

.mobile-nav-item:nth-child(1) { transition-delay: 0.1s; }
.mobile-nav-item:nth-child(2) { transition-delay: 0.15s; }
.mobile-nav-item:nth-child(3) { transition-delay: 0.2s; }
.mobile-nav-item:nth-child(4) { transition-delay: 0.25s; }

/* Mobile menu button improvements */
.mobile-menu-button {
    transition: all 0.3s ease;
}

.mobile-menu-button:active {
    transform: scale(0.95);
}

/* Mobile nav link hover effects */
.mobile-nav-link {
    position: relative;
    overflow: hidden;
}

.mobile-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.mobile-nav-link:hover::before {
    left: 100%;
}

/* Backdrop blur effect */
@supports (backdrop-filter: blur(10px)) {
    .mobile-nav-link {
        backdrop-filter: blur(10px);
    }
}

/* Filter sidebar mobile */
.filter-sidebar-show {
    transform: translateX(0);
}

.filter-sidebar-hide {
    transform: translateX(-100%);
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Form styles */
.form-input {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: rgb(100 116 139);
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }

    /* Cart page mobile image adjustments */
    body[data-page="cart"] .w-20 {
        width: 14rem;
        height: 100%;
    }
    
    /* Mobile menu optimizations */
    .mobile-nav-item {
        max-width: 90vw;
    }
    
    .mobile-menu-button {
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Banner text mobile adjustments */
    .banner-with-bg h1 {
        padding-top: 40px;
        font-size: 2rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .banner-with-bg p {
        font-size: 1rem !important;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .mobile-nav-item {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .mobile-nav-item .w-10 {
        width: 2rem;
        height: 2rem;
    }
    
    .mobile-nav-item .w-5 {
        width: 1rem;
        height: 1rem;
    }
    
    /* Extra small mobile banner adjustments */
    .banner-with-bg h1 {
        font-size: 1.75rem !important;
        margin-bottom: 0.75rem;
    }
    
    .banner-with-bg p {
        font-size: 0.9rem !important;
    }
}

/* Ensure banner images load properly on all devices */
.banner-with-bg {
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    will-change: transform; /* Optimize for mobile performance */
}

/* Force hardware acceleration for smooth scrolling on mobile */
@media (max-width: 768px) {
    .banner-with-bg {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
}

/* Product detail image gallery */
.image-gallery-thumbnail {
    transition: border-color 0.2s ease;
}

.image-gallery-thumbnail.active {
    border-color: rgb(30 41 59);
}

.image-gallery-thumbnail:hover {
    border-color: rgb(100 116 139);
}

/* Quantity controls */
.quantity-btn {
    transition: background-color 0.2s ease;
}

.quantity-btn:hover {
    background-color: rgb(243 244 246);
}

/* Feature cards */
.feature-card {
    transition: box-shadow 0.3s ease;
}

.feature-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Range slider customization */
input[type="range"] {
    accent-color: rgb(30 41 59);
}

/* Checkbox customization */
input[type="checkbox"]:checked {
    background-color: rgb(30 41 59);
    border-color: rgb(30 41 59);
}

/* Dropdown/select customization */
select:focus {
    outline: none;
    border-color: rgb(100 116 139);
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}