/* 管理画面専用スタイル */

/* フィルターフォーム */
.filter-form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.btn-filter {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-filter:hover {
    background: #5a6fd8;
}

.btn-export {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.btn-export:hover {
    background: #218838;
}

/* ダッシュボード統計カード */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: #28a745;
}

.stat-change.negative {
    color: #dc3545;
}

/* チャートコンテナ */
.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    position: relative;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

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

.chart-toggle {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.chart-toggle.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* テーブル拡張 */
.data-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.data-table .table {
    margin-bottom: 0;
}

.table-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

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

/* ソート可能ヘッダー */
.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.sortable:hover {
    background-color: #e9ecef;
}

.sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    opacity: 0.5;
    font-size: 0.8rem;
}

.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
}

/* 順位変化の視覚化 */
.rank-change-visual {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.rank-arrow {
    width: 0;
    height: 0;
    border-style: solid;
}

.rank-arrow.up {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid #28a745;
}

.rank-arrow.down {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #dc3545;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    color: #495057;
}

.pagination a:hover {
    background: #e9ecef;
}

.pagination .current {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 検索・フィルター結果 */
.results-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ツールチップ */
.tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #adb5bd;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: white;
    text-align: center;
    border-radius: 4px;
    padding: 5px 8px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .filter-actions {
        justify-content: stretch;
    }
    
    .filter-actions .btn-filter,
    .filter-actions .btn-export {
        flex: 1;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        height: 250px;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .table-actions {
        justify-content: stretch;
    }
    
    .table-body {
        max-height: 400px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* 印刷対応 */
@media print {
    .filter-form,
    .chart-controls,
    .table-actions,
    .pagination {
        display: none;
    }
    
    .chart-wrapper {
        height: auto;
    }
    
    .data-table {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}