/**
 * QIANMIAO Theme - Settings Related Styles
 * @package Pioneer_Theme
 * @since 1.7.6
 */

/* =============================================================================
   Global
   ============================================================================= */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* =============================================================================
   Logo
   ============================================================================= */
.logo-img {
    max-width: var(--logo-width-desktop, 140px);
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .logo-img {
        max-width: var(--logo-width-mobile, 100px);
    }
}

/* =============================================================================
   Topbar
   ============================================================================= */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

@media (max-width: 768px) {
    .topbar {
        padding: 6px 0 !important;
    }
    
    .topbar-left {
        display: none !important;
    }
    
    .topbar-right {
        width: 100%;
        justify-content: space-between !important;
    }
    
    .topbar-right .topbar-link {
        font-size: 11px;
    }
    
    .topbar-right .lang-selector {
        margin-left: auto;
    }
    
    .topbar-right .topbar-divider {
        display: none;
    }
    
    .header-cta.hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .topbar {
        display: block !important;
    }
    
    .topbar-left {
        display: none !important;
    }
    
    .topbar-right {
        justify-content: flex-end !important;
    }
    
    .header {
        top: var(--topbar-height, 40px) !important;
    }
    
    .header.scrolled {
        top: 0 !important;
    }
}

/* =============================================================================
   Language Selector
   ============================================================================= */
.lang-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.lang-selector-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: inherit;
    transition: all 0.2s ease;
}

.lang-selector-toggle:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

.lang-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 14px;
    flex-shrink: 0;
}

.lang-flag-svg {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    display: block;
}

.lang-name {
    font-weight: 500;
    font-size: 12px;
}

.lang-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.lang-selector:hover .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 100px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.lang-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #1d2327;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s ease;
}

.lang-option:first-child {
    border-radius: 6px 6px 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 6px 6px;
}

.lang-option:hover {
    background: #f8fafc;
}

/* =============================================================================
   3-Level Desktop Navigation
   ============================================================================= */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0 !important;
    transform: translateY(10px) !important;
    min-width: 260px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 8px 0;
    z-index: 100;
}

.nav-item:hover > .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) !important;
}

