/**
 * 메인 페이지 전용 수정 CSS
 * Phase 3: 2025-11-25
 * 목적: 메인 페이지의 4개 레이아웃 문제 해결
 */

/* ========================================
   문제 1: 상단 4개 버튼이 너무 커짐
   ======================================== */

/* 데스크톱에서는 버튼 크기를 원래대로 */
@media (min-width: 769px) {
    .main-page .stitch-btn-primary {
        padding: 0.5rem 1rem;
        min-height: auto;
    }

    .main-page button:not(.mobile-menu-button) {
        min-height: auto;
    }
}

/* 모바일에서만 터치 타겟 크기 적용 */
@media (max-width: 768px) {
    .main-page .stitch-btn-primary {
        min-height: 44px;
    }
}

/* ========================================
   문제 2: 카테고리 탭 1줄 가로스크롤 복원
   ======================================== */

/* 카테고리 탭 컨테이너 */
.main-page .category-tabs,
.main-page .scroll-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

/* 카테고리 탭 아이템 */
.main-page .category-tab-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.5rem 1rem;
}

/* 스크롤바 스타일링 */
.main-page .category-tabs::-webkit-scrollbar {
    height: 4px;
}

.main-page .category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.main-page .category-tabs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.dark .main-page .category-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   문제 3: 핫토픽 부분 정렬 (사용자가 괜찮다고 함)
   - 현재 상태 유지
   ======================================== */

/* ========================================
   문제 4: 핫토픽 1~3위 가로 2열 배치 복원
   ======================================== */

/* 핫토픽 그리드 복원 */
.main-page .trending-grid,
.main-page .hot-topic-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
}

/* 모바일에서는 1열로 */
@media (max-width: 640px) {
    .main-page .trending-grid,
    .main-page .hot-topic-grid {
        grid-template-columns: 1fr !important;
    }
}

/* 핫토픽 캐러셀 복원 */
.main-page .trending-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
}

.main-page .trending-carousel-item {
    flex: 0 0 calc(50% - 0.5rem);
    scroll-snap-align: start;
}

@media (max-width: 640px) {
    .main-page .trending-carousel-item {
        flex: 0 0 100%;
    }
}

/* ========================================
   추가 개선사항
   ======================================== */

/* 메인 페이지 전체 컨테이너 패딩 조정 */
.main-page .container {
    padding: 0 1rem;
}

@media (min-width: 1024px) {
    .main-page .container {
        padding: 0 2rem;
    }
}

/* 카드 간격 조정 */
.main-page .prediction-card + .prediction-card {
    margin-top: 1rem;
}

/* 섹션 간격 조정 */
.main-page section {
    margin-bottom: 2rem;
}

/* ========================================
   다크모드 대응
   ======================================== */

.dark .main-page .category-tab-item {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.dark .main-page .category-tab-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dark .main-page .category-tab-item.active {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   END OF FILE

   해결된 문제:
   1. ✅ 상단 버튼 크기 정상화
   2. ✅ 카테고리 탭 가로스크롤 복원
   3. - 핫토픽 5-6개 정렬 유지 (사용자 만족)
   4. ✅ 핫토픽 1-3위 가로 배치 복원

   참고:
   - !important는 임시 조치
   - Phase 3 완료 후 제거 예정
   ======================================== */