/* public/css/responsive.css - 移动端响应式样式 */

/* ========================================
   移动端响应式样式（Mobile Responsive）
   断点: 768px (平板) / 480px (手机)
   ======================================== */

/* ---------- 1. 基础响应式设置 ---------- */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }
    
    body {
        padding-top: calc(var(--header-height) + 16px);
        font-size: 14px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .main-container {
        padding: 0 12px;
    }
}

/* ---------- 2. 头部导航移动端优化 ---------- */
@media (max-width: 768px) {
    .main-header {
        height: var(--header-height);
    }
    
    .header-nav {
        padding: 0 12px;
    }
    
    .nav-left, .nav-right {
        gap: 8px;
    }
    
    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .nav-link::before {
        font-size: 1.2rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .user-menu-trigger {
        padding: 4px 8px;
    }
    
    .user-menu-trigger span {
        display: none;
    }
}

/* ---------- 3. 页面标题区域 ---------- */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .page-subtitle {
        font-size: 0.85rem;
    }
}

/* ---------- 4. 统计卡片网格 ---------- */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 5. 文件网格布局 ---------- */
@media (max-width: 1024px) {
    .files-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .files-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .file-card {
        border-radius: 12px;
    }
    
    .file-thumbnail {
        height: 140px;
    }
    
    .file-title {
        font-size: 0.85rem;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .file-thumbnail {
        height: 180px;
    }
}

/* ---------- 6. 系列组网格 ---------- */
@media (max-width: 1024px) {
    .series-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .series-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .series-card {
        flex-direction: row;
        height: auto;
        min-height: 120px;
    }
    
    .series-cover {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
    }
    
    .series-info {
        padding: 12px;
        flex: 1;
    }
}

/* ---------- 7. 工具栏优化 ---------- */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box {
        width: 100%;
        min-width: auto;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .view-toggle {
        display: none;
    }
}

/* ---------- 8. 上传页面 ---------- */
@media (max-width: 768px) {
    .upload-dropzone {
        padding: 40px 20px;
        margin-bottom: 20px;
    }
    
    .upload-dropzone-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .upload-dropzone h3 {
        font-size: 1.1rem;
    }
    
    .upload-file-card {
        flex-direction: column;
        padding: 12px;
    }
    
    .file-preview-section {
        width: 100%;
        height: 160px;
        margin-bottom: 12px;
    }
    
    .file-info-section {
        width: 100%;
    }
    
    .upload-actions-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .upload-stats {
        width: 100%;
        justify-content: space-around;
    }
}

/* ---------- 9. 表单页面 ---------- */
@media (max-width: 768px) {
    .edit-card {
        padding: 20px;
        border-radius: 12px;
    }
    
    .form-section-title {
        font-size: 1rem;
    }
    
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- 10. 弹窗模态框 ---------- */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px auto;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: calc(100vh - 200px);
    }
    
    .modal-footer {
        padding: 12px 20px;
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* ---------- 11. 分享页面 ---------- */
@media (max-width: 768px) {
    .share-container {
        padding: 16px;
    }
    
    .share-file-preview {
        flex-direction: column;
    }
    
    .share-file-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .share-file-info {
        padding: 16px 0 0 0;
    }
}

/* ---------- 12. 探索页面 ---------- */
@media (max-width: 768px) {
    .explore-hero {
        padding: 30px 16px;
        margin-bottom: 20px;
    }
    
    .explore-hero h1 {
        font-size: 1.5rem;
    }
    
    .explore-search {
        max-width: 100%;
    }
    
    .file-carousel {
        padding: 12px 0;
    }
    
    .file-carousel-item {
        width: 140px;
    }
}

/* ---------- 13. 登录页面 ---------- */
@media (max-width: 768px) {
    .auth-container {
        padding: 20px;
        min-height: auto;
    }
    
    .auth-card {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
}

/* ---------- 14. 管理后台 ---------- */
@media (max-width: 768px) {
    .admin-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .admin-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .admin-table {
        font-size: 13px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
    }
    
    .admin-table td:nth-child(3),
    .admin-table th:nth-child(3) {
        display: none;
    }
}

@media (max-width: 480px) {
    .admin-table td:nth-child(4),
    .admin-table th:nth-child(4) {
        display: none;
    }
}

/* ---------- 15. 底部导航（移动端特有） ---------- */
@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        z-index: 100;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 12px;
        color: var(--text-secondary);
        font-size: 11px;
        text-decoration: none;
        transition: color 0.2s;
    }
    
    .mobile-nav-item.active,
    .mobile-nav-item:hover {
        color: var(--primary-color);
    }
    
    .mobile-nav-item .icon {
        font-size: 1.3rem;
    }
    
    /* 为底部导航留出空间 */
    body {
        padding-bottom: 70px;
    }
    
    /* 隐藏桌面端导航部分项目 */
    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-nav {
        display: none !important;
    }
    
    .mobile-only {
        display: none !important;
    }
}

/* ---------- 16. 按钮和交互 ---------- */
@media (max-width: 768px) {
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-lg {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    /* 增大触摸目标 */
    .file-card .btn-icon,
    .action-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 10px;
    }
}

/* ---------- 17. Toast 通知 ---------- */
@media (max-width: 768px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 70px;
    }
    
    .toast {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ---------- 18. 暗色模式移动端优化 ---------- */
@media (max-width: 768px) {
    [data-theme="dark"] .mobile-nav {
        background: var(--bg-card);
        border-top-color: var(--border-color);
    }
    
    [data-theme="dark"] .file-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* ---------- 19. 横屏模式优化 ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        margin: 10px auto;
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: calc(90vh - 120px);
    }
}

/* ---------- 20. 安全区域 ---------- */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        body {
            padding-top: max(calc(var(--header-height) + 16px), env(safe-area-inset-top));
            padding-bottom: max(70px, env(safe-area-inset-bottom));
        }
        
        .main-header {
            padding-top: env(safe-area-inset-top);
        }
        
        .mobile-nav {
            padding-bottom: env(safe-area-inset-bottom);
            height: calc(56px + env(safe-area-inset-bottom));
        }
    }
}
