/*
Theme Name: Charcoal Kaola
Template: flatsome
Author: Charcoal Kaola Team
Description: Premium B2B Charcoal Export Theme
Version: 1.0.0
*/

/* ==========================================================================
   PREMIUM B2B FLYOUT MENU STYLING (FLATSOME OVERRIDE)
   ========================================================================== */

/* 1st Level Dropdown (Products -> ...) */
.header-nav .nav-dropdown {
    border-radius: 4px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08) !important;
    border: 1px solid #eaeaea !important;
    padding: 10px 0 !important;
    min-width: 260px !important;
    display: block !important; /* Force block instead of flex/columns */
}

.header-nav .nav-dropdown > li {
    display: block !important;
    width: 100% !important;
    position: relative !important;
    padding: 0 !important;
    border-right: none !important;
}

/* Base styling for all links in the dropdown */
.header-nav .nav-dropdown li a {
    display: block !important;
    font-weight: 500 !important;
    color: #4b5563 !important; /* gray-600 */
    font-size: 14px !important;
    padding: 12px 20px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    text-transform: none !important;
    transition: all 0.3s ease !important;
}

/* Remove bottom border for last items */
.header-nav .nav-dropdown li:last-child > a {
    border-bottom: none !important;
}

/* Hover effect */
.header-nav .nav-dropdown li > a:hover {
    color: #d97706 !important; /* amber-600 */
    background-color: #fdfbf7 !important;
    padding-left: 25px !important; /* Slight shift */
}

/* Add an arrow indicator for items that have sub-menus (Binchotan, Black Charcoal) */
.header-nav .nav-dropdown li.menu-item-has-children > a::after {
    content: '\f105'; /* FontAwesome angle-right */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 20px;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.header-nav .nav-dropdown li.menu-item-has-children > a:hover::after {
    color: #d97706;
}

/* =======================================================
   2nd Level Flyout (Binchotan -> Eucalyptus...) 
   ======================================================= */
/* Hide the sub-menu by default and position it to the right */
.header-nav .nav-dropdown li.menu-item-has-children > ul {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important; /* Fly out to the right */
    width: 250px !important;
    background: #fff !important;
    border-radius: 4px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08) !important;
    border: 1px solid #eaeaea !important;
    padding: 10px 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(10px) !important;
    transition: all 0.3s ease !important;
    margin-left: 1px !important;
    z-index: 999 !important;
    pointer-events: none !important;
}

/* Show the sub-menu on hover */
.header-nav .nav-dropdown li.menu-item-has-children:hover > ul {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
}

/* Style the sub-menu items specifically */
.header-nav .nav-dropdown li.menu-item-has-children > ul > li {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
}

.header-nav .nav-dropdown li.menu-item-has-children > ul a {
    font-size: 13px !important;
    font-weight: 400 !important;
    padding: 10px 20px !important;
}

/* HIDE TOP BAR ON MOBILE (Requested by Admin) */
@media screen and (max-width: 849px) {
    #top-bar {
        display: none !important;
    }
    .header-top {
        display: none !important;
    }
}

/* FIX DOUBLE LOGO TAILWIND CONFLICT & FORCE HAMBURGER ALIGNMENT (MOBILE ONLY) */
@media screen and (max-width: 849px) {
    #logo .header-logo-dark {
        display: none !important;
    }
    .header-inner .nav-icon, .header-inner .menu-icon {
        display: flex !important;
    }
}

/* ==========================================================================
   FORCE MOBILE HEADER LAYOUT (LOGO LEFT, MENU RIGHT, NO DUPLICATES)
   ========================================================================== */
@media screen and (max-width: 849px) {
    /* Override Flatsome's medium-logo-center class */
    .header-inner.medium-logo-center {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    /* Force the Logo container to the left */
    .header-inner.medium-logo-center .logo {
        position: static !important;
        transform: none !important;
        margin: 0 !important;
        padding-left: 0 !important;
        flex: 1 !important;
        text-align: left !important;
        justify-content: flex-start !important;
    }
    
    /* Force Hamburger Menu to the right */
    .header-inner .menu-icon, .header-inner .nav-icon {
        position: static !important;
        transform: none !important;
        margin-right: 0 !important;
    }

    /* Hide any duplicate logo images (keep only the first one) */
    #logo img:nth-of-type(n+2) {
        display: none !important;
    }
    
    /* Ensure the logo isn't too huge on mobile */
    #logo img {
        max-height: 50px !important;
        width: auto !important;
        display: block !important;
    }
}

/* ==========================================================================
   KILL CENTER LOGO & DOUBLE LOGO COMPLETELY
   ========================================================================== */
@media screen and (max-width: 849px) {
    /* Kill any center logo container */
    .header-inner .logo-center,
    .header-inner .mobile-logo-center,
    .header-inner .medium-logo-center .logo-center {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        width: 0 !important;
        position: absolute !important;
    }

    /* Kill the specific dark logo image explicitly anywhere in header */
    .header-wrapper img.header-logo-dark,
    #masthead img.header-logo-dark {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        position: absolute !important;
        z-index: -9999 !important;
    }
    
    /* If there are two identical logos in the left container, kill the 2nd */
    #logo a img + img {
        display: none !important;
    }
    
    /* Force left alignment on the main logo container */
    .header-inner.medium-logo-center {
        justify-content: space-between !important;
    }
    .header-inner.medium-logo-center .logo {
        position: relative !important;
        left: 0 !important;
        transform: none !important;
        margin: 0 !important;
    }
}

/* ==========================================================================
   FIX DESKTOP LOGO DISAPPEARING ON SCROLL (STICKY HEADER BUG)
   ========================================================================== */
@media screen and (min-width: 850px) {
    /* Force the main logo to always stay visible, even when sticky */
    #logo img {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    /* Hide the secondary/dark logo to prevent double logos on desktop */
    #logo img:nth-of-type(n+2),
    .header-logo-dark {
        display: none !important;
    }
}
