/* ==========================================
   mobile.css - 移动端专用样式
   ========================================== */

/* ========== 1. 移动端头部导航栏 ========== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--gradient-primary);
    z-index: 1000;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--shadow-md);
}

.mobile-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-header .menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.mobile-header .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-header .mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
}

.mobile-header .mobile-logo i {
    font-size: 1.3rem;
}

.mobile-header .mobile-logo span {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ========== 2. 抽屉式分类导航 ========== */
.drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.drawer-overlay.show {
    display: block;
    opacity: 1;
}

.drawer-nav {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-warm-white);
    z-index: 1100;
    transition: left var(--transition-normal);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.drawer-nav.open {
    left: 0;
}

.drawer-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--gradient-primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.drawer-nav-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-nav-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.drawer-nav-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.drawer-nav-content {
    padding: 16px;
}

.drawer-nav-content .drawer-category-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-nav-content .drawer-category-item:hover {
    background: var(--bg-light-pink);
    color: var(--primary);
}

.drawer-nav-content .drawer-category-item.active {
    background: var(--gradient-primary);
    color: white;
}

.drawer-nav-content .drawer-category-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.drawer-nav-content .drawer-category-group {
    margin-bottom: 8px;
}

.drawer-nav-content .drawer-category-group-title {
    font-weight: 600;
    color: var(--text-dark);
    padding: 12px 16px 8px;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.drawer-nav-content .drawer-category-group-title:first-child {
    border-top: none;
    margin-top: 0;
}

.drawer-nav-content .drawer-child-item {
    padding-left: 36px;
    font-size: 0.9rem;
}

/* ========== 3. 移动端搜索区域优化 ========== */
@media (max-width: 767.98px) {
    .search-box {
        padding: 80px 0 40px;
        margin-top: 56px;
    }

    .search-box .site-logo {
        margin-bottom: 16px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .logo-text h1 {
        font-size: 1.3rem;
    }

    .logo-text span {
        display: none;
    }

    .search-input,
    .search-btn {
        height: 44px;
        font-size: 15px;
    }

    .search-btn {
        padding: 0 20px;
    }
}

/* ========== 4. 移动端内容布局 ========== */
@media (max-width: 767.98px) {
    /* 隐藏桌面端分类导航 */
    .col-lg-3 .category-nav {
        display: none;
    }

    /* 主内容区全宽 */
    .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* 推荐资源移到主内容下方 */
    .col-lg-3 .sidebar-box {
        margin-top: 20px;
    }

    /* 侧边栏全宽 */
    .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* 资源卡片优化 */
    .resource-card .card-body {
        padding: 16px;
    }

    .resource-title {
        font-size: 1rem;
    }

    .resource-desc {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .resource-meta {
        font-size: 0.8rem;
    }

    /* 详情页优化 */
    .resource-title-detail {
        font-size: 1.2rem;
    }

    .resource-meta-detail {
        gap: 12px;
        font-size: 0.85rem;
    }

    .resource-description {
        padding: 12px;
        font-size: 0.9rem;
    }

    /* 面包屑优化 */
    .breadcrumb-box {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    /* 分页优化 */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .page-link {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* ========== 5. 移动端详情页 ========== */
@media (max-width: 767.98px) {
    .detail-card .card-header {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .detail-card .card-body {
        padding: 16px;
    }

    .link-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px;
    }

    .link-item .download-btn {
        width: 100%;
        justify-content: center;
    }

    .back-btn {
        margin-top: 12px;
    }
}

/* ========== 6. 移动端页脚 ========== */
@media (max-width: 767.98px) {
    .site-footer {
        padding: 24px 0;
        margin-top: 32px;
    }

    .site-footer p {
        font-size: 0.8rem;
        line-height: 1.5;
    }
}

/* ========== 7. 移动端显示/隐藏工具类 ========== */
.d-mobile-none {
    display: none !important;
}

.d-mobile-block {
    display: block !important;
}

.d-mobile-flex {
    display: flex !important;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block !important;
    }

    .d-mobile-block,
    .d-mobile-flex {
        display: none !important;
    }
}

/* ========== 8. 移动端底部导航栏（可选） ========== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-warm-white);
    border-top: 1px solid var(--border-light);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-medium);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color var(--transition-fast);
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.2rem;
}

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:hover {
    color: var(--primary);
}

@media (max-width: 767.98px) {
    .mobile-bottom-nav {
        display: flex;
    }

    /* 为底部导航留出空间 */
    .site-footer {
        padding-bottom: 70px;
    }
}

/* ========== 9. 移动端无结果提示优化 ========== */
@media (max-width: 767.98px) {
    .no-result {
        padding: 40px 20px;
    }

    .no-result i {
        font-size: 2.5rem;
    }

    .no-result p {
        font-size: 0.9rem;
    }
}

/* ========== 10. 移动端表格响应式 ========== */
.table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table-responsive-mobile {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .table-responsive-mobile table {
        min-width: 600px;
    }
}

/* ========== 11. 移动端表单优化 ========== */
@media (max-width: 767.98px) {
    .admin-form .form-control,
    .admin-form .form-select {
        font-size: 16px; /* 防止 iOS 缩放 */
    }
}

/* ========== 12. 移动端消息提示优化 ========== */
@media (max-width: 767.98px) {
    .alert {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
}