/**
 * ============================================================
 * LAYER 4: FEATURES - STATISTICS DASHBOARD
 * ============================================================
 *
 * 역할: 통계 대시보드 및 차트
 *
 * 포함:
 * - 통계 카드 (.stat-card)
 * - 7일 트렌드 차트
 * - 전환율 분석
 * - TOP3 링크 UI
 *
 * 출처:
 * - stats-components.css (전체)
 *
 * 의존성:
 * - 1-foundation-variables.css (CSS 변수만)
 *
 * 새 통계 추가 시:
 * - .stat-card.{metric} 패턴 사용
 * - 차트는 .chart-{type} 패턴
 *
 * Last Updated: 2025-11-05
 * ============================================================
 */

/* ba.ro 통계 컴포넌트 CSS */
/* 작성일: 2025-09-25 */
/* 기능: 7일 트렌드, 전환율 분석, TOP3 링크 UI */

/* ===== 1. 그래프 섹션 ===== */
.chart-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}


.chart-container {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #e2e8f0;
    position: relative;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    font-weight: 600;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.legend-dot.visits {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.legend-dot.clicks {
    background: linear-gradient(135deg, #ed64a6, #d53f8c);
}

.dual-chart {
    height: 140px;
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.chart-bars-container {
    display: flex;
    align-items: end;
    height: 100px;
    gap: 12px;
    justify-content: space-between;
}

.day-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.bars-pair {
    display: flex;
    gap: 3px;
    align-items: end;
    height: 100px;
    margin-bottom: 8px;
}

.chart-bar {
    border-radius: 3px 3px 0 0;
    min-width: 10px;
    width: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.chart-bar.visits {
    background: linear-gradient(to top, #4299e1, #63b3ed);
}

.chart-bar.clicks {
    background: linear-gradient(to top, #ed64a6, #f687b3);
}

.chart-bar:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

.day-label {
    font-size: 0.75em;
    color: #718096;
    font-weight: 500;
}

/* ===== 2. 3개 카드 (연한 색상) ===== */
.triple-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card.visits {
    background: linear-gradient(135deg, #63b3ed 0%, #4299e1 100%);
}

.stat-card.clicks {
    background: linear-gradient(135deg, #68d391 0%, #48bb78 100%);
}

.stat-card.conversion {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.stat-number {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
    position: relative;
    z-index: 2;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.stat-detail {
    font-size: 0.75em;
    opacity: 0.8;
    position: relative;
    z-index: 2;
}

/* ===== 3. 전환율 평가 ===== */
.conversion-insight {
    background: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
}

.conversion-insight .insight-emoji {
    font-size: 2em;
    margin-bottom: 10px;
    display: block;
}

.conversion-insight .insight-text {
    font-size: 1.05em;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.5;
}

/* ===== 4. 인기 링크 TOP 3 ===== */
.top-links-section {
    margin-bottom: 25px;
}

.top-links-title {
    font-size: 1.1em;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}


.top-links-list {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e2e8f0;
}

.top-link-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.top-link-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.link-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 12px;
    color: white;
}

.link-rank.first {
    background: linear-gradient(135deg, #ffd700, #ffb347);
}

.link-rank.second {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
}

.link-rank.third {
    background: linear-gradient(135deg, #cd7f32, #b8860b);
}

.link-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.link-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95em;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-clicks {
    font-size: 0.85em;
    color: #718096;
    font-weight: 600;
}

/* ===== 5. 인기 링크 평가 ===== */

.link-stats-section {
    margin-bottom: 30px;
}

.link-stats-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.link-stats-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.link-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.no-data {
    text-align: center;
    color: #666;
    padding: 40px 0;
}

.links-insight {
    background: linear-gradient(135deg, #fef5e7 0%, #fed7aa 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
}

.links-insight .insight-emoji {
    font-size: 2em;
    margin-bottom: 10px;
    display: block;
}

.links-insight .insight-text {
    font-size: 1.05em;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.5;
}

/* ===== 확장 옵션 ===== */
.expand-section {
    text-align: center;
}

.expand-btn {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: linear-gradient(135deg, #cbd5e0, #a0aec0);
    transform: translateY(-2px);
}

.advanced-stats {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 2px dashed #cbd5e0;
}

.advanced-stats.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ===== 통계 컨테이너 (메인 래퍼) ===== */
.stats-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 5px;
}

/* ===== 반응형 디자인 ===== */
@media (max-width: 768px) {
    .stats-container {
        margin: 10px;
    }

    .triple-stats {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 12px;
    }

    .triple-stats .stat-card:nth-child(3) {
        grid-column: 1 / -1;
    }
    
    .stat-number {
        font-size: 1.5em;
    }
    
    .stat-label {
        font-size: 0.8em;
    }
    
    .stat-detail {
        font-size: 0.7em;
    }
    
    .chart-legend {
        gap: 15px;
    }
    
    .chart-bar {
        min-width: 8px;
        width: 8px;
    }
    
    .day-label {
        font-size: 0.7em;
    }
    
    .top-link-item {
        padding: 10px 0;
    }
    
    .link-title {
        font-size: 0.9em;
    }
}