/* ============================================
   YBB 导航栏 — 完整样式表 v2.0
   --------------------------------------------
   覆盖范围：品牌 / 导航链接 / 下拉菜单 / 搜索框 / 用户菜单 / 移动端
   优先级：本文件在 common.css 之后引入，自动覆盖冲突规则
   ============================================ */

/* ── 基础导航栏 ── */
.navbar-white {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    box-shadow: 0 1px 20px rgba(99, 102, 241, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow .3s ease, background .3s ease;
}

/* ── 品牌区域 ── */
.navbar-brand.ybb-brand {
    display: flex;
    align-items: center;
    height: 56px;
    padding-top: 0;
    padding-bottom: 0;
    transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
.navbar-brand.ybb-brand:hover {
    transform: scale(1.02);
    opacity: .92;
}

.ybb-logo {
    max-height: 40px;
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    filter: drop-shadow(0 2px 6px rgba(99,102,241,.15));
    transition: filter .3s ease;
    object-fit: contain;
}
.navbar-brand.ybb-brand:hover .ybb-logo {
    filter: drop-shadow(0 3px 10px rgba(99,102,241,.25));
}

.ybb-sitename {
    display: none;
}

/* ── 导航栏容器 — Flex 单行布局 ── */
.navbar-white .navbar-collapse {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.navbar-white .navbar-collapse::-webkit-scrollbar {
    display: none;
}
.navbar-white .navbar-nav:not(.navbar-right) {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    float: none;
    flex: 0 0 auto;
    min-width: 0;
}
.navbar-white .navbar-nav.navbar-right {
    flex: 0 0 auto;
    margin-left: auto;
    position: sticky;
    right: 0;
    z-index: 1;
    background: #fff;
    padding-left: 15px;
}
.navbar-white .navbar-nav > li {
    flex: 0 0 auto;
    float: none;
}

/* ── 导航链接 ── */
.navbar-white .navbar-nav > li > a {
    position: relative;
    color: #374151;
    font-weight: 600;
    font-size: 15px;
    padding-left: 14px;
    padding-right: 14px;
    padding-top: 18px;
    padding-bottom: 18px;
    transition: color .25s ease;
    white-space: nowrap;
    letter-spacing: .3px;
}
.navbar-white .navbar-nav > li > a::after {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: calc(100% - 20px);
    height: 2.5px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 2px 2px 0 0;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.navbar-white .navbar-nav > li > a:hover,
.navbar-white .navbar-nav > li > a:focus {
    color: #6366f1;
    background: transparent !important;
}
.navbar-white .navbar-nav > li > a:hover::after,
.navbar-white .navbar-nav > li > a:focus::after {
    transform: translateX(-50%) scaleX(1);
}
.navbar-white .navbar-nav > li.active > a {
    color: #6366f1;
    font-weight: 600;
}
.navbar-white .navbar-nav > li.active > a::after {
    transform: translateX(-50%) scaleX(1);
}

/* ── 下拉菜单 ── */
.navbar-white .navbar-nav > li.open > .dropdown-menu {
    display: block;
}
.navbar-white .dropdown-menu {
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(99,102,241,.12), 0 4px 12px rgba(0,0,0,.08);
    padding: 6px 0;
    animation: ybb-fadeDown .25s ease;
}
@keyframes ybb-fadeDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.navbar-white .dropdown-menu > li > a {
    padding: 10px 20px;
    color: #374151;
    font-weight: 450;
    transition: background .2s ease, color .2s ease;
}
.navbar-white .dropdown-menu > li > a:hover {
    background: #f5f3ff;
    color: #6366f1;
}

/* ── 三级子菜单 ── */
.navbar-white .dropdown-submenu > .dropdown-menu {
    border-radius: 8px;
    margin-left: 1px;
}

/* ── 搜索框 ── */
.navbar-right .form-search {
    position: relative;
    display: flex;
    align-items: center;
}
.navbar-right .form-search input {
    border-radius: 20px;
    border: 1.5px solid #e5e7eb;
    padding: 6px 16px;
    transition: border-color .2s ease, box-shadow .2s ease, width .3s ease;
    width: 160px;
    font-size: 13px;
    background: #f9fafb;
}
.navbar-right .form-search input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
    outline: none;
    width: 200px;
    background: #fff;
}
.navbar-right .form-search input::placeholder {
    color: #9ca3af;
}
.navbar-right .form-search .search-icon {
    position: absolute;
    right: 12px;
    width: 14px;
    height: 14px;
    background: url('../img/search.svg') no-repeat center / contain;
    opacity: .5;
    pointer-events: none;
}

/* 搜索建议 */
.autocomplete-suggestions {
    text-align: left;
    cursor: default;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(99,102,241,.12), 0 4px 12px rgba(0,0,0,.08);
    position: absolute;
    display: none;
    z-index: 1036;
    max-height: 300px;
    overflow-y: auto;
    box-sizing: border-box;
    border: 1px solid #f3f4f6;
}
.autocomplete-suggestions .autocomplete-suggestion {
    padding: 10px 16px;
    font-size: 14px;
    color: #374151;
    transition: background .15s ease;
}
.autocomplete-suggestions .autocomplete-suggestion b {
    color: #6366f1;
    font-weight: 600;
}
.autocomplete-suggestions .autocomplete-suggestion:hover {
    background: #f5f3ff;
    color: #6366f1;
}

/* ── 用户信息下拉 ── */
.navbar-userinfo > a {
    display: flex !important;
    align-items: center;
    gap: 8px;
}
.navbar-userinfo .avatar-img img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    transition: border-color .2s ease;
}
.navbar-userinfo > a:hover .avatar-img img {
    border-color: #6366f1;
}
.navbar-userinfo .dropdown-menu {
    min-width: 180px;
}
.navbar-userinfo .dropdown-menu > li > a {
    padding: 10px 20px;
    font-size: 14px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-userinfo .dropdown-menu > li > a i {
    width: 16px;
    text-align: center;
    color: #9ca3af;
    transition: color .2s ease;
}
.navbar-userinfo .dropdown-menu > li > a:hover {
    background: #f5f3ff;
    color: #6366f1;
}
.navbar-userinfo .dropdown-menu > li > a:hover i {
    color: #6366f1;
}

/* ── 汉堡按钮 ── */
.navbar-toggle.sidebar-toggle {
    border: none;
    background: transparent;
    margin-top: 13px;
    margin-bottom: 13px;
    padding: 9px 10px;
    border-radius: 6px;
    transition: background .2s ease;
}
.navbar-toggle.sidebar-toggle:hover {
    background: #f5f3ff;
}
.navbar-toggle.sidebar-toggle .icon-bar {
    width: 20px;
    height: 2px;
    background-color: #6366f1;
    border-radius: 2px;
    transition: transform .3s ease, opacity .3s ease;
}

/* ── 中等屏幕 (992px - 1199px) ── */
@media (min-width: 992px) and (max-width: 1199px) {
    .navbar-white .navbar-nav > li > a {
        padding-left: 10px;
        padding-right: 10px;
        font-size: 14px;
    }
    .navbar-brand.ybb-brand { padding-right: 5px; }
    .navbar-right .form-search input { width: 140px; }
    .navbar-right .form-search input:focus { width: 170px; }
}

/* ── 平板 (768px - 991px) ── */
@media (min-width: 768px) and (max-width: 991px) {
    .navbar-white .navbar-nav > li > a {
        padding-left: 8px;
        padding-right: 8px;
        font-size: 13px;
    }
    .navbar-brand.ybb-brand { padding-right: 5px; }
    .navbar-right .form-search input { width: 110px; }
    .navbar-right .form-search input:focus { width: 140px; }
    .ybb-logo { max-height: 34px; }
}

/* ── 移动端 (<768px) ── */
@media (max-width: 767px) {
    .navbar-white {
        backdrop-filter: saturate(160%) blur(8px);
        -webkit-backdrop-filter: saturate(160%) blur(8px);
    }
    .navbar-brand.ybb-brand {
        height: 50px;
        padding-left: 15px;
        padding-right: 10px;
    }
    .ybb-logo { max-height: 38px; }
    .ybb-sitename { font-size: 15px; margin-left: 8px; }
    .navbar-white .navbar-collapse {
        display: block !important;
        position: fixed;
        top: 0;
        overflow-y: auto;
        z-index: 9999;
        background: #fff;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
        max-height: inherit;
        height: 100vh;
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        width: 260px;
        margin-left: -280px;
        margin-right: 0;
        padding: 0 0 20px 0;
        flex-direction: column;
    }
    .navbar-white .navbar-collapse.active {
        transform: translateX(280px);
    }
    .navbar-white .navbar-collapse > ul.navbar-nav {
        margin: 15px 0;
    }
    .navbar-white .navbar-collapse > ul.navbar-nav > li {
        margin-bottom: 2px;
    }
    .navbar-white .navbar-nav > li > a {
        padding-top: 12px;
        padding-bottom: 12px;
        padding-left: 20px;
        padding-right: 20px;
    }
    .navbar-white .navbar-nav > li > a::after { display: none; }
    .navbar-white .navbar-collapse > ul.navbar-nav li > a b.caret {
        position: absolute;
        right: 15px;
        top: 50%;
        margin-top: -2px;
    }
    .navbar-white .navbar-collapse > ul.navbar-nav:first-child {
        width: 100%;
    }
    .navbar-white .navbar-collapse > ul.navbar-nav.navbar-right {
        width: 100%;
        border-top: 1px solid #f3f4f6;
        padding-top: 10px;
    }
    .navbar-white .navbar-collapse-bg {
        position: fixed;
        top: 0;
        z-index: 9998;
        background: rgba(0,0,0,.4);
        height: 100vh;
        width: 100%;
        display: none;
        animation: fadeIn .2s ease;
    }
    .navbar-white .navbar-collapse-bg.active { display: block; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    
    .navbar-right .form-search input {
        width: 100%;
        border: 1.5px solid #e5e7eb;
        background: #f9fafb;
    }
    .navbar-right .form-search input:focus { width: 100%; }
    
    .navbar-userinfo > a { padding-left: 20px; }
    
    /* 移动端下拉菜单 */
    .navbar-white .navbar-nav .open .dropdown-menu {
        position: relative;
        width: 100%;
        background: #f9fafb;
        box-shadow: none;
        border-radius: 0;
        animation: none;
    }
    .navbar-white .navbar-nav .open .dropdown-menu > li > a {
        padding-left: 35px;
    }
}
