/**
 * 移动端适配CSS
 * 
 * 本文件包含网站在移动设备上的响应式样式
 * 主要针对导航栏、菜单、工具栏等组件进行优化
 * 
 * @version 2.0
 */

/* ===== 中等屏幕设备 (平板电脑等) ===== */
@media screen and (max-width: 768px) {
    /* 导航栏布局优化 */
    .navbar {
        padding: 0.5rem 1rem !important;
        height: 60px;
        box-sizing: border-box;
    }
    
    .nav-left {
        flex: 1;
        justify-content: space-between;
    }
    
    .nav-menu {
        display: none;
    }
    
    /* 导航栏图标按钮适配 */
    .nav-right {
        display: flex !important;
        gap: 0.5rem !important;
        margin-left: auto;
    }
    
    .nav-icon-btn {
        display: flex !important;
        font-size: 0.7rem;
        margin: 0 2px;
        position: relative;
    }
    
    .icon-circle {
        width: 30px;
        height: 30px;
        transition: background-color 0.2s ease;
    }
    
    .nav-icon-btn i {
        font-size: 0.9rem;
    }
    
    .badge {
        font-size: 0.5rem;
        min-width: 12px;
        padding: 1px 2px;
        top: -2px;
        right: -3px;
    }
    
    /* 菜单按钮样式优化 */
    .menu-button {
        display: block !important;
        cursor: pointer;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #333;
        padding: 0.5rem;
        z-index: 1002;
        transition: color 0.2s ease;
    }
    
    .menu-button:active {
        color: #f56a6a;
    }
    
    /* 移动菜单样式优化 */
    .mobile-menu {
        position: fixed;
        top: 60px;
        right: 0;
        width: 75%;
        max-width: 280px;
        background-color: white;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        z-index: 1001;
        border-radius: 8px;
        margin: 0.5rem;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        display: none;
        opacity: 0;
        transform: translateX(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .mobile-menu.active {
        display: block !important;
        opacity: 1;
        transform: translateX(0);
    }
    
    .mobile-menu-item {
        display: block;
        padding: 1rem;
        color: #333;
        text-decoration: none;
        border-bottom: 1px solid rgba(245, 106, 106, 0.1);
        transition: background-color 0.2s ease;
    }
    
    .mobile-menu-item:hover {
        background-color: rgba(245, 106, 106, 0.05);
    }
    
    .mobile-menu-item:active {
        background-color: rgba(245, 106, 106, 0.1);
    }
    
    /* 移动端子菜单样式 */
    .mobile-submenu {
        background-color: #f9f9f9;
        padding: 0.5rem 0;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .has-submenu.active .mobile-submenu {
        display: block;
        max-height: 500px; /* 足够大的高度以容纳内容 */
    }
    
    .mobile-submenu-title {
        padding: 0.5rem 1.5rem;
        color: #f56a6a;
        font-weight: 500;
        font-size: 0.85rem;
    }
    
    .mobile-submenu-item {
        padding: 0.75rem 2rem;
        display: block;
        color: #555;
        text-decoration: none;
        font-size: 0.8rem;
        transition: background-color 0.2s ease, color 0.2s ease;
    }
    
    .mobile-submenu-item:hover {
        background-color: rgba(245, 106, 106, 0.05);
        color: #f56a6a;
    }
    
    .mobile-submenu-item:active {
        background-color: rgba(245, 106, 106, 0.1);
    }
    
    /* 用户下拉菜单移动端适配 */
    .user-dropdown {
        right: -10px;
        width: 240px;
        padding: 15px;
        top: 45px;
        z-index: 1100 !important;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
        border-radius: 10px;
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        display: none; /* 确保初始状态是隐藏的 */
        background-color: white; /* 确保背景是白色 */
    }
    
    .user-dropdown.active {
        opacity: 1;
        transform: translateY(0);
        display: block !important; /* 强制显示 */
    }
    
    /* 确保用户信息可以点击 */
    .user-profile {
        position: relative;
        cursor: pointer;
    }
    
    .user-profile:active .user-dropdown {
        display: block !important;
        opacity: 1;
        transform: translateY(0);
    }
    
    .user-info {
        padding-bottom: 15px;
        margin-bottom: 15px;
        border-bottom: 1px solid #eee;
    }
    
    .user-name, .user-role, .user-points {
        font-size: 14px;
        margin: 10px 0;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        color: #333; /* 确保文字颜色 */
    }
    
    .user-name span, .user-role span, .user-points span {
        text-align: right;
        color: #333; /* 确保右侧文字颜色 */
        display: inline-block; /* 确保显示 */
    }
    
    .user-actions {
        padding: 5px 0;
        display: flex;
        justify-content: center;
    }
    
    .user-action-btn.logout {
        font-size: 14px;
        padding: 8px 20px;
        transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    }
    
    .user-action-btn.logout:active {
        transform: scale(0.98);
    }
    
    /* 内容区域适配 */
    .content {
        padding-top: 70px;
        padding-bottom: 50px;
    }
    
    /* 阅读工具栏优化 - 与电脑版保持一致，固定在右下角 */
    .reading-toolbar {
        display: flex !important;
        flex-direction: column !important;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1002;
        /* background: #fff; */
        border-radius: 8px;
        /* box-shadow: 0 2px 15px rgba(0, 0, 0, 0.15); */
        padding: 8px;
        width: auto;
        max-width: none;
        height: auto;
        transition: opacity 0.3s ease;
    }
    
    /* 向下滚动时隐藏工具栏 */
    .reading-toolbar.hidden {
        opacity: 0.2;
    }
    
    .toolbar-btn {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
        text-align: left;
        justify-content: flex-start;
        padding: 8px 12px;
        margin-bottom: 5px;
        font-size: 0.8rem;
        height: auto;
        width: 100%;
        white-space: nowrap;
        transition: background-color 0.2s ease;
    }
    
    .toolbar-btn:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    
    .toolbar-btn i {
        margin-right: 8px;
        font-size: 0.9rem;
        width: 16px;
        text-align: center;
    }
    
    .toolbar-btn:active {
        background-color: rgba(245, 106, 106, 0.1);
    }
    
    /* 搜索框适配 */
    .simple-search {
        top: 70px;
        right: 10px;
        max-width: calc(100% - 20px);
        z-index: 1003;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
        border-radius: 8px;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .simple-search.active {
        opacity: 1;
        transform: translateY(0);
    }
    
    #search-input {
        padding: 5px;
        width: 120px;
        font-size: 14px;
        border-radius: 4px 0 0 4px;
        height: 25px;
        -webkit-border-radius: 4px 0 0 4px;
        -moz-border-radius: 4px 0 0 4px;
        -ms-border-radius: 4px 0 0 4px;
        -o-border-radius: 4px 0 0 4px;
}
    
    #search-counter {
        right: 45px;
        font-size: 12px;
        min-width: 35px;
    }
    
    #search-btn {
        width: 40px;
        height: 38px;
    }
    
    .search-navigation button {
        width: 32px;
        height: 32px;
    }
    
    /* 首页内容适配 */
    .feature-section {
        flex-direction: column;
        margin: 2rem auto;
        padding: 0 1rem;
        gap: 2rem;
    }
    
    .feature-text {
        margin-top: 1rem;
        text-align: center;
        max-width: 100%;
    }
    
    .feature-image {
        text-align: center;
    }
    
    .demo-gif {
        margin-left: 0;
        max-width: 100%;
        border-radius: 8px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    /* 字体大小指示器 */
    #font-size-indicator {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 10px 20px;
        border-radius: 5px;
        z-index: 9999;
        font-size: 16px;
        transition: opacity 0.3s ease;
        opacity: 0;
    }
}

/* ===== 小屏幕设备 (手机等) ===== */
@media screen and (max-width: 480px) {
    /* 导航栏进一步优化 */
    .navbar {
        padding: 0.3rem 0.8rem !important;
        height: 55px;
    }
    
    .logo {
        width: 110px;
        height: 35px;
    }
    
    /* 保留图标但隐藏文本 */
    .nav-icon-btn span {
        display: none !important; /* 隐藏按钮文字，只显示图标 */
    }
    
    .icon-circle {
        margin-bottom: 0;
        width: 28px;
        height: 28px;
    }
    
    /* 确保消息标记可见 */
    .badge {
        position: absolute;
        top: -5px;
        right: -5px;
        z-index: 10;
    }
    
    /* 移动菜单进一步优化 */
    .mobile-menu {
        width: 85%;
        margin: 0.3rem;
        top: 55px;
    }
    
    /* 用户下拉菜单适配 - 小屏幕特殊处理 */
    .user-dropdown {
        width: 220px;
        right: -40px;
        padding: 15px;
        position: fixed;
        top: 60px;
        z-index: 1200 !important;
        background-color: white;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    }
    
    .user-dropdown.active {
        display: block !important;
    }
    
    /* 确保用户信息在小屏幕上可见 */
    .user-profile {
        position: static; /* 改为静态定位，避免下拉菜单被裁剪 */
    }
    
    .user-profile .user-dropdown {
        position: fixed;
        top: 60px;
        right: 10px;
        left: auto;
        width: calc(100% - 20px);
        max-width: 180px;
    }
    
    .user-name, .user-role, .user-points {
        font-size: 13px;
        margin: 6px 0;
        display: flex;
        justify-content: space-between;
        color: #333;
    }
    
    .user-name span, .user-role span, .user-points span {
        text-align: right;
        color: #333;
        font-weight: 500;
    }
    
    .user-action-btn.logout {
        padding: 6px 15px;
        font-size: 13px;
    }
    
    /* 阅读工具栏超小屏幕优化 - 保持右下角位置 */
    .reading-toolbar {
        bottom: 15px;
        right: 15px;
        padding: 6px;
    }
    
    .toolbar-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .toolbar-btn i {
        margin-right: 6px;
        font-size: 0.85rem;
    }
    
    /* 搜索框进一步适配 */
    .simple-search {
        max-width: calc(100% - 10px);
        right: 5px;
        top: 65px;
    }
    
    #search-input {
        width: 100px;
    }
    
    /* 首页内容进一步适配 */
    .feature-section {
        margin: 1rem auto;
        gap: 1.5rem;
    }
    
    .feature-text h1 {
        font-size: 2rem;
    }
    
    .description, .slogan {
        font-size: 0.9rem;
    }
    
    .button-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .button {
        width: 100%;
        text-align: center;
        padding: 12px;
        font-size: 16px;
    }
}

