/* ==========================================================================
   1. Root & Global Styles
   ========================================================================== */

:root {
    --primary-green: #4a7c59;
    --light-green: #8fc060;
    --dark-green: #2d5016;
    --cream: #f5f5dc;
    --white: #ffffff;
    --bs-secondary-color: #6c757d;
    --transition-default: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #fafafa;
    padding-top: 170px; /* Main nav height + Secondary nav height */
    margin: 0;
}

/* ==========================================================================
   2. Reusable Components
   ========================================================================== */

/* --- Buttons --- */
.btn {
    transition: var(--transition-default);
    font-weight: 500;
}

.btn-primary {
    background-color: var(--light-green);
    border-color: var(--light-green);
    color: var(--white);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* --- Shadows --- */
.shadow-sm {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.shadow-md {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.shadow-lg {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ==========================================================================
   3. Navbar Styles (Main & Secondary)
   ========================================================================== */

/* --- General Navbar Styling --- */
.navbar {
    padding: 15px 0;
    transition: var(--transition-default);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--white);
    text-decoration: none;
}

.navbar-logo {
    height: 120px; /* Increased from 100px */
    width: auto;
    /* Remove white background */
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transition: var(--transition-default);
    /* Ensure the logo fills the navbar height */
    max-height: calc(100% - 10px);
    margin: 5px 0;
}

.navbar-logo:hover {
    transform: scale(1.05);
}

.navbar-toggler {
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 12px;
    background: transparent;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255,255,255,0.3);
    outline: none;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* --- Main Navigation Bar --- */
.main-navbar {
    background-color: var(--light-green) !important;
    z-index: 1040;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2px 0;
}

/* --- Secondary Navigation Bar --- */
.secondary-navbar {
    position: fixed;
    top: 120px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(74, 124, 89, 0.1), rgba(143, 192, 96, 0.1)) !important;
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 1039;
    min-height: 50px;
    padding: 20px 0;
}

.secondary-navbar .navbar-nav {
    width: 100%;
    justify-content: center;
    margin: 0;
}

/* ==========================================================================
   4. Navigation Links & Components
   ========================================================================== */

/* --- Navigation Links --- */
.nav-link {
    font-weight: 500;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    transition: var(--transition-default);
    position: relative;
}

/* Main Navigation Links */
.main-navbar .nav-link,
.main-navbar .nav-text {
    color: var(--white) !important;
}

.main-navbar .nav-link:hover,
.main-navbar .nav-link:focus {
    color: rgba(255,255,255,0.9) !important;
    background-color: rgba(255,255,255,0.1);
    border-radius: 5px;
}

/* Secondary Navigation Links */
.secondary-navbar .nav-link,
.secondary-navbar .nav-text {
    color: var(--bs-secondary-color) !important;
    padding: 8px 16px !important;
}

.secondary-navbar .nav-link:hover,
.secondary-navbar .nav-link:focus {
    color: var(--primary-green) !important;
    background-color: rgba(0,0,0,0.05);
    border-radius: 5px;
}

/* --- Search Bar --- */
.navbar-search {
    flex: 0 1 500px;
    margin: 0 20px;
}

.search-form .input-group {
    width: 100%;
}

.search-form .form-control {
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    background-color: rgba(255,255,255,0.9);
    transition: var(--transition-default);
}

.search-form .form-control:focus {
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
    outline: none;
}

.search-form .btn {
    border: none;
    padding: 10px 20px;
    background-color: var(--white);
    color: var(--light-green);
}

.search-form .btn:hover {
    background-color: rgba(255,255,255,0.9);
}

/* --- Cart Button --- */
.nav-cart-btn {
    background-color: var(--white) !important;
    color: var(--light-green) !important;
    font-weight: 500;
    padding: 8px 20px !important;
    border: none;
    border-radius: 25px !important; /* Restore rounded corners */
    position: relative;
    transition: var(--transition-default);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-cart-btn:hover {
    background-color: rgba(255,255,255,0.9) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    color: var(--light-green) !important;
}

.nav-cart-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(143, 192, 96, 0.5);
    outline: none;
}

/* Cart icon and text spacing */
.nav-cart-btn i {
    font-size: 1.1rem;
}

.cart-text {
    font-weight: 500;
}

.nav-cart-btn .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    background-color: #dc3545; /* Bootstrap danger color */
    color: var(--white);
    font-weight: 600;
}

/* --- Language Switcher --- */
.language-switcher {
    margin: 0 15px;
}

.language-switcher .dropdown-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-default);
}

