/* 响应式头部样式 */

/* 辅助功能 - 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 隐藏旧的头部 */
.in-header {
    display: none !important;
}

/* 响应式头部 */
.responsive-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.header-logo {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.header-logo span:first-child {
    color: #333;
}

.header-logo span:last-child {
    color: #ff620e;
}

/* 桌面端导航 */
.desktop-nav {
    display: flex;
    gap: 30px;
    flex: 1;
    justify-content: center;
}

.desktop-nav a {
    color: #666;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.3s;
    position: relative;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.desktop-nav a .nav-icon {
    font-size: 18px;
    font-style: normal;
    opacity: 0.8;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    color: #ff620e;
}

.desktop-nav a:hover .nav-icon,
.desktop-nav a.active .nav-icon {
    opacity: 1;
}

.desktop-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #ff620e;
    transition: width 0.3s;
}

.desktop-nav a:hover::after,
.desktop-nav a.active::after {
    width: 100%;
}

/* 右侧功能区 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-btn,
.theme-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    color: #666;
    font-size: 18px;
}

.search-btn .nav-icon,
.theme-toggle .nav-icon {
    font-size: 20px;
    font-style: normal;
}

.search-btn:hover,
.theme-toggle:hover {
    background: #f5f5f5;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #f0f0f0;
    transition: border-color 0.3s;
}

.user-avatar:hover {
    border-color: #ff620e;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: #999;
    border-radius: 2px;
    transition: all 0.3s;
}

/* 移动端侧边栏 */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s;
}

.mobile-sidebar.active {
    visibility: visible;
    opacity: 1;
}

.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.sidebar-content {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85%;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.3s;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar.active .sidebar-content {
    transform: translateX(0);
}

/* 侧边栏头部 */
.sidebar-header {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 侧边栏搜索 */
.sidebar-search {
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-search-input {
    flex: 1;
    height: 40px;
    padding: 0 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.sidebar-search-input:focus {
    border-color: #ff620e;
}

.sidebar-search-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #ff620e;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-search-btn .nav-icon {
    font-size: 18px;
    font-style: normal;
}

/* 侧边栏导航 */
.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s;
    gap: 15px;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
    background: #fff3f0;
    color: #ff620e;
}

.sidebar-nav-item .nav-icon {
    font-size: 22px;
    font-style: normal;
    width: 28px;
    text-align: center;
}

.sidebar-nav-item span {
    font-size: 15px;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
}

.sidebar-login-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #ff620e;
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 25px;
    font-size: 15px;
    transition: background 0.3s;
}

.sidebar-login-btn:hover {
    background: #ff7328;
}

/* 主题切换 */
.sidebar-theme-toggle {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
}

.theme-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.theme-switch input {
    display: none;
}

.theme-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    transition: background 0.3s;
}

.theme-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.theme-switch input:checked + .theme-slider {
    background: #ff620e;
}

.theme-switch input:checked + .theme-slider::before {
    transform: translateX(24px);
}

.theme-label {
    font-size: 14px;
    color: #666;
}

/* 搜索弹窗 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 70px;
}

.search-modal.active {
    display: flex;
}

.search-modal-content {
    width: 90%;
    max-width: 600px;
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    position: relative;
}

.search-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.search-modal-input-wrapper {
    display: flex;
    gap: 10px;
}

.search-modal-input {
    flex: 1;
    height: 50px;
    padding: 0 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
}

.search-modal-input:focus {
    border-color: #ff620e;
}

.search-modal-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: #ff620e;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-btn .nav-icon {
    font-size: 22px;
    font-style: normal;
}

/* 夜间模式 */
body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .responsive-header {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .header-logo,
body.dark-mode .desktop-nav a {
    color: #e0e0e0;
}

body.dark-mode .sidebar-content {
    background: #2a2a2a;
}

body.dark-mode .sidebar-nav-item {
    color: #e0e0e0;
}

body.dark-mode .sidebar-nav-item:hover {
    background: #333;
}

body.dark-mode .search-modal-content {
    background: #2a2a2a;
}

body.dark-mode .comic-card {
    background: #2a2a2a;
}

/* 响应式断点 */

/* 平板及以下 */
@media screen and (max-width: 1024px) {
    .desktop-nav {
        gap: 20px;
    }
    
    .desktop-nav a {
        font-size: 14px;
    }
}

/* 手机端 */
@media screen and (max-width: 768px) {
    .responsive-header {
        height: 56px;
    }
    
    .header-container {
        padding: 0 15px;
        display: flex;
        align-items: center;
        position: relative;
    }
    
    .desktop-nav {
        display: none;
    }
    
    .search-btn,
    .theme-toggle {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
        position: absolute;
        left: 15px;
        width: 22px;
        height: 18px;
        padding: 0;
    }
    
    .mobile-menu-btn span {
        height: 2px;
        background: #999;
    }
    
    .header-logo {
        font-size: 18px;
        flex: 1;
        margin-left: 45px;
    }
    
    .header-actions {
        margin-left: auto;
    }
}

/* 小屏手机 */
@media screen and (max-width: 480px) {
    .header-container {
        padding: 0 10px;
    }
    
    .mobile-menu-btn {
        left: 10px;
    }
    
    .header-logo {
        font-size: 16px;
        margin-left: 40px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }
}
