/* ============================================
   汉堡菜单组件样式（从 hamburger_menu.html 内联 <style> 提取）
   版本: 1.0.1
   用途: 侧边导航栏完整样式
   命名前缀: ys- （与 buttons.css / datetime-picker.css 等新组件保持一致）
   ============================================ */

/* ============================================
   汉堡菜单按钮样式
   ============================================ */
.ys-hamburger-btn {
    /* display 由 top-bar.css 统一管理，此处不设置 */
    width: 36px;
    height: 36px;
    background: var(--primary, #1e9fff);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(30, 159, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    order: -1;
}

.ys-hamburger-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(30, 159, 255, 0.4);
}

.ys-hamburger-btn:active {
    transform: scale(0.95);
}

.ys-hamburger-btn .ys-hamburger-icon {
    width: 18px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    position: relative;
}

.ys-hamburger-btn .ys-hamburger-icon .ys-hamburger-bar {
    display: block;
    width: 16px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* 汉堡菜单激活状态（X 形状） */
.ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ============================================
   侧边栏遮罩层
   ============================================ */
.ys-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.ys-menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   侧边栏样式
   ============================================ */
.ys-side-menu {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 200px;
    max-width: 50vw;
    background: #ffffff;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ys-side-menu.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

/* Logo 区域 */
.ys-menu-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    background: #ffffff;
}

.ys-menu-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    color: #212529;
}

.ys-menu-logo:hover {
    opacity: 0.8;
}

.ys-menu-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.ys-menu-logo-text {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
}

/* 菜单列表区域 - 带滚动条 */
.ys-menu-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
}

/* .ys-menu-content 滚动条：统一由 css-components/scrollbars.css 提供（已添加 .scrollbar-thin 类） */

/* 菜单项样式 */
.ys-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.ys-menu-item:hover {
    background: rgba(30, 159, 255, 0.08);
    color: #1e9fff;
}

.ys-menu-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ys-menu-item-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.ys-menu-item-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* 折叠菜单样式 */
.ys-menu-submenu {
    border-top: 1px solid #f1f3f6;
    margin-top: 4px;
}

.ys-submenu-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    position: relative;
}

.ys-submenu-toggle:hover {
    background: rgba(30, 159, 255, 0.08);
    color: #1e9fff;
}

.ys-submenu-toggle-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ys-submenu-toggle-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.ys-submenu-arrow {
    margin-left: auto;
    width: 16px;
    height: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.ys-submenu-toggle.active .ys-submenu-arrow {
    transform: rotate(90deg);
}

.ys-submenu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ys-submenu-items.open {
    max-height: 300px;
}

.ys-submenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 10px 52px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 13px;
}

.ys-submenu-item:hover {
    background: rgba(30, 159, 255, 0.08);
    color: #1e9fff;
}

.ys-submenu-dot {
    width: 6px;
    height: 6px;
    background: #1e9fff;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 用户菜单区域 - 可折叠 */
.ys-menu-footer {
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.ys-user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.ys-user-menu-toggle:hover {
    background: rgba(30, 159, 255, 0.08);
}

.ys-user-menu-toggle .ys-user-avatar-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #1e9fff 0%, #1886d7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.ys-user-menu-toggle .ys-user-info-text {
    flex: 1;
    min-width: 0;
}

.ys-user-menu-toggle .ys-user-name {
    font-size: 14px;
    font-weight: 500;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ys-user-menu-toggle .ys-user-role {
    font-size: 11px;
    color: #59636e;
}

.ys-user-menu-toggle .ys-user-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.ys-user-menu-toggle.active .ys-user-arrow {
    transform: rotate(180deg);
}

.ys-user-menu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8f9fa;
}

.ys-user-menu-items.open {
    max-height: 400px;
}

.ys-footer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 62px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 13px;
}

.ys-footer-link:hover {
    background: rgba(30, 159, 255, 0.08);
    color: #1e9fff;
}

.ys-footer-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* 登录/注册按钮 */
.ys-auth-buttons {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
}

.ys-auth-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ys-auth-btn-login {
    background: #1e9fff;
    color: white;
}

.ys-auth-btn-login:hover {
    background: #1886d7;
}

.ys-auth-btn-register {
    background: white;
    color: #1e9fff;
    border: 1px solid #1e9fff;
}

.ys-auth-btn-register:hover {
    background: rgba(30, 159, 255, 0.08);
}

/* ============================================
   响应式显示控制
   注意：ys-hamburger-btn 的 display/position 由 top-bar.css 统一管理，
   此处仅控制尺寸和视觉适配。
   ============================================ */

/* 平板设备 */
@media (min-width: 768px) and (max-width: 1023px) {
    .ys-hamburger-btn .ys-hamburger-icon {
        width: 24px;
        height: 24px;
        gap: 5px;
    }

    .ys-hamburger-btn .ys-hamburger-icon .ys-hamburger-bar {
        width: 20px;
    }

    .ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* 小屏幕优化 */
@media (max-width: 767px) {
    .ys-hamburger-btn {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .ys-hamburger-btn .ys-hamburger-icon {
        width: 16px;
        height: 16px;
        gap: 3px;
    }

    .ys-hamburger-btn .ys-hamburger-icon .ys-hamburger-bar {
        width: 14px;
        height: 2px;
    }

    .ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(1) {
        transform: translateY(5px) rotate(45deg);
    }

    .ys-hamburger-btn.active .ys-hamburger-icon .ys-hamburger-bar:nth-child(3) {
        transform: translateY(-5px) rotate(-45deg);
    }

    .ys-side-menu {
        width: 85vw;
    }

    .ys-menu-header {
        padding: 16px;
    }

    .ys-menu-logo-img {
        width: 36px;
        height: 36px;
    }

    .ys-menu-logo-text {
        font-size: 16px;
    }

    .ys-menu-item {
        padding: 14px 16px;
        min-height: 48px;
    }

    .ys-submenu-toggle {
        padding: 14px 16px;
        min-height: 48px;
    }

    .ys-submenu-item {
        padding: 12px 16px 12px 48px;
        min-height: 44px;
    }

    .ys-user-menu-toggle {
        padding: 14px 16px;
        min-height: 48px;
    }

    .ys-footer-link {
        padding: 12px 16px 12px 48px;
        min-height: 44px;
    }
}