.language-switcher .dropdown-toggle:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

.language-switcher .dropdown-toggle::after {
    margin-left: 5px;
}

.language-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
}

.language-switcher .dropdown-menu {
    min-width: 140px !important;
    max-width: 160px !important;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0 !important;
    margin-top: 2px !important;
    background-color: var(--white);
    z-index: 1050;
}

.language-switcher .dropdown-item {
    padding: 8px 15px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-default);
    font-size: 0.9rem;
    white-space: nowrap;
    background-color: transparent;
    color: #333;
}

.language-switcher .dropdown-item:hover,
.language-switcher .dropdown-item:focus {
    background-color: #4CAF50;
    color: var(--white);
    outline: none;
}

.language-switcher .dropdown-item.active {
    background-color: #45a049;
    color: var(--white);
}

/* --- Mega Menu --- */
.mega-menu {
    width: 600px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mega-menu .dropdown-header {
    color: var(--light-green);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 10px;
    padding-left: 0;
}

.mega-menu .dropdown-item {
    padding: 5px 15px;
    font-size: 0.95rem;
    transition: var(--transition-default);
}

.mega-menu .dropdown-item:hover {
    background-color: var(--light-green);
    color: var(--white);
}

/* ==========================================================================
   5. Categories Sidebar
   ========================================================================== */

/* --- Categories Toggle Button --- */
.categories-toggle {
    border: none;
    background: transparent;
    color: var(--white) !important;
    font-size: 1rem;
    padding: 8px 16px;
    transition: var(--transition-default);
    cursor: pointer;
}

.categories-toggle:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    text-decoration: none;
}

/* --- Sidebar Styles --- */
.categories-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background-color: var(--white);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1045;
    overflow-y: auto;
}

.categories-sidebar.show {
    left: 0;
}

.sidebar-header {
    background-color: var(--light-green);
    color: var(--white);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
}

.sidebar-header .btn-close {
    color: var(--white);
    opacity: 0.8;
    transition: var(--transition-default);
}

.sidebar-header .btn-close:hover {
    opacity: 1;
}

.sidebar-body {
    padding: 20px 0;
}

/* --- Category Links --- */
.category-main {
    border-bottom: 1px solid #eee;
}

.category-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: var(--transition-default);
    font-weight: 500;
}

.category-link:hover {
    background-color: #f8f9fa;
    color: var(--light-green);
    text-decoration: none;
}

.category-link.has-subcategory {
    position: relative;
}

.category-link .fa-chevron-down {
    transition: transform 0.3s ease;
}

.category-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

/* --- Subcategory Links --- */
.subcategory-list {
    background-color: #f8f9fa;
    padding: 10px 0;
}

.subcategory-link {
    display: block;
    padding: 8px 20px 8px 50px;
    color: #666;
    text-decoration: none;
    transition: var(--transition-default);
    font-size: 0.9rem;
}

.subcategory-link:hover {
    color: var(--light-green);
    background-color: var(--white);
    text-decoration: none;
    padding-left: 55px;
}

/* --- Sidebar Overlay --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1044;
    display: none;
    cursor: pointer;
}

.sidebar-overlay.show {
    display: block;
}

/* ==========================================================================
   6. Page Content Styles
   ========================================================================== */

/* --- Hero Carousel --- */
.hero-carousel {
    margin-top: 9px;
}

.hero-carousel,
.carousel-item {
    height: 600px;
}

.carousel-item {
    background-size: cover;
    background-position: center;
    position: relative;
}

.carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    background: linear-gradient(to right, rgba(0,0,0,0.5), rgba(0,0,0,0.2));
}

.carousel-caption {
    position: relative;
    text-align: left;
    bottom: auto;
    right: auto;
    left: auto;
    padding-top: 100px;
}

.carousel-caption h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: var(--white);
}

.carousel-caption p {
    font-size: 1.25rem;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    color: var(--white);
}