.nav-dropdown-link {
    display: block;
    padding: 10px 16px;
    color: #374151;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-dropdown-link:hover {
    background: #f3f4f6;
    color: var(--noke-primary, #143852);
}

/* Second level item WITH children - show arrow */
.nav-dropdown-item {
    position: relative;
}

.nav-dropdown-item.has-submenu > a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    color: #374151;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-dropdown-item.has-submenu > a:hover {
    background: #f3f4f6;
    color: var(--noke-primary, #143852);
}

/* Force show arrow icon */
.nav-dropdown-item.has-submenu > a svg.nav-dropdown-arrow {
    display: block !important;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-dropdown-arrow {
    display: block !important;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Third level dropdown */
.nav-subdropdown {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 220px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.2s ease;
    padding: 8px 0;
    z-index: 101;
}

.nav-dropdown-item.has-submenu:hover > .nav-subdropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-subdropdown-link {
    display: block;
    padding: 10px 16px;
    color: #374151;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-subdropdown-link:hover {
    background: #f3f4f6;
    color: var(--noke-primary, #143852);
}

/* =============================================================================
   Mobile Menu - Fix alignment
   ============================================================================= */
.mobile-nav {
    padding: 0 20px;
}

/* ALL top-level items should be on one line - consistent styling */
.mobile-nav > a.mobile-nav-link,
.mobile-nav > .mobile-nav-group {
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.mobile-nav > a.mobile-nav-link {
    display: block;
    padding: 14px 0;
    color: #1d2327;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
}

.mobile-nav-group {
    /* No extra border since already handled above */
}

.mobile-nav-header {
    display: flex;
    align-items: center;
}

.mobile-nav-header .mobile-nav-link {
    flex: 1;
    display: block;
    padding: 14px 0;
    color: #1d2327;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: none;
}

.mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    flex-shrink: 0;
}

.mobile-nav-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.mobile-nav-group.active > .mobile-nav-header .mobile-nav-toggle svg {
    transform: rotate(180deg);
}

/* First level dropdown */
.mobile-nav-dropdown {
    display: none;
    padding: 0 0 12px 16px;
}

.mobile-nav-group.active > .mobile-nav-dropdown {
    display: block;
}

/* Second level items */
.mobile-nav-sublink {
    display: block;
    padding: 10px 0;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
}

.mobile-nav-sublink:hover {
    color: var(--noke-primary, #143852);
}

/* Second level group (has children) */
.mobile-nav-subgroup {
    margin-bottom: 4px;
}

.mobile-nav-subheader {
    display: flex;
    align-items: center;
}

.mobile-nav-subheader > a {
    flex: 1;
    display: block;
    padding: 10px 0;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
}

.mobile-nav-subheader > a:hover {
    color: var(--noke-primary, #143852);
}

.mobile-nav-subtoggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    flex-shrink: 0;
}

.mobile-nav-subtoggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.mobile-nav-subgroup.active > .mobile-nav-subheader .mobile-nav-subtoggle svg {
    transform: rotate(180deg);
}

/* Third level dropdown */
.mobile-nav-subdropdown {
    display: none;
    padding: 0 0 8px 16px;
}

.mobile-nav-subgroup.active > .mobile-nav-subdropdown {
    display: block;
}

.mobile-nav-subsublink {
    display: block;
    padding: 8px 0;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
}

.mobile-nav-subsublink:hover {
    color: var(--noke-primary, #143852);
}

/* =============================================================================
   Search Overlay - Fix styling
   ============================================================================= */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-content {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.search-overlay .search-form {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.search-overlay .search-input {
    flex: 1;
    padding: 18px 24px;
    border: none;
    font-size: 16px;
    background: transparent;
    outline: none;
    color: #1d2327;
}

.search-overlay .search-input::placeholder {
    color: #94a3b8;
}

.search-overlay .search-submit {
    padding: 18px 24px;
    background: var(--noke-primary, #143852);
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.search-overlay .search-submit:hover {
    background: var(--noke-primary-dark, #0f2d42);
}

.search-overlay .search-submit svg {
    width: 22px;
    height: 22px;
}

.search-overlay-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.search-overlay-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-overlay-close svg {
    width: 28px;
    height: 28px;
}

/* Header search button */
.header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: inherit;
    transition: background 0.2s ease;
}

.header-search-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.header-search-btn svg {
    width: 20px;
    height: 20px;
}

/* =============================================================================
   Footer Social Icons
   ============================================================================= */
.footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1.25rem;
}

.footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.footer-social-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.footer-social-link svg {
    width: 18px;
    height: 18px;
}

/* Custom icon image */
.footer-social-link .social-custom-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.footer-social-link:hover .social-custom-icon {
    opacity: 1;
}

/* WeChat wrapper */
.footer-social-link-wrapper {
    position: relative;
}

.wechat-wrapper .wechat-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.wechat-wrapper .wechat-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.wechat-wrapper .wechat-trigger svg {
    width: 18px;
    height: 18px;
}

.wechat-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    text-align: center;
    margin-bottom: 10px;
    pointer-events: none;
    width: 240px;
}

.wechat-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #fff;
}

.wechat-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.wechat-popup img {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    display: block;
    margin: 0 auto 10px;
    object-fit: contain;
}

.wechat-popup span {
    font-size: 13px;
    color: #666;
    display: block;
}

/* =============================================================================
   Hero Metrics - Mobile: horizontal, centered
   ============================================================================= */
.hero-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-top: 32px;
}

@media (max-width: 768px) {
    .hero-metrics {
        justify-content: center;
        gap: 20px 32px;
        flex-direction: row !important;
    }
    
    .hero-metric {
        text-align: center;
        flex: 0 0 auto;
    }
    
    .hero-metric-value {
        font-size: 1.5rem;
    }
    
    .hero-metric-label {
        font-size: 0.75rem;
    }
}

/* =============================================================================
   Breadcrumb
   ============================================================================= */
.breadcrumb-bar {
    padding: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.breadcrumb-bar .container {
    display: flex;
    align-items: center;
    width: 100%;
}

.breadcrumb-bar .breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    font-size: 13px;
    line-height: 1.4;
}

.breadcrumb-bar .breadcrumb a,
.breadcrumb-bar .breadcrumb span {
    display: inline-flex;
    align-items: center;
    color: #64748b;
    text-decoration: none;
}

.breadcrumb-bar .breadcrumb a:hover {
    color: #143852;
}

.breadcrumb-bar .breadcrumb svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.breadcrumb-bar .breadcrumb span:last-child {
    color: #1d2327;
    font-weight: 500;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .breadcrumb-bar {
        min-height: 40px;
    }
    
    .breadcrumb-bar .breadcrumb {
        font-size: 12px;
        padding: 8px 0;
    }
    
    .breadcrumb-bar .breadcrumb span:last-child {
        max-width: 150px;
    }
}

/* =============================================================================
   Hero Responsive
   ============================================================================= */
@media (max-width: 1366px) {
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }
    
    .hero-content {
        gap: 40px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-visual {
        max-width: 500px;
    }
}

@media (max-width: 1024px) {
    .hero {
        padding: 80px 0 40px;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-text {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-metrics {
        justify-content: center;
    }
    
    /* Keep hero-visual visible on tablet/mobile */
    .hero-visual {
        height: 350px;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 60px 0 40px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
}

/* =============================================================================
   Misc
   ============================================================================= */
.header[data-sticky="false"] {
    position: relative !important;
    top: auto !important;
}

.btn-primary:hover {
    color: #fff !important;
}

.btn-primary:hover * {
    color: #fff !important;
}

.products-section {
    padding-bottom: 60px;
}

.products-section.search-results-section {
    padding-bottom: 80px;
}

@media (max-width: 768px) {
    #sortProducts {
        max-width: 130px;
        padding: 8px 28px 8px 10px;
        font-size: 12px;
    }
}
