/* 분석 페이지 스타일 - 최신 트렌드 */

.analytics-content {
    padding: 2rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: calc(100vh - var(--header-height));
}

/* 섹션 타이틀 */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    position: relative;
    padding-left: 1rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 2px;
}

/* KPI 섹션 */
.kpi-section {
    margin-bottom: 2rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.kpi-card {
    background: white;
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kpi-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-period {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.kpi-value.positive {
    color: var(--success);
}

.kpi-value.negative {
    color: var(--danger);
}

.kpi-chart {
    height: 60px;
    margin-bottom: 1rem;
}

.kpi-rating {
    display: flex;
    gap: 0.25rem;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.star {
    color: var(--gray-300);
}

.star.filled {
    color: #fbbf24;
}

.star.half {
    position: relative;
}

.star.half::before {
    content: '★';
    position: absolute;
    color: #fbbf24;
    width: 50%;
    overflow: hidden;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.kpi-trend.positive {
    color: var(--success);
}

.kpi-trend.negative {
    color: var(--danger);
}

.trend-icon {
    font-size: 1.25rem;
}

.kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.kpi-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.kpi-count,
.kpi-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.5s ease;
}

/* 차트 섹션 */
.charts-section {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-100);
}

.chart-container.large {
    grid-column: span 12;
}

.chart-container.medium {
    grid-column: span 6;
}

.chart-container.small {
    grid-column: span 4;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.chart-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    padding: 0.375rem 0.875rem;
    background: var(--gray-100);
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.chart-btn:hover {
    background: var(--gray-200);
}

.chart-btn.active {
    background: var(--primary);
    color: white;
}

.chart-body {
    height: 350px;
    position: relative;
}

/* 인사이트 섹션 */
.insights-section {
    margin-bottom: 2rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.insight-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
}

.insight-card.positive::before {
    background: var(--success);
}

.insight-card.warning::before {
    background: var(--warning);
}

.insight-card.info::before {
    background: var(--info);
}

.insight-card:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.insight-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: 12px;
}

.insight-content {
    flex: 1;
}

.insight-content h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.insight-content p {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.insight-action {
    display: flex;
    gap: 0.5rem;
}

/* 보고서 섹션 */
.reports-section {
    margin-bottom: 2rem;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.report-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--gray-100);
    position: relative;
}

.report-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.report-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.report-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.report-card p {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.report-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.report-card.custom {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-style: dashed;
}

/* 데이터 테이블 섹션 */
.data-section {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-100);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.table-controls {
    display: flex;
    gap: 0.75rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    min-width: 200px;
}

.data-table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.data-table td {
    padding: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.text-success {
    color: var(--success);
    font-weight: 600;
}

.text-danger {
    color: var(--danger);
    font-weight: 600;
}

/* 보고서 프리뷰 */
.report-preview {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
}

/* 애니메이션 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card,
.insight-card,
.report-card {
    animation: slideInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

/* 반응형 */
@media (max-width: 1200px) {
    .chart-container.medium {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .analytics-content {
        padding: 1rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

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

    .table-controls {
        flex-direction: column;
        width: 100%;
    }

    .search-input {
        width: 100%;
    }
}