/* --- Category Icons --- */
.category-icon {
    font-size: 3rem;
    color: var(--light-green);
    margin-bottom: 20px;
    transition: var(--transition-default);
}

.category-icon:hover {
    transform: scale(1.1);
    color: var(--primary-green);
}

/* --- Newsletter Section --- */
.newsletter-section {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    color: var(--white);
    padding: 60px 0;
    margin-top: 40px;
}

.newsletter-form .form-control {
    border: none;
    background-color: rgba(255,255,255,0.1);
    color: var(--white);
    font-size: 0.85rem;
    padding: 12px 20px;
    transition: var(--transition-default);
}

.newsletter-form .form-control::placeholder {
    color: rgba(255,255,255,0.7);
}

.newsletter-form .form-control:focus {
    background-color: rgba(255,255,255,0.15);
    border-color: var(--light-green);
    box-shadow: 0 0 0 0.2rem rgba(143,192,96,0.25);
    color: var(--white);
    outline: none;
}

.newsletter-form .btn {
    border: none;
    background-color: var(--white);
    color: var(--primary-green);
    font-weight: 600;
    padding: 12px 30px;
    transition: var(--transition-default);
}

.newsletter-form .btn:hover {
    background-color: var(--cream);
    transform: translateY(-2px);
}

/* ==========================================================================
   7. Footer Styles
   ========================================================================== */

.footer {
    background-color: var(--dark-green);
    color: var(--white);
    padding: 50px 0 20px;
    margin-top: 80px;
}

.footer h5,
.footer h6 {
    color: var(--white);
    font-weight: 600;
    margin-bottom: 20px;
}

/* --- Footer Links --- */
.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition-default);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--light-green) !important;
    padding-left: 5px;
}

/* --- Social Media Buttons --- */
.social-links h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
}

.btn-social {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-default);
    border: none;
    font-size: 1.1rem;
    text-decoration: none;
}

.btn-social:hover {
    transform: translateY(-2px);
}

.btn-social.facebook {
    background-color: #1877F2;
    color: var(--white);
}

.btn-social.facebook:hover {
    background-color: #166FE5;
    box-shadow: 0 4px 12px rgba(24,119,242,0.4);
}

.btn-social.instagram {
    background: linear-gradient(45deg, #F56040, #E1306C, #C13584, #833AB4);
    color: var(--white);
}

.btn-social.instagram:hover {
    box-shadow: 0 4px 12px rgba(225,48,108,0.4);
}

.btn-social.whatsapp {
    background-color: #25D366;
    color: var(--white);
}

.btn-social.whatsapp:hover {
    background-color: #20BD5A;
    box-shadow: 0 4px 12px rgba(37,211,102,0.4);
}

/* --- WhatsApp Contact Button --- */
.btn-whatsapp-main {
    background-color: #25D366;
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-default);
    text-decoration: none;
    display: inline-block;
}

.btn-whatsapp-main:hover {
    background-color: #20BD5A;
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,211,102,0.3);
    text-decoration: none;
}

/* --- Contact Info --- */
.contact-info p {
    margin-bottom: 10px;
    color: rgba(255,255,255,0.8);
    transition: var(--transition-default);
    font-size: 0.9rem;
}

.contact-info p:hover {
    color: var(--light-green) !important;
    padding-left: 5px;
}

/* --- Footer Badges --- */
.footer-badges .badge {
    font-size: 0.75rem;
    padding: 6px 12px;
    background-color: var(--light-green);
    color: var(--white);
    border-radius: 4px;
    margin-right: 5px;
}

/* ==========================================================================
   8. Responsive Media Queries
   ========================================================================== */

/* --- Desktop (Large Screens) --- */
@media (min-width: 992px) {
    .navbar-logo {
        height: 120px; /* Consistent height */
        margin: 0 20px;
    }
    
    .secondary-navbar .navbar-collapse {
        display: flex !important;
    }
    
    .d-lg-none {
        display: none !important;
    }
    
    .d-none.d-lg-block {
        display: block !important;
    }
}

