/*
 * 页面外壳样式：顶部菜单、页脚、搜索触发按钮等（配合 js/shell.js，不依赖 Bootstrap / MDB / Quasar 运行时）。
 * 暗色主题的取值写在 theme-dark.less 的「页面外壳」一节（只覆盖下面的 --sh-* 变量），本文件只写亮色默认值。
 */
:root {
    --sh-bar-bg: #1266f1;
    --sh-bar-fg: #fff;
    --sh-bar-hover: rgba(255, 255, 255, 0.14);
    --sh-menu-bg: #fff;
    --sh-menu-fg: #1d1d1d;
    --sh-menu-hover: rgba(0, 0, 0, 0.06);
    --sh-menu-border: rgba(0, 0, 0, 0.08);
    --sh-menu-shadow: 0 1px 5px rgba(0, 0, 0, 0.2), 0 2px 2px rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12);
    --sh-footer-bg: #f5f5f5;
    --sh-footer-fg: #616161;
}

#top-toolbar {
    margin-bottom: 20px;
    position: relative;
    z-index: 100;
}

.site-header__bar {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    max-width: 1320px;
    min-height: 50px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
    color: var(--sh-bar-fg);
}

#top-toolbar {
    background: var(--sh-bar-bg);
    color: var(--sh-bar-fg);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2), 0 2px 2px rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12);
}

#navbar_logo {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 19px;
    margin-right: 20px;
    min-height: 50px;
    flex: 0 0 auto;
    white-space: nowrap;
}

#navbar_logo > img {
    height: 30px;
    margin-right: 10px;
}

#top-toolbar .menus {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    white-space: nowrap;
}

#top-toolbar .menus.flex-1 {
    flex: 1 1 0;
    justify-content: flex-end;
    min-width: 0;
}

/* 顶栏按钮 / 下拉触发器 */
.sh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 50px;
    padding: 0 8px;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: normal;
    line-height: 1.2;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.sh-btn:hover,
.sh-btn:focus-visible,
.sh-dd.open > .sh-dd-toggle {
    background: var(--sh-bar-hover);
    color: #fff;
    text-decoration: none;
}

.sh-btn:focus-visible,
.sh-item:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.sh-btn-icon {
    min-width: 44px;
    padding: 0 8px;
}

.sh-btn[hidden],
.tools-search-trigger[hidden] {
    display: none !important;
}

.sh-ico {
    flex: 0 0 auto;
    vertical-align: middle;
}

#top-toolbar .menus .mh-10 {
    margin-left: 4px;
    margin-right: 4px;
}

/* 下拉箭头 */
.sh-dd-toggle:not(.sh-no-caret)::after {
    content: "";
    width: 0;
    height: 0;
    margin-left: 3px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
}

/* 主题图标：只显示当前模式那一个 */
.sh-theme-icon {
    display: inline-flex;
}

.sh-theme-icon .sh-ico {
    display: none;
}

.sh-theme-icon[data-mode="auto"] .sh-mode-auto,
.sh-theme-icon[data-mode="light"] .sh-mode-light,
.sh-theme-icon[data-mode="dark"] .sh-mode-dark {
    display: inline-block;
}

/* 下拉面板 */
.sh-dd {
    position: relative;
    display: flex;
    align-items: stretch;
}

.sh-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 3000;
    min-width: 230px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    text-align: left;
    white-space: normal;
    background: var(--sh-menu-bg);
    color: var(--sh-menu-fg);
    border-radius: 4px;
    box-shadow: var(--sh-menu-shadow);
}

/* 没有飞出子菜单的下拉：过高时自己滚动（含子菜单的下拉不能裁剪，否则三级菜单会被切掉） */
.sh-menu-scroll,
.sh-menu-nested {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.sh-menu.sh-menu-end {
    left: auto;
    right: 0;
    min-width: 160px;
}

.sh-dd.open > .sh-menu,
.sh-sub.open > .sh-menu {
    display: block;
}

.sh-sub {
    position: relative;
}

/* 三级菜单：桌面向右飞出，放不下时由 shell.js 加 .flip 改为向左 */
.sh-menu-nested {
    top: -8px;
    left: 100%;
    min-width: 220px;
}

.sh-menu-nested.flip {
    left: auto;
    right: 100%;
}

.sh-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 8px 16px;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--sh-menu-fg);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.sh-item:hover,
.sh-item:focus-visible,
.sh-item.active,
.sh-sub.open > .sh-sub-toggle {
    background: var(--sh-menu-hover);
    color: var(--sh-menu-fg);
    text-decoration: none;
}

.sh-item-label {
    flex: 1 1 auto;
    min-width: 0;
}

.sh-item-svg {
    flex: 0 0 auto;
}

.sh-sub-arrow {
    margin-left: auto;
    opacity: 0.7;
}

/* 菜单项图标：data-icon 里是 Material Icons 名称，伪元素渲染，链接文字保持为纯名称 */
.sh-item-ico {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin-right: 4px;
}

