/* AI 트렌드 - 새 탭 UI 스타일 */

/* =====================================================
   앱 컨테이너
   ===================================================== */
.trends-app {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 80vh;
}

/* =====================================================
   탭 네비게이션
   ===================================================== */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 30px;
    background: #f0f0f0;
    padding: 6px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.5);
}

.tab-btn.active {
    background: #fff;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #ddd;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
}

.tab-btn.active .tab-num {
    background: #667eea;
    color: #fff;
}

.tab-label {
    font-size: 0.95rem;
    font-weight: 500;
}

/* =====================================================
   탭 콘텐츠
   ===================================================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-header {
    text-align: center;
    margin-bottom: 30px;
}

.tab-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 8px;
}

.tab-header p {
    color: #666;
    font-size: 0.95rem;
}

.tab-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* =====================================================
   버튼
   ===================================================== */
.btn-next,
.btn-prev {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-next {
    background: #667eea;
    color: #fff;
}

.btn-next:hover {
    background: #5a6fd6;
}

.btn-prev {
    background: #f0f0f0;
    color: #555;
}

.btn-prev:hover {
    background: #e0e0e0;
}

.selection-summary {
    color: #666;
    font-size: 0.9rem;
}

.selection-summary .count {
    font-weight: 600;
    color: #667eea;
}

/* =====================================================
   탭 1: 서비스 트리
   ===================================================== */
.service-tree {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.service-category {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.service-category:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.category-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.category-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.category-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.category-icon {
    font-size: 1.3rem;
}

.category-name {
    font-size: 1.1rem;
    color: #333;
}

.category-services {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.service-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.service-item:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

.service-item:has(input:checked) {
    background: #e8f0fe;
    border-color: #667eea;
}

.service-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

.service-name {
    font-size: 0.9rem;
    color: #444;
}

.service-count {
    font-size: 0.75rem;
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 10px;
    color: #666;
}

.service-item:has(input:checked) .service-count {
    background: rgba(102,126,234,0.2);
    color: #667eea;
}

/* =====================================================
   탭 2: 키워드 그리드
   ===================================================== */
.keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.keyword-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-item:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.keyword-item:has(input:checked) {
    background: #e8f0fe;
    border-color: #667eea;
}

.keyword-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

.keyword-name {
    flex: 1;
    font-size: 0.95rem;
    color: #333;
}

.keyword-count {
    font-size: 0.8rem;
    color: #999;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.keyword-item:has(input:checked) .keyword-count {
    background: rgba(102,126,234,0.2);
    color: #667eea;
}

/* =====================================================
   탭 3: 결과
   ===================================================== */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 15px;
}

.tag-group {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #555;
}

.tag-group strong {
    color: #333;
}

.no-filter {
    color: #999;
    font-style: italic;
}

.result-count {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #666;
    font-size: 0.95rem;
}

.result-list .article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.result-list .article-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.result-list .article-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.result-list .article-link {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    color: #333;
    text-decoration: none;
    margin-bottom: 10px;
}

.result-list .article-link:hover {
    color: #667eea;
}

.result-list .article-title {
    font-size: 1rem;
    line-height: 1.5;
}

.result-list .article-arrow {
    color: #999;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.result-list .article-link:hover .article-arrow {
    color: #667eea;
}

.result-list .article-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: #888;
}

.result-list .topic-tag {
    background: #e8f0fe;
    color: #667eea;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-results p {
    margin: 8px 0;
}

/* =====================================================
   반응형
   ===================================================== */
@media (max-width: 768px) {
    .trends-app {
        padding: 15px;
    }

    .tab-nav {
        flex-direction: column;
        gap: 6px;
    }

    .tab-btn {
        justify-content: flex-start;
        padding: 12px 16px;
    }

    .service-tree {
        grid-template-columns: 1fr;
    }

    .keyword-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tab-footer {
        flex-wrap: wrap;
        gap: 15px;
    }

    .selection-summary {
        width: 100%;
        text-align: center;
    }

    .btn-next, .btn-prev {
        flex: 1;
    }
}

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

    .category-services {
        flex-direction: column;
    }

    .service-item {
        width: 100%;
    }
}

/* =====================================================
   기존 토픽 페이지 스타일 (topic.php용)
   ===================================================== */
.topic-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #666;
}

.breadcrumb a:hover {
    color: #667eea;
}

.topic-header {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e0e0e0;
    margin-bottom: 25px;
}

.topic-title-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.topic-title-row h1 {
    font-size: 1.8rem;
    margin: 0;
}

.category-badge {
    background: #f0f0f0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #555;
}

.topic-description {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.topic-stats {
    color: #888;
    font-size: 0.9rem;
}

.articles-section {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e0e0e0;
}

.articles-section h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