/* --- Tablet & Mobile (Medium Screens) --- */
@media (max-width: 991px) {
    body {
        padding-top: 150px;
    }

    .navbar-logo {
        height: 80px;
    }

    .main-navbar {
        padding: 8px 0;
    }

    .navbar-toggler {
        padding: 4px 8px;
        font-size: 1.1rem;
    }

    .secondary-navbar {
        top: 96px;
    }

    .navbar-search {
        margin: 15px 0 !important;
        flex: 1;
        width: 100%;
    }

    .navbar-nav {
        text-align: center;
    }

    .navbar-nav .nav-item {
        margin: 5px 0;
    }

    .navbar-nav .btn {
        width: 100%;
        max-width: 200px;
        margin: 10px auto;
    }
    
    .navbar-collapse {
        background-color: rgba(0,0,0,0.1);
        margin-top: 15px;
        padding: 20px;
        border-radius: 10px;
    }

    #navbarNav,
    #secondaryNav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--light-green);
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        border-top: 1px solid rgba(255,255,255,0.1);
        padding: 20px 0;
    }
    
    #secondaryNav {
        background-color: var(--cream);
    }

    .cart-text {
        display: none;
    }
    
    .language-switcher {
        margin: 10px 0;
        text-align: center;
    }

    .language-switcher .dropdown-toggle {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        justify-content: center;
    }

    .nav-divider {
        display: none !important;
    }
    
    .mega-menu {
        width: 100% !important;
        max-width: none;
        position: relative !important;
        transform: none !important;
    }
    
    .mega-menu .row {
        display: block;
    }
    
    .mega-menu .col-lg-4 {
        margin-bottom: 20px;
    }
    
    .nav-cart-btn.d-lg-none {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .nav-cart-btn.d-lg-none .cart-count {
        top: -8px;
        right: -8px;
    }
}

/* --- Mobile (Small Screens) --- */
@media (max-width: 768px) {
    body {
        padding-top: 140px;
    }

    .navbar-logo {
        height: 70px;
    }
    
    .secondary-navbar {
        padding: 15px 0;
    }

    .hero-carousel,
    .carousel-item {
        height: 400px;
    }
    
    .carousel-caption {
        padding-top: 50px;
    }
    
    .carousel-caption h1 {
        font-size: 2rem;
    }
    
    .carousel-caption p {
        font-size: 1rem;
    }
    
    .categories-sidebar {
        width: 280px;
        left: -280px;
    }
    
    .categories-toggle span {
        display: none !important;
    }
    
    .footer {
        text-align: center;
    }
    
    .footer .row > div {
        margin-bottom: 30px;
    }
    
    .social-links .d-flex {
        justify-content: center;
    }
    
    .footer-badges {
        text-align: center !important;
        margin-top: 15px;
    }
}

/* --- Extra Small Mobile --- */
@media (max-width: 576px) {
    .navbar-logo {
        height: 60px;
    }
    
    .carousel-caption h1 {
        font-size: 1.5rem;
    }
    
    .hero-carousel,
    .carousel-item {
        height: 300px;
    }
    
    .category-icon {
        font-size: 2rem;
    }
    
    .newsletter-section {
        padding: 40px 0;
    }
}

/* ==========================================================================
   9. Utility Classes
   ========================================================================== */

.text-truncate-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.text-truncate-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* --- Spacing Utilities --- */
.mt-100 {
    margin-top: 100px;
}

.mb-100 {
    margin-bottom: 100px;
}

.py-100 {
    padding-top: 100px;
    padding-bottom: 100px;
}

/* --- Animation Classes --- */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- Hover Effects --- */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

/* --- Loading States --- */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--light-green);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

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

/* ==========================================================================
   10. Print Styles
   ========================================================================== */

@media print {
    .navbar,
    .footer,
    .sidebar-overlay,
    .categories-sidebar,
    .btn,
    .carousel-control-prev,
    .carousel-control-next {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .container {
        max-width: 100% !important;
    }
    
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    img {
        max-width: 100% !important;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}

/* ==========================================================================
   11. Accessibility
   ========================================================================== */

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid var(--light-green);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-green);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid currentColor;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ==========================================================================
   12. Browser-Specific Fixes
   ========================================================================== */

/* IE 11 Fixes */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .categories-sidebar {
        position: absolute;
    }
    
    .d-flex {
        display: block;
    }
}