/* ===== 超小屏幕设备 (小型手机) ===== */
@media screen and (max-width: 360px) {
    .navbar {
        padding: 0.3rem 0.5rem !important;
    }
    
    .logo {
        width: 100px;
    }
    
    .icon-circle {
        width: 26px;
        height: 26px;
    }
    
    .nav-icon-btn i {
        font-size: 0.8rem;
    }
    
    .mobile-menu {
        width: 90%;
        max-width: 250px;
    }
    
    /* 超小屏幕用户下拉菜单特殊处理 */
    .user-dropdown {
        width: 200px;
        padding: 12px;
        top: 55px;
        right: 5px;
        background-color: white;
    }
    
    .user-profile .user-dropdown {
        width: calc(100% - 10px);
        max-width: 250px;
    }
    
    .user-name, .user-role, .user-points {
        font-size: 12px;
        margin: 5px 0;
        color: #333;
    }
    
    .user-name span, .user-role span, .user-points span {
        color: #333;
        font-weight: 500;
    }
    
    .user-action-btn.logout {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    /* 阅读工具栏超小屏幕优化 - 保持右下角位置 */
    .reading-toolbar {
        bottom: 10px;
        right: 10px;
        padding: 5px;
    }
    
    .toolbar-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
        margin-bottom: 3px;
    }
    
    .toolbar-btn i {
        margin-right: 5px;
        font-size: 0.8rem;
    }
    
    .user-dropdown {
        width: 200px;
        padding: 12px;
    }
    
    .simple-search {
        top: 60px;
    }
    
    #search-input {
        width: 80px;
        font-size: 13px;
    }
    
    #search-counter {
        right: 40px;
        min-width: 30px;
    }
    
    .feature-text h1 {
        font-size: 1.8rem;
    }
} 

/* 强制显示用户信息文字 */
.user-dropdown p {
    color: #333 !important;
    font-size: 14px !important;
    margin: 10px 0 !important;
    display: block !important;
    width: 100% !important;
}

.user-dropdown p span {
    color: #333 !important;
    font-weight: 500 !important;
    display: inline-block !important;
    text-align: right !important;
    float: right !important;
}

/* 确保下拉菜单可见 */
.user-dropdown.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    z-index: 9999 !important;
    background-color: white !important;
} 