/* 키워드 분석 보고서 전용 스타일 */

/* 요약 카드 섹션 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.summary-card.highlight {
    border: 2px solid #ff6b6b;
    background: linear-gradient(135deg, #ff6b6b10, #ff6b6b05);
}

.summary-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}

.summary-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.summary-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-detail {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 4px;
}

/* TOP 키워드 테이블 */
.keyword-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.keyword-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    border-bottom: 2px solid var(--border-color);
}

.keyword-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.keyword-row {
    transition: background-color 0.2s ease;
}

.keyword-row:hover {
    background: var(--bg-hover);
}

.keyword-row.high {
    border-left: 4px solid #ff6b6b;
}

.keyword-row.medium {
    border-left: 4px solid #ffa726;
}

.keyword-row.low {
    border-left: 4px solid #66bb6a;
}

.keyword-row.lowest {
    border-left: 4px solid #bdbdbd;
}

.rank-cell {
    font-weight: bold;
    color: var(--accent-color);
    text-align: center;
    width: 60px;
}

.keyword-cell {
    min-width: 180px;
}

.keyword-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.keyword-name {
    font-weight: 600;
    color: var(--text-primary);
}

.keyword-lang {
    font-size: 0.9em;
}

.number-cell {
    text-align: right;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.performance-cell {
    min-width: 120px;
}

.performance-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin-bottom: 4px;
    overflow: hidden;
}

.performance-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.performance-fill.high { background: #ff6b6b; }
.performance-fill.medium { background: #ffa726; }
.performance-fill.low { background: #66bb6a; }
.performance-fill.lowest { background: #bdbdbd; }

.performance-label {
    font-size: 0.75em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 언어별 분석 카드 */
.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.language-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    transition: transform 0.2s ease;
}

.language-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.language-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.language-flag {
    font-size: 1.3em;
}

.language-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9em;
}

.language-stats {
    display: flex;
    justify-content: space-around;
    gap: 12px;
}

.language-stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.7em;
    color: var(--text-secondary);
}

/* 성과 분포 카드 */
.distribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.distribution-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px;
    text-align: center;
    transition: transform 0.2s ease;
    position: relative;
}

.distribution-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.distribution-card.high {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #ff6b6b08, transparent);
}

.distribution-card.medium {
    border-color: #ffa726;
    background: linear-gradient(135deg, #ffa72608, transparent);
}

.distribution-card.low {
    border-color: #66bb6a;
    background: linear-gradient(135deg, #66bb6a08, transparent);
}

.distribution-card.lowest {
    border-color: #bdbdbd;
    background: linear-gradient(135deg, #bdbdbd08, transparent);
}

.distribution-icon {
    font-size: 2.2em;
    margin-bottom: 10px;
}

.distribution-count {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.distribution-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.distribution-percentage {
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 500;
}

/* 상세 테이블 컨트롤 */
.table-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    align-items: center;
}

.search-input,
.filter-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9em;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.filter-select {
    min-width: 130px;
}

/* 상세 테이블 */
.detailed-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.detailed-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    border-bottom: 1px solid var(--border-color);
}

.detailed-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85em;
}

.performance-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
}

.performance-badge.high {
    background: #ff6b6b20;
    color: #ff6b6b;
}

.performance-badge.medium {
    background: #ffa72620;
    color: #ffa726;
}

.performance-badge.low {
    background: #66bb6a20;
    color: #66bb6a;
}

.performance-badge.lowest {
    background: #bdbdbd20;
    color: #bdbdbd;
}

/* 섹션 헤더 */
.report-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.section-title {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .summary-card {
        padding: 16px;
    }
    
    .summary-icon {
        font-size: 2em;
    }
    
    .summary-value {
        font-size: 1.4em;
    }
    
    .language-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .distribution-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input,
    .filter-select {
        min-width: auto;
    }
    
    .keyword-table,
    .detailed-table {
        font-size: 0.8em;
    }
    
    .keyword-table th,
    .keyword-table td,
    .detailed-table th,
    .detailed-table td {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .language-grid,
    .distribution-grid {
        grid-template-columns: 1fr;
    }
    
    .keyword-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .performance-cell {
        min-width: 80px;
    }
    
    .performance-bar {
        height: 4px;
    }
}

/* 결과 카운트 */
.result-count {
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
}

/* 테이블 컨테이너 */
.table-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* 페이지네이션 컨테이너 */
.pagination-container {
    margin-top: 20px;
    text-align: center;
}

/* 로딩 및 에러 상태 */
.loading,
.error-container {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error-message {
    color: var(--error-color);
    font-weight: 500;
}

/* 보고서 특화 스타일 */
.keywords-report-page {
    background: var(--bg-light);
    min-height: 100vh;
}

.keywords-report-page .container {
    max-width: 1200px;
}

/* 섹션간 간격 조정 */
.report-section + .report-section {
    margin-top: 50px;
}

/* 키워드 링크 스타일 */
.keyword-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.keyword-link:hover {
    color: #ff6b6b;
    text-decoration: none;
    border-bottom: 1px solid #ff6b6b;
    transform: translateY(-1px);
}

.keyword-link:visited {
    color: #9c46ff;
}

.summary-card .keyword-link {
    color: inherit;
    font-weight: inherit;
}

.summary-card .keyword-link:hover {
    color: #ff6b6b;
}

/* 키워드 셀 내 링크 */
.keyword-info .keyword-link {
    display: inline-block;
    margin-right: 8px;
}

.keyword-info .keyword-link:hover {
    text-shadow: 0 0 4px rgba(255, 107, 107, 0.3);
}