.sh-item-ico::before,
.side-tool-ico::before,
.mi-ico::before {
    content: attr(data-icon);
    font-family: 'Material Icons Outlined', 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

.side-tool-ico {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.side-tool-ico::before {
    font-size: 18px;
}

/* 通用：任意元素加 data-icon="图标名" + class="mi-ico" 即显示 Material Icons 图标（装饰性） */
.mi-ico {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    line-height: 1;
}

.mi-ico::before {
    font-size: inherit;
}

.sh-item-ico.text-primary {
    color: var(--q-primary, #1266f1);
}

.sh-menu .sh-item-ico:not(.text-primary) {
    color: #616161;
}

.btn_account .sh-ico {
    margin-right: 2px;
}

.site-header__mobile {
    display: none;
}

/* 窄屏（≤840px）：菜单收进汉堡按钮，展开后纵向排列在顶栏下方 */
@media (max-width: 840px) {
    .site-header__bar {
        flex-wrap: wrap;
    }

    .site-header__mobile {
        display: flex;
        align-items: stretch;
        margin-left: auto;
    }

    #top-toolbar .menus {
        display: none;
    }

    #top-toolbar .menus.visible {
        display: flex;
        order: 10;
        flex: 0 0 100%;
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 8px;
    }

    #top-toolbar .menus.visible.flex-1 {
        order: 9;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        padding-bottom: 0;
    }

    #top-toolbar .menus.visible:not(.flex-1) > .sh-btn,
    #top-toolbar .menus.visible:not(.flex-1) .sh-dd > .sh-btn {
        width: 100%;
        min-height: 44px;
        justify-content: flex-start;
        margin: 0;
        padding: 0 6px;
    }

    #top-toolbar .menus.visible .mh-10 {
        margin: 0;
    }

    #top-toolbar .menus.visible:not(.flex-1) .sh-dd {
        display: block;
        position: static;
    }

    #top-toolbar .menus.visible:not(.flex-1) .sh-dd-toggle::after {
        margin-left: auto;
    }

    /* 展开的下拉在原处向下排开，而不是飞出屏幕 */
    #top-toolbar .menus.visible .sh-menu {
        position: static;
        max-height: none;
        box-shadow: none;
        border-radius: 4px;
        margin: 0 0 4px;
    }

    #top-toolbar .menus.visible .sh-menu-nested {
        margin: 0;
        padding: 0 0 0 16px;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .sh-btn-icon.btn-menu {
        margin-left: 0;
    }

    /* 窄屏搜索 / 主题常驻汉堡按钮左侧；右侧菜单里的重复入口隐藏 */
    .site-header__mobile .tools-search-mobile {
        display: inline-flex;
    }

    #top-toolbar .menus .tools-search-desktop,
    #top-toolbar .menus .sh-theme-desktop {
        display: none !important;
    }

    #top-toolbar .btn-register {
        display: inline-flex;
    }

    /* 窄屏的主题 / 语言下拉：相对各自按钮定位，向左展开 */
    .site-header__mobile .sh-dd {
        position: relative;
    }
}

@media (min-width: 841px) {
    #top-toolbar .btn-menu,
    #top-toolbar .site-header__mobile {
        display: none;
    }
}

@media (min-width: 841px) and (max-width: 1200px) {
    #top-toolbar .menus .sh-btn {
        padding-left: 6px;
        padding-right: 6px;
        font-size: 13px;
    }

    #top-toolbar .menus .mh-10 {
        margin-left: 3px;
        margin-right: 3px;
    }
}

@media (max-width: 1140px) {
    .site-header__bar {
        padding: 0 15px;
    }
}

@media (max-width: 940px) and (min-width: 841px) {
    #top-toolbar .btn-register {
        display: none;
    }
}

@media (max-width: 899px) {
    .btn_account .btn_account-name {
        display: none;
    }

    .btn_account .sh-ico {
        margin-right: 0;
    }
}

@media (max-width: 840px) {
    .btn_account .btn_account-name {
        display: inline;
    }
}

/* 一次性提示（flash 消息）：放在顶栏下方，铺满内容区宽度 */
.site-flash {
    max-width: 1140px;
    margin: 20px auto 0;
    padding: 12px 16px;
    border-radius: 4px;
    color: #fff;
    background: #1976d2;
    box-sizing: border-box;
}

.site-flash a {
    color: inherit;
    text-decoration: underline;
}

.site-flash-positive,
.site-flash-success {
    background: #21ba45;
}

.site-flash-negative,
.site-flash-danger {
    background: #c10015;
}

.site-flash-warning {
    background: #f2c037;
    color: #1d1d1d;
}

.site-flash-info {
    background: #31ccec;
    color: #1d1d1d;
}

/* 页脚 */
.site-footer {
    margin-top: 30px;
    padding: 15px 0;
    background: var(--sh-footer-bg);
    color: var(--sh-footer-fg);
}

.site-footer .container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.site-footer p {
    margin: 0 0 7px;
}

.site-footer p:last-child {
    margin-bottom: 0;
}

@media print {
    #top-toolbar,
    .site-footer {
        display: none !important;
    }
}