/* Safari Fixes */
@supports (-webkit-appearance: none) {
    .form-control {
        -webkit-appearance: none;
    }
}

/* Firefox Fixes */
@-moz-document url-prefix() {
    .form-control {
        line-height: normal;
    }
}

/* Mobile Specific Styles */
@media (max-width: 991px) {
    /* Mobile Navigation Adjustments */
    .main-navbar .navbar-logo {
        height: 60px;
    }
    
    .secondary-navbar {
        padding: 10px 0;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px);
    }
    
    .secondary-navbar .search-form .form-control {
        background-color: rgba(0,0,0,0.05);
        border: 1px solid rgba(0,0,0,0.1);
        color: #333;
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .secondary-navbar .search-form .btn {
        background-color: var(--light-green);
        color: white;
        border: none;
        padding: 6px 12px;
    }
    
    /* Language Flag Mobile */
    .language-flag-mobile {
        width: 30px;
        height: 22px;
        object-fit: cover;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .language-switcher-mobile .dropdown-toggle {
        background: transparent;
        border: none;
        padding: 0;
    }
    
    .language-switcher-mobile .dropdown-toggle::after {
        display: none;
    }
    
    /* User icon styles */
    .main-navbar .btn-link {
        opacity: 0.9;
    }
    
    .main-navbar .btn-link:hover {
        opacity: 1;
        transform: scale(1.1);
    }

    .navbar-toggler {
        margin-left: 0;
        margin-right: 10px;
        border-color: rgba(255,255,255,0.5);
    }

    .navbar-toggler:hover {
        background-color: rgba(255,255,255,0.1);
    }

    .d-flex.align-items-center {
        gap: 0;
    }
}

/* Off-canvas Menu Styles */
.offcanvas {
    width: 280px !important;
}

.offcanvas-header {
    background-color: var(--light-green);
    color: white;
}

.offcanvas-header .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

.offcanvas-body {
    padding: 20px;
}

.offcanvas .nav-link {
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.offcanvas .nav-link:hover {
    background-color: rgba(0,0,0,0.05);
    padding-left: 20px;
}

.offcanvas hr {
    margin: 20px 0;
    opacity: 0.1;
}

/* Gap utility for flexbox */
.gap-2 {
    gap: 0.5rem !important;
}

/* Hide desktop elements on mobile */
@media (max-width: 991px) {
    .categories-toggle {
        display: none !important;
    }
}

/* Fix secondary navbar centering on desktop */
.secondary-navbar .navbar-nav {
    justify-content: center !important;
    width: 100%;
}

/* Mobile specific styles */
@media (max-width: 991px) {
    /* Language flag mobile styles */
    .language-switcher-mobile img {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        border: 1px solid rgba(0,0,0,0.1);
    }
    
    .language-switcher-mobile .dropdown-toggle::after {
        display: none;
    }
    
    /* Off-canvas styles */
    .offcanvas-header {
        background-color: var(--light-green);
    }
    
    .category-mobile-list a {
        text-decoration: none;
        transition: background-color 0.3s ease;
    }
    
    .category-mobile-list a:hover {
        background-color: rgba(0,0,0,0.05);
    }
    
    .category-mobile-list .fa-chevron-down {
        transition: transform 0.3s ease;
    }
    
    .category-mobile-list a[aria-expanded="true"] .fa-chevron-down {
        transform: rotate(180deg);
    }
}

/* Ensure flex-row for desktop secondary nav */
@media (min-width: 992px) {
    .secondary-navbar .navbar-nav {
        display: flex;
        flex-direction: row;
        gap: 2rem;
    }
    
    .secondary-navbar .nav-item {
        margin: 0;
    }
}

/* Mobile cart button styling */
@media (max-width: 991px) {
    .main-navbar .btn-link {
        position: relative;
    }
    
    .main-navbar .cart-count {
        font-size: 0.65rem;
        padding: 2px 5px;
        min-width: 16px;
        height: 16px;
        line-height: 1;
    }
}

/* Sticky WhatsApp Button */
.whatsapp-sticky {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 1000;
    animation: pulse 2s infinite;
}

.whatsapp-sticky:hover {
    background-color: #128C7E;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-sticky:active {
    transform: scale(0.95);
}

/* Tooltip for WhatsApp button */
.whatsapp-tooltip {
    position: absolute;
    right: 75px;
    background-color: #333;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-weight: 500;
}

.whatsapp-sticky:hover .whatsapp-tooltip {
    opacity: 1;
}

/* Tooltip arrow */
.whatsapp-tooltip::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -5px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-color: transparent transparent transparent #333;
}

/* Pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .whatsapp-sticky {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 26px;
    }
    
    .whatsapp-tooltip {
        display: none; /* Hide tooltip on mobile */
    }
}

