/* Theme variables inspired by GiaodienBHLD */
:root {
  --color-primary: #003B49; /* brand teal - footer & bar under menu */
  --color-navy: #001E45;    /* deep navy for headings/nav text */
  --color-accent: #F37021;  /* orange accent */
  --color-primary-700: #002E38;
  --color-primary-900: #003B49;
  --color-primary-100: #E6F1FA;
  --color-primary-50: #F2F8FF;
  --color-darkblue: #003B49; /* legacy alias */
  --color-link: #003B49;
  --color-text: #2B2B2D;
  --color-text-2: #606669;
  --color-muted: #8E8E8E;
  --nav-bg: #EFEEED;
  --light-bg: #F7F7F7;
  --brand-gradient: linear-gradient(90deg, var(--color-primary), var(--color-navy));
}

/* Base typography */
html { font-size: 62.5%; }
body {
  background-color: #fff;
  color: var(--color-text);
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 1.4rem;
  line-height: 1.6;
}
h1, h2, h3, h4, h5, .title { font-family: 'Barlow', sans-serif; color: var(--color-text); }
a { color: var(--color-link); }
a:hover { color: var(--color-primary-700); text-decoration: underline; }

/* Header */
.header-top { background:#fff; color: var(--color-text-2); font-size: 1.2rem; border-bottom:1px solid #dde0e2; }
.header-top a { color: inherit; }
.header-top a:hover { color: var(--color-accent); }
.lang-dropdown .lang-flag { width: 18px; height: 12px; object-fit: cover; border:1px solid #cfd8dc; margin-right:.25rem; }
.lang-dropdown .badge-vi { display:inline-block; width:18px; height:12px; line-height:12px; font-size:10px; text-align:center; color:#fff; background:#da251d; }
.header-middle { 
    padding-top: 1.5rem; 
    padding-bottom: 1.5rem; 
    background: #fff;
    border-bottom: 1px solid #e5e8e8;
}
.header .logo h1 { 
    font-family: 'Barlow', sans-serif; 
    letter-spacing: 0.5px; 
    font-weight: 600;
}
.header-search { 
    margin: 0 2rem;
}
.header-search .form-control { 
    height: 40px; 
    border-radius: 20px 0 0 20px; 
    background:#f5f5f5; 
    border: 1px solid #ddd; 
    border-right: 0; 
    padding: .5rem 1.5rem; 
    font-size: 1.3rem;
    transition: all 0.3s ease;
}
.header-search .form-control:focus {
    background: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 59, 73, 0.1);
}
.header-search .input-group-append .btn { 
    height: 40px; 
    border-radius: 0 20px 20px 0; 
    background: var(--color-primary); 
    border: 1px solid var(--color-primary); 
    color: #fff;
    padding: 0 1.5rem;
    transition: all 0.3s ease;
}
.header-search .input-group-append .btn:hover { 
    background: var(--color-primary-700); 
    border-color: var(--color-primary-700);
    transform: translateY(-1px);
}
.header-search .input-group-append .btn i {
    font-size: 1.4rem;
}

/* Main nav */
.header-main .navbar { 
    background-color: #f8f9fa !important; 
    padding: 0;
    border-top: 1px solid #e5e8e8;
}
.header-main .navbar-nav { 
    width: 100%;
}
.header-main .navbar-nav .nav-link { 
    position: relative;
    text-transform: uppercase; 
    font-weight: 600; 
    font-size: 1.3rem; 
    color: var(--color-text);
    padding: 1rem 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}
.header-main .navbar-nav .nav-link:hover { 
    color: var(--color-primary); 
    background: rgba(0, 59, 73, 0.05); 
    text-decoration: none; 
}
.header-main .navbar-nav .active > .nav-link,
.header-main .navbar-nav .nav-link.active { 
    color: var(--color-primary); 
    text-decoration: none; 
}
.header-main .navbar-nav .dropdown-toggle::after {
    margin-left: 0.5rem;
    vertical-align: 0.15em;
}
/* Dropdown menu */
.header-main .dropdown-menu {
    border: 1px solid #e5e8e8;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    margin-top: 0;
    min-width: 220px;
}
.header-main .dropdown-menu .dropdown-item {
    padding: 0.75rem 1.5rem;
    color: var(--color-text);
    font-size: 1.3rem;
    transition: all 0.2s ease;
}
.header-main .dropdown-menu .dropdown-item:hover {
    background: rgba(0, 59, 73, 0.08);
    color: var(--color-primary);
    text-decoration: none;
}
/* remove any underline effects */
.header-main .navbar .dropdown-menu .dropdown-item:hover { text-decoration: none; }
/* Megamenu */
.dropdown-mega .dropdown-menu { border: 0; background: var(--nav-bg); }
.dropdown-mega .dropdown-menu .dropdown-item { color: #3f4b52; padding: .25rem 0; font-weight: 600; text-transform: uppercase; font-size: 1.2rem; }
.dropdown-mega .dropdown-menu .dropdown-item:hover { background: transparent; color: var(--color-accent); text-decoration: none; }
@media (min-width: 992px) {
  .dropdown-mega:hover > .dropdown-menu { display:block; }
}

/* Second-level dropdowns */
.dropdown-submenu { 
    position: relative; 
}
.dropdown-submenu > .dropdown-menu { 
    top: -0.5rem; 
    left: 100%; 
    margin-left: 0.5rem; 
    margin-top: 0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
.dropdown-menu > .dropdown-submenu > a::after { 
    content: "\f054"; 
    font-family: "Font Awesome 6 Free"; 
    font-weight: 900; 
    border: 0; 
    float: right; 
    margin-left: 0.5rem;
    color: #999;
    transition: transform 0.2s ease;
}
.dropdown-submenu:hover > a::after {
    transform: translateX(2px);
}

/* Open dropdowns on hover for desktop */
@media (min-width: 992px) {
  .header-main .navbar .dropdown:hover > .dropdown-menu { 
    display: block; 
    animation: fadeIn 0.2s ease;
  }
  .header-main .navbar .dropdown-submenu:hover > .dropdown-menu { 
    display: block; 
    animation: fadeIn 0.2s ease;
  }
  /* Đảm bảo submenu luôn hiển thị khi hover vào parent item */
  .header-main .dropdown-submenu:hover > a {
    background: rgba(0, 59, 73, 0.08);
  }
}

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

/* Responsive header */
@media (max-width: 991px) {
    .header-middle {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    .header-search {
        margin: 1rem 0;
    }
    .header-main .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1.2rem;
    }
    .dropdown-submenu > .dropdown-menu {
        position: static;
        margin-left: 1rem;
        margin-top: 0.25rem;
        box-shadow: none;
        border: none;
        border-left: 2px solid #e5e8e8;
    }
    
    /* Ẩn giỏ hàng ở header-middle trên mobile */
    .header-cart-desktop {
        display: none !important;
    }
    
    /* Hiển thị giỏ hàng trong menu mobile */
    .navbar-nav .nav-item.d-lg-none {
        display: block;
    }
    
    /* Style cho cart trong menu mobile */
    .navbar-nav .nav-item.d-lg-none .nav-link {
        color: var(--color-text);
        font-weight: 500;
        padding: 0.75rem 1rem;
        border-top: 1px solid #e5e8e8;
        margin-top: 0.5rem;
        padding-top: 1rem;
    }
    .navbar-nav .nav-item.d-lg-none .nav-link:hover {
        color: var(--color-primary);
        background: rgba(0, 59, 73, 0.05);
    }
}

/* Desktop - Ẩn cart trong menu, hiển thị ở header */
@media (min-width: 992px) {
    .navbar-nav .nav-item.d-lg-none {
        display: none !important;
    }
    .header-cart-desktop {
        display: block !important;
    }
}

/* Buttons */
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background:#217acc; border-color:#217acc; }
.btn-dark { background:#2b2b2c; border-color:#2b2b2c; }
.btn-outline-secondary { color: var(--color-text-2); border-color: #d0d5da; }
.btn-outline-secondary:hover { color:#fff; background: var(--color-primary); border-color: var(--color-primary); }

/* Hero */
.hero-static { min-height: 340px; }
.hero-static .hero-caption { left: 24px; bottom: 24px; }
.home-slider-container .display-5 { font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }

/* Info boxes */
.info-boxes-container { border-bottom: .1rem solid #e5e8e8; background:#fff; }
.info-box { color: #839199; display: flex; align-items: center; justify-content: center; }
.info-box i { color: var(--color-primary); font-size: 3.2rem; margin-right: 1.2rem; }
.info-box h4 { color: #465157; font-weight: 600; text-transform: uppercase; font-size: 1.4rem; margin-bottom: .4rem; }

/* Product cards */
.product.grid-product { transition: box-shadow .2s ease, transform .2s ease; border-color:#e9ecef !important; }
.product.grid-product:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); }
.product .product-title { color: #5b5b5f; font-weight: 600; }
.product .product-price { color: var(--color-accent); }
.product-grid-action .btn { background:#2b2b2c; color:#fff; border:0; }
.product-grid-action .btn:hover { background:#333; }
/* Square image ratio */
.ratio-box { position: relative; width: 100%; padding-top: 100%; background:#fff; }
.ratio-box img { position:absolute; top:0; left:0; width:100%; height:100%; object-fit: cover; display:block; }

/* Footer */
.footer-middle, .footer-bottom { background-color: var(--color-darkblue); }
.footer, .footer a { color: #d9e3ef; }
.footer a:hover { color: #fff; }
.footer .widget-title { color: #fff; text-transform: uppercase; font-weight: 600; }
.footer-bottom { padding: 1.6rem 0; }

/* Cookie bar */
.cookiebar { position: fixed; left:0; right:0; bottom:0; z-index: 1080; background: rgba(0,59,73,.95); color:#fff; padding:.75rem 0; }

/* Section title */
.section-title { text-transform: uppercase; font-weight: 700; letter-spacing: .02em; margin: 0 0 1.6rem; color: var(--color-primary-900); }
.section-title::after { content: ""; display:block; width: 64px; height: 3px; background: var(--color-primary); margin: .6rem auto 0; }
/* Brand bands */
.section-band { background: var(--brand-gradient); color: #fff; padding: 1.1rem 1rem; border-radius: .25rem; }
.section-band .title { color: #fff; margin: 0; }
.bg-brand { background: var(--color-primary) !important; color:#fff !important; }
.bg-brand-50 { background: var(--color-primary-50) !important; }
.bg-brand-100 { background: var(--color-primary-100) !important; }
.text-brand { color: var(--color-primary) !important; }
.border-brand { border-color: var(--color-primary) !important; }
.badge-brand { background: var(--color-primary); color:#fff; }

/* Banners */
.banner-image .banner-title { font: 800 2.2rem/1.1 'Barlow', sans-serif; color: var(--color-primary-900); }
.banner-image .banner-subtitle { font: 700 1.3rem/1 'Barlow', sans-serif; color: var(--color-primary); }

/* Category tiles */
.category-grid .tile { display:block; border:1px solid #e7ecef; background:#fff; }
.category-grid .tile img { display:block; width:100%; height:auto; }
.category-grid .caption { text-align:center; text-transform: uppercase; font-weight: 700; color: var(--color-navy); padding:.8rem 0; font-size: 1.2rem; }
.category-grid .tile:hover .caption { color: var(--color-accent); }

/* Partners carousel */
.partners-carousel .brand-scroller { position: relative; }
.partners-carousel .brand-track { scroll-behavior: smooth; }
.partners-carousel .btn-circle { position:absolute; top:50%; transform: translateY(-50%); width:36px; height:36px; border-radius:50%; box-shadow:0 2px 6px rgba(0,0,0,.1); background:#fff; color: var(--color-primary); border:1px solid var(--color-primary-100); }
.partners-carousel .btn-circle:hover { background: var(--color-primary); color:#fff; }
.partners-carousel .brand-prev { left: 0; }
.partners-carousel .brand-next { right: 0; }

/* Utilities */
.main { 
    padding-bottom: 3rem; 
    margin-top: 2rem; /* Tách menu và nội dung */
}
.container { max-width: 1140px; }
.sticky-header { position: sticky; top: 0; z-index: 1040; }

/* Info strip under nav */
.nav-info-strip { background: var(--color-primary-700); color: #d7e7ea; font-size: 1.2rem; }
.nav-info-strip .muted { color: #b8ced2; }
.nav-info-strip .strip-item { padding: .4rem 0; text-transform: uppercase; font-weight: 700; letter-spacing: .02em; }

/* Catalog page basics */
.sidebar-shop { 
    max-height: calc(100vh - 200px); 
    overflow-y: auto; 
    overflow-x: hidden;
    position: sticky;
    top: 100px;
}
.sidebar-shop .widget { background:#fff; border:1px solid #e6e6e6; margin-bottom: 1rem; padding: 1.2rem; }
.breadcrumb { background: var(--color-primary-50); }
.toolbox .page-link, .pagination .page-link { color: var(--color-primary); }
.pagination .page-item.active .page-link { background: var(--color-primary); border-color: var(--color-primary); color:#fff; }
.sidebar-shop .widget-title a { 
    color:#21293c; 
    text-transform: uppercase; 
    font-weight: 600; 
    display: block;
    cursor: pointer;
    padding: 0.5rem 0;
    text-decoration: none;
    transition: color 0.2s;
}
.sidebar-shop .widget-title a:hover { 
    color: var(--color-primary);
    text-decoration: none;
}
.sidebar-shop .cat-list li { margin-bottom: .4rem; }
.sidebar-shop .cat-list a { color:#7a7d82; }
.sidebar-shop .cat-list a:hover { color: var(--color-primary); }

/* Category Tree Styles */
.cat-tree { list-style: none; padding-left: 0; margin: 0; }
.cat-tree .cat-item { margin-bottom: 0.3rem; }
.cat-tree .cat-item-wrapper { display: flex; align-items: center; gap: 0.5rem; }
.cat-tree .cat-toggle { 
    border: none; 
    background: transparent; 
    padding: 0; 
    width: 18px; 
    height: 18px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
    flex-shrink: 0;
}
.cat-tree .cat-toggle:hover { color: var(--color-primary); }
.cat-tree .cat-toggle i { font-size: 0.75rem; transition: transform 0.2s; }
.cat-tree .cat-toggle-placeholder { width: 18px; flex-shrink: 0; }
.cat-tree .cat-link { 
    flex: 1; 
    text-decoration: none; 
    color: #7a7d82; 
    padding: 0.25rem 0;
    transition: color 0.2s;
    font-size: 1.3rem;
}
.cat-tree .cat-link:hover { color: var(--color-primary); text-decoration: none; }
.cat-tree .cat-link.active { color: var(--color-primary); font-weight: 600; }
.cat-tree .cat-children { 
    list-style: none; 
    padding-left: 1.5rem; 
    margin-top: 0.3rem; 
    display: none;
}
.cat-tree .cat-children.show { display: block; }
.cat-tree .cat-item.has-children > .cat-item-wrapper .cat-link { font-weight: 500; }
.cat-tree .cat-level-1 { /* Đã có padding từ parent */ }
.cat-tree .cat-level-2 { /* Có thể thêm style cho level 2 nếu cần */ }

/* Desktop - Widget luôn mở */
@media (min-width: 992px) {
    .sidebar-shop .widget-body.collapse {
        display: block !important; /* Luôn hiển thị trên desktop */
        visibility: visible;
    }
    .sidebar-shop .widget-title a[aria-expanded="false"] {
        /* Không cần hiển thị icon chevron trên desktop vì luôn mở */
    }
}

/* Mobile Responsive - Tự động thu gọn danh mục */
@media (max-width: 991px) {
    /* Sidebar không sticky trên mobile */
    .sidebar-shop {
        max-height: none;
        overflow: visible;
        position: static;
    }
    
    /* Sidebar widget tự động đóng trên mobile */
    .sidebar-shop .widget-body.collapse:not(.show) {
        display: none !important; /* Force collapse widget trên mobile nếu không có class show */
    }
    .sidebar-shop .widget-body.collapse.show {
        display: block !important; /* Chỉ hiện khi được expand */
    }
    .sidebar-shop .widget-title a[aria-expanded="false"]::after {
        content: " \f078"; /* Font Awesome chevron-down icon */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        float: right;
        transition: transform 0.3s;
    }
    .sidebar-shop .widget-title a[aria-expanded="true"]::after {
        content: " \f077"; /* Font Awesome chevron-up icon */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        float: right;
        transform: rotate(180deg);
    }
    
    .cat-tree .cat-children {
        display: none !important; /* Force collapse tất cả children trên mobile */
    }
    .cat-tree .cat-children.show {
        display: block !important; /* Chỉ hiện khi được expand */
    }
    .cat-tree .cat-toggle {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }
    .cat-tree .cat-toggle i {
        font-size: 0.9rem;
    }
    .cat-tree .cat-link {
        font-size: 1.4rem;
        padding: 0.35rem 0;
    }
    .cat-tree .cat-children {
        padding-left: 1rem;
    }
    .sidebar-shop .widget {
        margin-bottom: 1.5rem;
    }
    
    /* Sidebar layout mobile */
    .products-body .row > aside.col-lg-3 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 767px) {
    .cat-tree .cat-item {
        margin-bottom: 0.5rem;
    }
    .cat-tree .cat-link {
        font-size: 1.5rem;
        padding: 0.4rem 0;
    }
    .cat-tree .cat-children {
        padding-left: 0.75rem;
    }
    .cat-tree .cat-toggle-placeholder {
        width: 24px;
    }
}
.toolbox .form-control { height: 34px; font-size: 1.3rem; }
.toolbox .pagination .page-link { min-width: 2.8rem; height: 2.8rem; padding: 0; display:flex; align-items:center; justify-content:center; }

/* Product detail */
.product-detail .thumb { cursor: pointer; }
.product-detail { padding-top: 2rem; padding-bottom: 2rem; }
.product-main-image img { max-height: 500px; width: auto; margin: 0 auto; }
.product-thumbnails .thumb { transition: border-color 0.2s; }
.product-thumbnails .thumb:hover { border-color: var(--color-primary) !important; }

/* Tabs */
.brand-tabs .nav-link { text-transform: uppercase; font-weight: 700; color: var(--color-navy); }
.brand-tabs .nav-link.active { color: var(--color-primary); border-color: var(--color-primary) var(--color-primary) #fff; }
.spec-table th { background: #f4f6f7; color:#39464b; }

/* Post/Blog pages */
.posts-body { padding-top: 2rem; padding-bottom: 2rem; }
.post-card { transition: box-shadow .2s ease, transform .2s ease; }
.post-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08) !important; transform: translateY(-2px); }
.post-image { background: #f5f5f5; }
.post-image img { width: 100%; height: 100%; object-fit: cover; }
.badge-brand { background: var(--color-primary); color: #fff; padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.post-detail { padding-top: 2rem; padding-bottom: 2rem; }
.post-article { min-height: 400px; }
.post-content { line-height: 1.8; font-size: 1.05rem; }
.post-content img { max-width: 100%; height: auto; border-radius: 4px; margin: 1rem 0; }
.post-content p { margin-bottom: 1rem; }
.post-content h2, .post-content h3 { margin-top: 2rem; margin-bottom: 1rem; color: var(--color-primary); }
.widget-header { background: var(--color-primary) !important; }

/* Category pages */
.category-detail { padding-top: 2rem; padding-bottom: 2rem; }

/* Common utilities */
.cursor-pointer { cursor: pointer; }
.gap-2 { gap: 0.5rem; }
