/* AIアナリスト プレミアム新機能スタイル */

/* 1. 専門用語ホバー解説（ツールチップ） */
.ai-glossary-term {
  position: relative;
  border-bottom: 1.2px dotted #475569;
  cursor: help;
  color: var(--ink);
  transition: border-bottom-color 0.2s ease;
}

.ai-glossary-term:hover {
  border-bottom-color: var(--accent);
}

/* 動的ポジショニング用ツールチップ */
#ai-glossary-tooltip {
  position: absolute;
  z-index: 10000;
  max-width: 280px;
  background: #f3f4f6;
  color: var(--ink);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-sizing: border-box;
}

#ai-glossary-tooltip.visible {
  opacity: 1;
}

.ai-tooltip-arrow {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #f3f4f6;
  box-sizing: border-box;
  z-index: -1;
}

/* ツールチップが単語の上側にある場合 */
#ai-glossary-tooltip.tooltip-top .ai-tooltip-arrow {
  bottom: -5px;
  border-left: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  transform: rotate(-45deg);
}

/* ツールチップが単語の下側にある場合 */
#ai-glossary-tooltip.tooltip-bottom .ai-tooltip-arrow {
  top: -5px;
  border-right: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  transform: rotate(-45deg);
}

/* 2. スラッシュコマンド（サジェストポップアップ） */
.ai-slash-popup {
  position: absolute;
  bottom: 52px;
  left: 10px;
  right: 10px;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: none;
  padding: 6px 0;
}

.ai-slash-popup.open {
  display: block;
}

.ai-slash-item {
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s ease;
  font-family: inherit;
}

.ai-slash-item:hover,
.ai-slash-item.active {
  background: #f1f5f9;
}

.ai-slash-cmd {
  font-weight: 600;
  color: var(--accent);
}

.ai-slash-label {
  color: var(--muted);
  font-size: 11px;
}

/* 3. 簡易アクセス統計スコアカード */
.ai-dashboard-scorecards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  box-sizing: border-box;
}

.ai-scorecard {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-scorecard:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.04);
}

.ai-scorecard-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ai-scorecard-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.ai-scorecard-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  font-family: Inter, sans-serif;
}

.ai-scorecard-trend {
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 4px;
  display: inline-flex;
  align-items: center;
}

.ai-scorecard-trend.trend-up {
  color: #0b73bb;
  background: rgba(11, 115, 187, 0.08);
}

.ai-scorecard-trend.trend-down {
  color: #b3495b;
  background: rgba(179, 73, 91, 0.08);
}

/* 4. 目標設定とプログレスバー */
.ai-goal-progress {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.ai-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ai-goal-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.ai-goal-ratio {
  font-size: 11px;
  color: var(--muted);
  font-family: Inter, sans-serif;
}

.ai-progress-bar {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.ai-progress-fill {
  height: 100%;
  background: #00d9c0;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 目標入力ミニフォーム */
.ai-goal-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  flex-wrap: nowrap;
}

.ai-goal-form label {
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-goal-input {
  width: 60px !important;
  flex: none;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 11.5px;
  text-align: center;
  font-family: inherit;
  box-sizing: border-box;
}

.ai-goal-btn {
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 4px;
  border: none;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-goal-btn:hover {
  background: #334155;
}

/* モバイルでの調整 */
@media (max-width: 640px) {
  .ai-dashboard-scorecards {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
