/**
 * News Trend Analyzer - Modern Minimal Frontend Styles
 */

/* 전역 설정 */
* {
    box-sizing: border-box;
}

.nta-frontend-dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: #1a1a1a;
}

/* 섹션 스타일 */
.nta-trending-section,
.nta-news-section {
    margin-bottom: 24px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.nta-trending-section:hover,
.nta-news-section:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 헤더 스타일 */
.nta-trending-section h3,
.nta-news-section h3 {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    margin: 0;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* 트렌드 섹션 */
.trend-items {
    padding: 16px 20px;
}

.trend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.15s ease;
}

.trend-item:last-child {
    border-bottom: none;
}

.trend-item:hover {
    background: #f8fafc;
    border-radius: 6px;
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
}

.trend-info {
    flex: 1;
}

.trend-keyword {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.trend-keyword:hover {
    color: #6366f1;
}

.trend-description {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.trend-score {
    text-align: center;
    min-width: 50px;
}

.score-number {
    font-size: 16px;
    font-weight: 700;
    color: #059669;
    line-height: 1;
}

.score-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 키워드 클라우드 */
.keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.keyword-tag,
.clickable-keyword {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.keyword-tag:hover,
.clickable-keyword:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    transform: translateY(-1px);
}

.keyword-score {
    opacity: 0.7;
    font-size: 10px;
}

/* 뉴스 섹션 - 미니멀한 카드 그리드 */
.news-items {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.news-item {
    background: #ffffff;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.news-item:hover {
    border-color: #e5e7eb;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.news-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: #f9fafb;
    position: relative;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-item:hover .news-image img {
    transform: scale(1.02);
}

.news-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #9ca3af;
    font-size: 12px;
    font-weight: 500;
}

.news-content {
    padding: 14px;
}

.news-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #111827;
}

.news-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.news-title a:hover {
    color: #6366f1;
}

.news-snippet {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: #9ca3af;
    border-top: 1px solid #f9fafb;
    padding-top: 8px;
    margin-top: 8px;
}

.news-source {
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-category {
    background: #e0e7ff;
    color: #5b21b6;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 9px;
}

.news-date {
    color: #9ca3af;
}

.sentiment-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 4px;
}

.sentiment-positive { background: #10b981; }
.sentiment-negative { background: #ef4444; }
.sentiment-neutral { background: #6b7280; }

/* 검색 모달 */
.keyword-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.keyword-search-modal {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    max-height: 80vh;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.search-header {
    padding: 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.result-count {
    background: rgba(255,255,255,0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.close-search {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.close-search:hover {
    background: rgba(255,255,255,0.2);
}

.search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px 20px;
}

.search-result-card {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
    transition: all 0.15s ease;
}

.search-result-card:hover {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.search-result-card:last-child {
    margin-bottom: 0;
}

.result-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.result-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.15s ease;
}

.result-title a:hover {
    color: #6366f1;
}

.result-snippet {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}

.source-badge {
    background: #e5e7eb;
    color: #374151;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.date-info {
    color: #9ca3af;
}

.keyword-tag-small {
    background: #e0e7ff;
    color: #5b21b6;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* 로딩 및 에러 상태 */
.nta-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

.nta-error {
    text-align: center;
    padding: 40px 20px;
    color: #ef4444;
    font-size: 14px;
    background: #fef2f2;
    border-radius: 8px;
    margin: 16px 20px;
}

.nta-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 14px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .nta-frontend-dashboard {
        padding: 12px;
    }
    
    .news-items {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .news-image {
        height: 120px;
    }
    
    .keyword-search-modal {
        margin: 10px;
        max-height: 90vh;
    }
    
    .search-header {
        padding: 16px;
    }
    
    .search-header h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .nta-frontend-dashboard {
        padding: 8px;
    }
    
    .trend-items,
    .news-items {
        padding: 12px;
    }
    
    .news-content {
        padding: 12px;
    }
    
    .news-title {
        font-size: 13px;
    }
    
    .news-snippet {
        font-size: 11px;
    }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 다크모드 지원 준비 */
@media (prefers-color-scheme: dark) {
    /* 다크모드 스타일은 추후 추가 가능 */
}

/* 스크롤바 커스터마이징 */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 애니메이션 추가 */
.news-item,
.trend-item {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.news-item:nth-child(1) { animation-delay: 0.05s; }
.news-item:nth-child(2) { animation-delay: 0.1s; }
.news-item:nth-child(3) { animation-delay: 0.15s; }
.news-item:nth-child(4) { animation-delay: 0.2s; }

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

/* 포커스 상태 개선 */
.keyword-tag:focus,
.clickable-keyword:focus,
.news-title a:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}