/* Adjust position when user scrolls near footer */
@media (min-width: 769px) {
    .whatsapp-sticky.near-footer {
        bottom: 100px;
    }
}

/* ==========================================================================
   Favorite Button Styles
   ========================================================================== */

.btn-favorite {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.btn-favorite:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-favorite:active {
    transform: scale(0.95);
}

.btn-favorite i {
    font-size: 1.2rem;
    color: var(--primary-green);
    transition: all 0.3s ease;
}

/* Favorite active state */
.btn-favorite.active i {
    color: #dc3545;
}

.btn-favorite.active i::before {
    content: "\f004"; /* Solid heart icon */
    font-weight: 900;
}

/* Animation for adding to favorites */
@keyframes heartPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.btn-favorite.animating i {
    animation: heartPulse 0.4s ease;
}

/* Tooltip for favorite button */
.btn-favorite::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.btn-favorite:hover::after {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .btn-favorite {
        width: 35px;
        height: 35px;
    }
    
    .btn-favorite i {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Favorites Button Styles (Navigation) - Icon Only
   ========================================================================== */

/* Desktop & Mobile Favorites Button - White Icon */
.nav-favorites-btn {
    background-color: transparent !important;
    color: var(--white) !important;
    border: none;
    padding: 8px 12px !important;
    transition: var(--transition-default);
    text-decoration: none;
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px; /* Ensure minimum touch target */
}

.nav-favorites-btn:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 50%;
}

.nav-favorites-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

/* Desktop icon size - 2rem */
.nav-favorites-btn i {
    font-size: 2rem;
    transition: var(--transition-default);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-favorites-btn:hover i {
    color: var(--white) !important;
}

/* Favorites count badge */
.nav-favorites-btn .favorites-count {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.75rem;
    padding: 3px 7px;
    border-radius: 12px;
    min-width: 20px;
    height: 20px;
    text-align: center;
    background-color: #dc3545;
    color: var(--white);
    font-weight: 600;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile specific styles */
@media (max-width: 991px) {
    .main-navbar .btn-link.position-relative {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 44px;
    }
    
    .main-navbar .btn-link i.fa-heart {
        color: var(--white);
        font-size: 1.3rem; /* Slightly smaller on mobile */
        line-height: 1;
    }
    
    .main-navbar .btn-link:hover i.fa-heart {
        color: rgba(255, 255, 255, 0.8);
    }
    
    .btn-link .favorites-count {
        font-size: 0.65rem;
        padding: 2px 6px;
        min-width: 18px;
        height: 18px;
        top: -2px;
        right: -2px;
    }
}

/* Ensure cart button matches */
.main-navbar .btn-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px;
    padding: 8px 12px !important;
}

.main-navbar .btn-link i.fa-shopping-cart {
    font-size: 2rem;
    line-height: 1;
}

@media (max-width: 991px) {
    .main-navbar .btn-link i.fa-shopping-cart {
        font-size: 1.3rem;
    }
}

/* Pulse animation for favorites count */
@keyframes favoritePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

.favorites-count.pulse {
    animation: favoritePulse 0.6s ease;
}

/* Heart beat animation on hover */
@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.9);
    }
    20%, 40%, 60%, 80% {
        transform: scale(1.1);
    }
    50%, 70% {
        transform: scale(1.05);
    }
}

.nav-favorites-btn:hover i {
    animation: heartBeat 1s ease infinite;
}

/* Off-canvas favorites link styling */
.offcanvas-body .nav-link i.fa-heart {
    color: #e74c3c;
    font-size: 1.1rem;
}

