/**
 * Forum Theme - 响应式样式
 */

/* 桌面端默认隐藏移动端元素 */
@media (min-width: 769px) {
    .mobile-user-avatar,
    .mobile-publish-btn,
    .mobile-menu-btn {
        display: none !important;
    }
}

/* 大桌面 (< 1280px) */
@media (max-width: 1280px) {
    .container {
        max-width: 1024px;
    }
}

/* 桌面 (< 1024px) */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .content-sidebar {
        order: -1;
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        overflow: hidden;
    }

    .sidebar-widget {
        min-width: 0;
        overflow: hidden;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-section {
        grid-template-columns: 1fr 180px;
        height: 280px;
    }

    .hero-user {
        display: none;
    }
}

/* 平板 (< 768px) */
@media (max-width: 768px) {
    .site-nav,
    .header-search,
    .auth-buttons {
        display: none !important;
    }

    /* 移动端显示用户下拉菜单 */
    .user-dropdown {
        display: block !important;
    }

    /* 移动端下拉菜单样式优化 */
    .user-dropdown .user-avatar {
        display: none; /* 隐藏桌面端的头像 */
    }

    .user-dropdown .dropdown-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: auto;
        width: 280px;
        margin-top: 0;
        border-radius: 0 0 12px 0;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }

    /* 移动端下拉菜单显示状态 */
    .user-dropdown .dropdown-menu.mobile-show {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* 移动端头部布局优化 */
    .header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
        gap: 0;
    }

    /* Logo居中 */
    .site-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1;
    }

    .site-brand .logo img {
        max-height: 32px;
    }

    .site-brand .site-name {
        font-size: 18px;
    }

    /* 移动端用户头像（左侧） */
    .mobile-user-avatar {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: transparent;
        cursor: pointer;
        padding: 0;
        z-index: 2;
        transition: transform 0.2s;
        flex-shrink: 0;
    }

    .mobile-user-avatar:active {
        transform: scale(0.95);
    }

    .mobile-user-avatar img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e5e7eb;
    }

    /* 移动端发布按钮（右侧） */
    .mobile-publish-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 0;
        background: transparent;
        color: var(--primary-color);
        text-decoration: none;
        z-index: 2;
        transition: all 0.3s;
        flex-shrink: 0;
        margin-left: auto;
        margin-right: 12px;
        border: none;
    }

    .mobile-publish-btn:hover {
        color: var(--primary-dark);
        transform: scale(1.1);
    }

    .mobile-publish-btn:active {
        transform: scale(0.95);
    }

    .mobile-publish-btn i {
        font-size: 24px;
    }

    /* 汉堡菜单按钮（右侧） */
    .mobile-menu-btn {
        display: block !important;
        z-index: 2;
        flex-shrink: 0;
    }

    /* 未登录状态：调整布局 */
    body:not(.user-logged-in) .header-inner {
        justify-content: space-between;
    }

    body:not(.user-logged-in) .site-brand {
        position: static;
        transform: none;
        margin-right: auto;
    }

    body:not(.user-logged-in) .mobile-menu-btn {
        margin-left: auto;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .category-list {
        grid-template-columns: 1fr;
    }

    .sidebar {
        grid-template-columns: 1fr;
    }

    .sidebar-widget {
        min-width: 0;
        overflow: hidden;
    }

    .auth-buttons .btn-text {
        display: none;
    }

    .auth-buttons .btn-primary {
        display: none;
    }

    .info-cards {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .contact-cards {
        flex-wrap: wrap;
    }

    .hero-section {
        grid-template-columns: 1fr;
        height: auto;
    }

    .hero-main {
        height: 200px;
    }

    .hero-list {
        display: none;
    }
}

/* 移动端 (< 640px) */
@media (max-width: 640px) {
    :root {
        --spacing-lg: 16px;
        --spacing-xl: 24px;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .feature-card {
        padding: var(--spacing-md);
    }

    .feature-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .feature-title {
        font-size: var(--font-sm);
    }

    .feature-desc {
        display: none;
    }

    .post-card-inner {
        flex-direction: column;
    }

    .post-avatar {
        display: none;
    }

    .post-meta {
        gap: var(--spacing-sm);
    }

    .user-name {
        display: none;
    }
}

/* 小屏手机 (< 375px) */
@media (max-width: 375px) {
    .feature-grid {
        grid-template-columns: 1fr 1fr;
    }

    .category-card {
        padding: var(--spacing-md);
    }

    .category-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}


/* ========== Profile Page Responsive ========== */

/* 桌面 (< 1024px) */
@media (max-width: 1024px) {
    .profile-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板 (< 768px) */
@media (max-width: 768px) {
    .profile-info-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: var(--spacing-lg);
        margin-top: -60px;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .profile-info {
        padding-top: 0;
    }

    .profile-name {
        justify-content: center;
        flex-wrap: wrap;
    }

    .profile-url,
    .profile-join-date {
        justify-content: center;
    }

    .profile-actions {
        padding-top: 0;
        justify-content: center;
    }

    .profile-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-points-card {
        flex-wrap: wrap;
        gap: var(--spacing-md);
    }
    
    .points-card-stats {
        border-left: none;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        padding: var(--spacing-md) 0;
        width: 100%;
        justify-content: space-around;
    }
    
    .points-card-btn {
        width: 100%;
        justify-content: center;
    }
    
    .profile-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动端 (< 640px) */
@media (max-width: 640px) {
    .profile-cover {
        height: 180px;
    }

    .profile-info-wrapper {
        margin-top: -50px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .profile-name {
        font-size: var(--font-xl);
    }

    .profile-actions {
        flex-direction: column;
        width: 100%;
    }

    .profile-actions .btn {
        width: 100%;
    }

    .profile-stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .profile-points-card {
        padding: var(--spacing-md);
    }
    
    .points-card-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    
    .points-card-value {
        font-size: 28px;
    }
    
    .points-stat-value {
        font-size: 18px;
    }
    
    .profile-quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .quick-action-btn {
        padding: var(--spacing-md) var(--spacing-sm);
    }
    
    .quick-action-btn i {
        font-size: 20px;
    }
    
    .quick-action-btn span {
        font-size: 12px;
    }

    .profile-stat-card {
        padding: var(--spacing-md);
    }

    .profile-stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .profile-stat-card .stat-number {
        font-size: var(--font-lg);
    }

    .profile-card-stats {
        gap: var(--spacing-md);
    }
}

/* ========== Pagination Responsive ========== */

/* 平板 (< 768px) */
@media (max-width: 768px) {
    .pagination,
    .page-navigator {
        padding: var(--spacing-sm) var(--spacing-md);
        gap: 6px;
    }
    
    .pagination a,
    .pagination span,
    .page-navigator li a,
    .page-navigator li span {
        min-width: 36px;
        height: 36px;
        font-size: var(--font-xs);
    }
    
    .page-navigator .prev a,
    .page-navigator .next a {
        padding: 0 var(--spacing-sm);
    }
}

/* 移动端 (< 640px) */
@media (max-width: 640px) {
    .pagination,
    .page-navigator {
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: 4px;
    }
    
    .pagination a,
    .pagination span,
    .page-navigator li a,
    .page-navigator li span {
        min-width: 32px;
        height: 32px;
        padding: 0 6px;
        font-size: 12px;
    }
    
    /* 移动端隐藏上一页/下一页文字，只显示图标 */
    .page-navigator .prev a,
    .page-navigator .next a {
        font-size: 0;
        min-width: 32px;
        padding: 0;
    }
    
    .page-navigator .prev a i,
    .page-navigator .next a i {
        font-size: 16px;
    }
    
    .page-navigator .prev a::before,
    .page-navigator .next a::after {
        display: none;
    }
}

/* 返回顶部按钮移动端适配 */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 18px;
        right: 14px;
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}
