/* 통계 시스템 전용 스타일시트 */

/* ===== 공통 스타일 ===== */
.statistics-dashboard,
.public-statistics {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    color: #333;
    line-height: 1.6;
}

/* ===== 관리자 대시보드 스타일 ===== */
.statistics-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
}

.stats-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stats-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 1.1rem;
    opacity: 0.9;
}

.board-name {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
}

/* ===== 컨트롤 영역 ===== */
.stats-controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.control-form {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.control-group input,
.control-group select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

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

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.card-icon {
    font-size: 3rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.card-content h3 {
    margin: 0 0 5px 0;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-change,
.stat-sub {
    font-size: 0.85rem;
    color: #6c757d;
}

.stat-change .increase {
    color: #28a745;
    font-weight: 600;
}

.stat-change .decrease {
    color: #dc3545;
    font-weight: 600;
}

/* ===== 차트 섹션 ===== */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.chart-container h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

/* ===== 순위 테이블 ===== */
.rankings-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.ranking-table {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.ranking-table h3 {
    margin: 0;
    padding: 20px 25px;
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.table-wrapper {
    max-height: 500px;
    overflow-y: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stats-table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
}

.stats-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.stats-table tr:hover {
    background: #f8f9fa;
}

.rank-number {
    font-weight: 700;
    color: #495057;
    text-align: center;
    width: 50px;
}

.track-title {
    max-width: 300px;
}

.track-title a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
}

.track-title a:hover {
    color: #007bff;
}

.rating-score {
    font-weight: 700;
    color: #ffc107;
    text-align: center;
}

.rating-change .increase {
    color: #28a745;
    font-weight: 600;
}

.rank-change .rank-up {
    color: #28a745;
    font-weight: 600;
}

.rank-change .rank-down {
    color: #dc3545;
    font-weight: 600;
}

.rank-change .rank-same {
    color: #6c757d;
}

/* ===== 사용자 활동 섹션 ===== */
.user-activity-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.user-activity-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.activity-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.activity-card h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.user-name {
    font-weight: 500;
    color: #2c3e50;
}

.user-count {
    font-weight: 600;
    color: #007bff;
}

/* ===== 시스템 상태 ===== */
.system-status {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.system-status h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
}

.status-label {
    font-weight: 500;
    color: #495057;
}

.status-value {
    font-weight: 700;
    color: #2c3e50;
}

/* ===== 관리 도구 ===== */
.admin-tools {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.admin-tools h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.tool-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ===== 공개 통계 페이지 스타일 ===== */
.public-statistics {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
}

.public-header {
    background: linear-gradient(135deg, #6f42c1 0%, #495057 100%);
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.public-header h1 {
    margin: 0 0 20px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.quick-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* ===== 필터 탭 ===== */
.chart-controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-tabs {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tab-label {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.tab-btn {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    text-decoration: none;
    color: #6c757d;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    border-color: #007bff;
    color: #007bff;
    text-decoration: none;
}

.tab-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* ===== 메인 차트 ===== */
.main-chart {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.chart-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.chart-actions {
    display: flex;
    gap: 10px;
}

.btn-outline {
    background: transparent;
    border: 2px solid #6c757d;
    color: #6c757d;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
}

/* ===== 차트 아이템 ===== */
.chart-list {
    padding: 0;
}

.chart-item {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    gap: 20px;
}

.chart-item:hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    transform: translateX(5px);
}

.chart-item.top-three {
    background: linear-gradient(135deg, #fff9c4 0%, #fef3bd 100%);
    border-left: 5px solid #ffc107;
}

.rank-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 80px;
}

.rank-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #495057;
    min-width: 40px;
    text-align: center;
}

.rank-change {
    font-size: 0.8rem;
    font-weight: 600;
}

.rank-up {
    color: #28a745;
}

.rank-down {
    color: #dc3545;
}

.rank-same {
    color: #6c757d;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-title {
    margin-bottom: 5px;
}

.title-link {
    color: #2c3e50;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.title-link:hover {
    color: #007bff;
    text-decoration: none;
}

.new-badge {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 8px;
}

.track-artist,
.track-meta {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 3px;
}

.track-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
    text-align: center;
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.stat-item.primary {
    font-size: 1.1rem;
    font-weight: 700;
}

.stat-item.secondary {
    font-size: 0.9rem;
    color: #6c757d;
}

.stat-icon {
    font-size: 1rem;
}

.stat-value {
    font-weight: 600;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
}

.track-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 80px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.play-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.scrap-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.scrap-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

/* ===== 사이드바 ===== */
.sidebar-stats {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.sidebar-section h3 {
    margin: 0;
    padding: 15px 20px;
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.mini-chart {
    padding: 15px 20px;
}

.mini-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.mini-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.mini-rank.new {
    background: #28a745;
}

.mini-info {
    flex: 1;
    min-width: 0;
}

.mini-title {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.3;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-title:hover {
    color: #007bff;
    text-decoration: none;
}

.mini-change,
.mini-meta {
    font-size: 0.8rem;
    margin-top: 3px;
}

.mini-change .increase {
    color: #28a745;
    font-weight: 600;
}

.mini-meta {
    color: #6c757d;
}

.weekly-stats {
    padding: 15px 20px;
}

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

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

.week-label {
    font-weight: 500;
    color: #495057;
}

.week-value {
    font-weight: 700;
    color: #007bff;
}

/* ===== 모달 스타일 ===== */
.player-modal,
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.player-content,
.share-content {
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.player-header,
.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.player-header h3,
.share-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #dc3545;
    color: white;
}

.player-body,
.share-body {
    padding: 25px;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.share-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.share-url {
    margin-top: 15px;
}

.share-url input {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: #f8f9fa;
}

/* ===== 반응형 디자인 ===== */
@media (max-width: 1400px) {
    .sidebar-stats {
        position: static;
        width: 100%;
        max-height: none;
        transform: none;
        margin-top: 30px;
    }
    
    .sidebar-section {
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .statistics-dashboard,
    .public-statistics {
        padding: 15px;
    }
    
    .stats-header,
    .public-header {
        padding: 20px;
        text-align: center;
    }
    
    .stats-header h1,
    .public-header h1 {
        font-size: 1.8rem;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .charts-section,
    .rankings-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .control-form,
    .filter-tabs {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .tab-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .chart-header h2 {
        text-align: center;
    }
    
    .chart-actions {
        justify-content: center;
    }
    
    .chart-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px 20px;
    }
    
    .track-info {
        order: 1;
    }
    
    .rank-section {
        order: 2;
    }
    
    .track-stats {
        order: 3;
        flex-direction: row;
        justify-content: center;
    }
    
    .track-actions {
        order: 4;
        flex-direction: row;
        justify-content: center;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .share-options {
        grid-template-columns: 1fr;
    }
    
    .tool-buttons {
        justify-content: center;
    }
    
    .activity-grid {
        grid-template-columns: 1fr;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-header h1,
    .public-header h1 {
        font-size: 1.5rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .card-icon {
        width: 60px;
        height: 60px;
        font-size: 2.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .chart-item {
        padding: 12px 15px;
    }
    
    .title-link {
        font-size: 1rem;
    }
    
    .track-stats {
        gap: 15px;
    }
    
    .action-btn {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stat-card,
.chart-container,
.ranking-table {
    animation: fadeInUp 0.6s ease-out;
}

.chart-item {
    animation: slideInRight 0.4s ease-out;
}

.chart-item:nth-child(even) {
    animation-delay: 0.1s;
}

.chart-item:nth-child(odd) {
    animation-delay: 0.2s;
}

/* ===== 스크롤바 스타일링 ===== */
.table-wrapper::-webkit-scrollbar,
.sidebar-stats::-webkit-scrollbar {
    width: 6px;
}

.table-wrapper::-webkit-scrollbar-track,
.sidebar-stats::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb,
.sidebar-stats::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.sidebar-stats::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== 로딩 상태 ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}