.offcanvas-body .nav-link:hover i.fa-heart {
    color: #c0392b;
    animation: heartBeat 1s ease;
}

/* Ensure proper vertical alignment in navbar */
.navbar-nav {
    align-items: center !important;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

/* Desktop right side navigation alignment */
@media (min-width: 992px) {
    .main-navbar .navbar-nav.flex-row {
        align-items: center !important;
        gap: 0.5rem;
    }
    
    .main-navbar .navbar-nav .nav-item {
        margin: 0;
    }
}

/* ==========================================================================
   Live Search Dropdown Styles
   ========================================================================== */

.search-form {
    position: relative;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 600px;
    overflow-y: auto;
    margin-top: 5px;
}

.search-results-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: var(--light-green);
    border-radius: 4px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--primary-green);
}

.search-loading,
.search-error,
.search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #666;
}

.search-loading i {
    color: var(--light-green);
    font-size: 1.5rem;
}

.search-no-results {
    padding: 40px 20px;
}

.search-no-results i {
    color: #ddd;
}

.search-results-list {
    padding: 10px 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
    gap: 15px;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-image {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.search-result-details {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-title mark {
    background-color: rgba(143, 192, 96, 0.3);
    color: var(--dark-green);
    padding: 2px 4px;
    border-radius: 3px;
}

.search-result-category {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.search-result-category i {
    color: var(--light-green);
    font-size: 0.75rem;
}

.search-result-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: #999;
    align-items: center;
}

.search-result-sku {
    color: #999;
}

.search-result-stock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.search-result-stock.in-stock {
    color: #28a745;
}

.search-result-stock.out-of-stock {
    color: #dc3545;
}

.search-result-price {
    flex-shrink: 0;
    text-align: right;
}

.search-result-original-price {
    font-size: 0.8rem;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 2px;
}

.search-result-current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-green);
}

.search-results-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.search-view-all {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: var(--transition-default);
}

.search-view-all:hover {
    color: var(--light-green);
}

/* Mobile Adjustments */
@media (max-width: 991px) {
    .search-results-dropdown {
        position: fixed;
        left: 0;
        right: 0;
        top: auto;
        max-height: 70vh;
        border-radius: 10px 10px 0 0;
        margin-top: 0;
    }
    
    .secondary-navbar .search-results-dropdown {
        top: 100%;
        position: absolute;
    }
    
    .search-result-item {
        padding: 10px 15px;
    }
    
    .search-result-image {
        width: 50px;
        height: 50px;
    }
    
    .search-result-title {
        font-size: 0.9rem;
    }
    
    .search-result-price {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }
    
    .search-result-current-price {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .search-result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .search-result-category {
        display: none;
    }
}

/* ==========================================================================
   Newsletter Form Styles
   ========================================================================== */

.newsletter-form-main .btn-loading,
.newsletter-form-footer .btn-loading {
    display: inline-block;
}

#newsletterFormMain input:focus {
    border-color: var(--white);
    box-shadow: 0 0 0 0.2rem rgba(255,255,255,0.25);
}

#newsletterFormFooter input:focus {
    border-color: var(--light-green);
    box-shadow: 0 0 0 0.2rem rgba(143, 192, 96, 0.25);
}

#newsletterMainMessage,
#newsletterFooterMessage {
    font-size: 0.9rem;
}

#newsletterMainMessage .alert {
    max-width: 600px;
    margin: 0 auto;
}

#newsletterFooterMessage .alert {
    font-size: 0.75rem;
    padding: 0.5rem;
    margin-top: 0;
}

#newsletterFooterMessage .alert .btn-close {
    font-size: 0.65rem;
    padding: 0.25rem;
}

#newsletterFormFooter .form-control {
    font-size: 0.85rem;
}

#newsletterFormFooter .btn {
    position: relative;
}

@media (max-width: 768px) {
    .newsletter-section .row {
        flex-direction: column;
    }
    
    .newsletter-section .col-md-4,
    .newsletter-section .col-md-2 {
        width: 100%;
        max-width: 400px;
        margin: 0 auto 10px;
    }
}

/* ==========================================================================
   End of Stylesheet
   ========================================================================== */