/* ダッシュボード専用スタイル */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #1C1C28 0%, #2D3E50 50%, #34495E 100%);
    min-height: 100vh;
    color: #DDEAF7;
}

/* KPIカード */
.kpi-card {
    @apply rounded-xl p-4 shadow-lg hover:shadow-xl transition-all duration-300;
    display: flex;
    align-items: center;
    space-between;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #2D3E50 0%, #34495E 100%) !important;
    border: 1px solid #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(28, 28, 40, 0.3) !important;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: rgba(58, 141, 255, 0.15);
    border-radius: 50%;
    transform: translate(20px, -20px);
    box-shadow: 0 0 20px rgba(58, 141, 255, 0.2);
}

.kpi-icon {
    font-size: 2rem;
    margin-right: 1rem;
    opacity: 0.9;
}

.kpi-content {
    flex: 1;
}

.kpi-content h3 {
    color: #DDEAF7 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(28, 28, 40, 0.3);
}

.kpi-content .text-2xl {
    color: #DDEAF7 !important;
    text-shadow: 0 1px 2px rgba(28, 28, 40, 0.3);
}

/* ダッシュボードパネル */
.dashboard-panel {
    background: linear-gradient(135deg, #2D3E50 0%, #34495E 100%);
    border: 1px solid rgba(58, 141, 255, 0.3);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(28, 28, 40, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(58, 141, 255, 0.3);
    background: linear-gradient(135deg, #1C1C28 0%, #2D3E50 100%);
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
    color: #DDEAF7;
}

.panel-body {
    @apply p-6;
}

/* ランキングアイテム - AIテーマ対応 */
.ranking-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #2D3E50 0%, #34495E 100%);
    border: 1px solid #FFFFFF;
    cursor: pointer;
    user-select: none;
    opacity: 1 !important;
    box-shadow: 0 2px 6px rgba(28, 28, 40, 0.2);
}

/* ホバー状態 */
.ranking-item:hover {
    background: linear-gradient(135deg, #3A8DFF 20%, #2D3E50 80%);
    border-color: rgba(58, 141, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 141, 255, 0.3);
}

/* フォーカス状態 */
.ranking-item:focus {
    background: #CBD5E1;
    border-color: #3B82F6;
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* 選択状態 - AIテーマ */
.ranking-item:active,
.ranking-item.is-selected,
.ranking-item[aria-selected="true"] {
    background: linear-gradient(135deg, #1C1C28 0%, #3A8DFF 50%) !important;
    border-color: rgba(58, 141, 255, 0.8) !important;
    box-shadow: 0 0 0 2px rgba(58, 141, 255, 0.6), 0 4px 12px rgba(58, 141, 255, 0.4);
}

/* テキスト選択時の配色調整 */
.ranking-item::selection,
.ranking-item *::selection {
    background: #3B82F6;
    color: #FFFFFF;
}

/* 順位バッジ - 通常状態 */
.rank-badge {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    margin-right: 1rem;
    color: #FFFFFF !important;
    background: #6366F1; /* インディゴ500 */
}

/* 1位のバッジ */
.ranking-item.rank-1 .rank-badge {
    background: #F59E0B !important; /* アンバー500 */
    color: #FFFFFF !important;
}

/* 2位のバッジ */
.ranking-item.rank-2 .rank-badge {
    background: #6B7280 !important; /* グレー500 */
    color: #FFFFFF !important;
}

/* 3位のバッジ */
.ranking-item.rank-3 .rank-badge {
    background: #D97706 !important; /* アンバー600 */
    color: #FFFFFF !important;
}

/* 選択状態でのバッジ */
.ranking-item:active .rank-badge,
.ranking-item.is-selected .rank-badge,
.ranking-item[aria-selected="true"] .rank-badge {
    color: #0F172A !important;
    background: #A7F3D0 !important; /* エメラルド200 */
}

.staff-info {
    flex: 1;
}

/* スタッフ名 - AIテーマ */
.staff-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #DDEAF7 !important;
    margin-bottom: 0.125rem;
    text-shadow: 0 1px 2px rgba(28, 28, 40, 0.3);
}

/* 部門名 - AIテーマ */
.staff-dept {
    font-size: 0.75rem;
    color: rgba(221, 234, 247, 0.8) !important;
}

/* パフォーマンススコア - AIテーマ */
.performance-score {
    font-size: 1.125rem;
    font-weight: 700;
    color: #3A8DFF !important;
    text-shadow: 0 0 6px rgba(58, 141, 255, 0.4);
}

/* 選択状態でのテキスト色 - 濃紺背景用 */
.ranking-item:active .staff-name,
.ranking-item.is-selected .staff-name,
.ranking-item[aria-selected="true"] .staff-name {
    color: #F8FAFC !important; /* スレート50 */
    font-weight: 600 !important;
}

.ranking-item:active .staff-dept,
.ranking-item.is-selected .staff-dept,
.ranking-item[aria-selected="true"] .staff-dept {
    color: #E2E8F0 !important; /* スレート200 */
}

.ranking-item:active .performance-score,
.ranking-item.is-selected .performance-score,
.ranking-item[aria-selected="true"] .performance-score {
    color: #A7F3D0 !important; /* エメラルド200 */
    font-weight: 800 !important;
}

/* 凡例 */
.legend-item {
    display: flex;
    align-items: center;
    space-x: 0.5rem;
}

.legend-item span {
    color: #FFFFFF !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Chart.js凡例テキストのスタイリング */
.chart-legend text {
    fill: #FFFFFF !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* セクションタイトルのスタイリング */
.section-title, 
h2.section-title, 
h3.section-title,
.panel-header h3 {
    color: #FFFFFF !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* サポートカード */
.support-card {
    @apply rounded-lg p-4 transition-colors duration-200 cursor-pointer;
    background: linear-gradient(135deg, #2D3E50 0%, #34495E 100%);
    border: 1px solid rgba(58, 141, 255, 0.3);
    position: relative;
    box-shadow: 0 2px 6px rgba(28, 28, 40, 0.2);
}

.support-card:hover {
    background: linear-gradient(135deg, #3A8DFF 20%, #2D3E50 80%);
    border-color: rgba(58, 141, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(58, 141, 255, 0.3);
}

/* クリック時・選択時のスタイル - AIテーマ */
.support-card:active,
.support-card.is-selected,
.support-card[aria-selected="true"] {
    background: linear-gradient(135deg, #1C1C28 0%, #3A8DFF 50%) !important;
    border-color: rgba(58, 141, 255, 0.8) !important;
    box-shadow: 0 0 0 2px rgba(58, 141, 255, 0.6), 0 4px 12px rgba(58, 141, 255, 0.4);
    transform: translateY(0);
}

/* クリック時の文字色を強調（必要に応じて） */
.support-card:active .support-name,
.support-card.is-selected .support-name,
.support-card[aria-selected="true"] .support-name {
    color: #1E40AF !important; /* より濃い青で視認性向上 */
}

.support-card:active .support-dept,
.support-card.is-selected .support-dept,
.support-card[aria-selected="true"] .support-dept {
    color: #1E3A8A !important; /* 濃い青 */
}

.support-card:active .support-issue,
.support-card.is-selected .support-issue,
.support-card[aria-selected="true"] .support-issue {
    color: #DC2626 !important; /* より濃い赤でコントラスト向上 */
}

.support-avatar {
    @apply w-12 h-12 rounded-full flex items-center justify-center mb-3 mx-auto;
    background-color: #F7F9FB;
    color: #2F80ED;
    border: 2px solid #CCCCCC;
    font-size: 1.5rem;
}

.support-info {
    text-align: center;
}

.support-name {
    @apply font-semibold text-sm mb-1;
    color: #DDEAF7;
    text-shadow: 0 1px 2px rgba(28, 28, 40, 0.3);
}

.support-dept {
    @apply text-xs mb-2;
    color: rgba(221, 234, 247, 0.8);
}

.support-issue {
    @apply text-xs mb-3 font-medium;
    color: #E67E22;
    text-shadow: 0 0 4px rgba(230, 126, 34, 0.3);
}

.support-btn {
    @apply text-white text-xs px-3 py-1.5 rounded-md transition-colors duration-200 w-full;
    background: linear-gradient(135deg, #3A8DFF 0%, #2D3E50 100%);
    border: 1px solid rgba(58, 141, 255, 0.3);
    box-shadow: 0 2px 4px rgba(28, 28, 40, 0.2);
}

.support-btn:hover {
    background: linear-gradient(135deg, #DDEAF7 0%, #3A8DFF 100%);
    color: #1C1C28;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(58, 141, 255, 0.3);
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .kpi-card {
        flex-direction: column;
        text-align: center;
        min-height: 120px;
    }
    
    .kpi-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .panel-header h3 {
        font-size: 0.9rem;
    }
    
    .ranking-item {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .rank-badge {
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .staff-info {
        margin-bottom: 0.5rem;
    }
}

/* ダークモード対応（システム設定に基づく） */
@media (prefers-color-scheme: dark) {
    .ranking-item {
        background: #374151; /* グレー700 */
        border-color: #4B5563;
    }
    
    .ranking-item:hover {
        background: #4B5563; /* グレー600 */
    }
    
    .staff-name {
        color: #F9FAFB !important; /* グレー50 */
    }
    
    .staff-dept {
        color: #D1D5DB !important; /* グレー300 */
    }
    
    .performance-score {
        color: #60A5FA !important; /* ブルー400 */
    }
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 選択アニメーション */
@keyframes selectPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.ranking-item.is-selected {
    animation: selectPulse 0.6s ease-out;
}

.dashboard-panel {
    animation: fadeInUp 0.6s ease-out;
}

.kpi-card {
    animation: fadeInUp 0.6s ease-out;
}

.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; }

/* チャートコンテナ */
canvas {
    max-height: 400px !important;
}

/* ツールチップカスタム */
.chart-tooltip {
    @apply bg-gray-800 text-white px-3 py-2 rounded-lg shadow-lg border border-gray-600;
    font-size: 12px;
}

/* ホバー効果 */
.dashboard-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.support-card:hover .support-avatar {
    background-color: #2F80ED !important;
    color: white !important;
    transform: scale(1.1);
}