﻿/**
 * 追加因縁分析システム - 専用スタイル
 * 
 * 【適用範囲】
 * - 完成間近因縁の表示
 * - 候補英傑の提案
 * - 優先度別分類表示
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #FFFFFF;
  --color-bg-card: #F9FAFB;
  --color-border: #E5E7EB;
  --color-text-main: #333B4F;
  --color-text-sub: #374151;
  --color-accent-red: #E74C3C;
  --color-accent-blue: #3498DB;
  --color-accent-green: #2ECC71;
  --color-accent-purple: #9B59B6;
  --color-accent-orange: #F39C12;
  --color-gray: #6B7280;
  --color-gray-light: #F3F4F6;
  --color-table-stripe: #F5F5F5;
}

/* === 追加因縁機会全体 === */
.immediate-opportunities {
    font-size: 14px;
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}

.opportunities-title {
    font-size: 16px;
    font-weight: 600;
    color: #a16207;
    margin-bottom: 8px;
}

/* === 空状態 === */
.no-opportunities {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 16px;
    background: #f9fafb;
    border: 1px dashed #e5e7eb;
    border-radius: 6px;
    margin: 8px 0;
}

/* === 機会リスト === */
.opportunity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === 機会アイテム === */
.opportunity-item {
    background: white;
    border: 1px solid #fbbf24;
    border-radius: 4px;
    padding: 8px;
    transition: all 0.2s ease;
}

.opportunity-item:hover {
    background: #fffbeb;
    border-color: #f59e0b;
}

/* === 優先度別スタイル === */
.opportunity-item.high-priority {
    border-left: 3px solid #10b981;
    background: #f0fdf4;
}

.opportunity-item.high-priority:hover {
    background: #dcfce7;
}

.opportunity-item.medium-priority {
    border-left: 3px solid #f59e0b;
    background: #fffbeb;
}

.opportunity-item.medium-priority:hover {
    background: #fef3c7;
}

.opportunity-item.low-priority {
    border-left: 3px solid #6b7280;
    background: #f9fafb;
}

.opportunity-item.low-priority:hover {
    background: #f3f4f6;
}

/* === 機会ヘッダー === */
.opportunity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--color-bg);
    color: var(--color-text-main);
    border-bottom: 1px solid var(--color-border);
}

.opportunity-title {
    font-size: 12px;
    font-weight: 500;
    color: #d97706;
}

.inen-name {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
}

/* === 優先度バッジ === */
.priority-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.priority-badge.high {
    background: #d1fae5;
    color: #065f46;
}

.priority-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-badge.low {
    background: #f3f4f6;
    color: #6b7280;
}

/* === 機会詳細 === */
.opportunity-detail {
    font-size: 11px;
    color: #a16207;
}

.missing-factor {
    display: block;
    margin-bottom: 4px;
    font-style: italic;
}

/* === 候補英傑提案 === */
.candidate-suggestions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.candidate {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.candidate:hover {
    background: #fde68a;
    border-color: #f59e0b;
    transform: translateY(-1px);
}

.candidate:active {
    transform: translateY(0);
}

.candidate:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* === 難易度表示 === */
.difficulty-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #6b7280;
    margin-left: 8px;
}

.difficulty-easy {
    color: #10b981;
}

.difficulty-medium {
    color: #f59e0b;
}

.difficulty-hard {
    color: #ef4444;
}

/* === 期待効果表示 === */
.expected-benefit {
    font-size: 11px;
    color: #059669;
    margin-top: 4px;
    font-weight: 500;
}

.benefit-value {
    font-weight: 600;
    color: #047857;
}

/* === コンパクト表示モード === */
.opportunity-item.compact {
    padding: 6px;
}

.opportunity-item.compact .opportunity-header {
    margin-bottom: 2px;
}

.opportunity-item.compact .candidate-suggestions {
    margin-top: 2px;
}

/* === インタラクティブ状態 === */
.candidate.selected {
    background: #3b82f6;
    color: white;
}

.candidate.owned {
    background: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.candidate.owned::after {
    content: ' ✓';
    font-size: 8px;
}

/* === ローディング状態 === */
.opportunity-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.opportunity-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === 成功状態 === */
.opportunity-item.success {
    border-color: #10b981;
    background: #f0fdf4;
}

.opportunity-item.success .opportunity-title {
    color: #065f46;
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
    .opportunity-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .priority-badge {
        align-self: flex-end;
    }
    
    .candidate-suggestions {
        justify-content: center;
        width: 100%;
    }
    
    .opportunity-item {
        padding: 10px;
    }
}

/* === アクセシビリティ対応 === */
@media (prefers-reduced-motion: reduce) {
    .candidate,
    .opportunity-item,
    .opportunity-item.loading::after {
        animation: none;
        transition: none;
        transform: none;
    }
    
    .candidate:hover {
        transform: none;
    }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
    .opportunity-item.high-priority {
        border-left-width: 4px;
    }
    
    .opportunity-item.medium-priority {
        border-left-width: 4px;
    }
    
    .opportunity-item.low-priority {
        border-left-width: 4px;
    }
    
    .candidate {
        border-width: 2px;
    }
    
    .immediate-opportunities {
        border-width: 2px;
    }
}

/* === ダークモード対応 === */
@media (prefers-color-scheme: dark) {
    .immediate-opportunities {
        background: #1f2937;
        border-color: #374151;
    }
    
    .opportunities-title {
        color: #fbbf24;
    }
    
    .opportunity-item {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .candidate {
        background: #4b5563;
        color: #f9fafb;
    }
}

/* === 印刷対応 === */
@media print {
    .immediate-opportunities {
        border: 1px solid #000;
        background: white;
        break-inside: avoid;
    }
    
    .opportunity-item {
        border: 1px solid #000;
        background: white;
        break-inside: avoid;
    }
    
    .candidate {
        border: 1px solid #000;
        background: white;
        color: #000;
    }
}

.opportunity-finder-container {
  background: var(--color-bg-card);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.opportunity-btn {
  background: var(--color-accent-blue);
  color: #fff;
  border-radius: 4px;
  border: none;
  transition: background 0.2s;
}
.opportunity-btn:hover {
  background: var(--color-accent-purple);
}

.opportunity-btn.danger {
  background: var(--color-accent-red);
}

.opportunity-btn.success {
  background: var(--color-accent-green);
}

.opportunity-btn:disabled {
  background: var(--color-gray-light);
  color: var(--color-gray);
}