/**
 * ksp-hover.css
 * Hover Insight Tooltip Styles
 * ホバー時のポップアップUI
 */

/* ===== Tooltip Container ===== */
.ksp-hover-insight-tooltip {
  position: absolute;
  z-index: 10000;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border: 1px solid #52a9ff;
  border-radius: 12px;
  padding: 0;
  min-width: 320px;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6),
              0 0 20px rgba(82, 169, 255, 0.3);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.ksp-hover-insight-tooltip.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Tooltip Arrow ===== */
.ksp-hover-insight-tooltip::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #52a9ff;
}

/* ===== Insight Content ===== */
.ksp-insight-content {
  padding: 20px;
}

/* ===== Header ===== */
.ksp-insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 2px solid #333;
}

.ksp-insight-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #52a9ff;
}

.ksp-insight-badge {
  background: #52a9ff;
  color: #0a0a0a;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* ===== Sections ===== */
.ksp-insight-density,
.ksp-insight-scores,
.ksp-insight-emotions,
.ksp-insight-related {
  margin-bottom: 15px;
}

.ksp-insight-density:last-child,
.ksp-insight-scores:last-child,
.ksp-insight-emotions:last-child,
.ksp-insight-related:last-child {
  margin-bottom: 0;
}

.ksp-insight-label {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===== Density Bar ===== */
.ksp-insight-bar {
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  transition: width 0.4s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ksp-insight-bar span {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== Score Grid ===== */
.ksp-insight-score-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.ksp-insight-score-grid > div {
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  font-size: 13px;
  color: #e0e0e0;
}

.ksp-insight-score-grid > div span {
  display: block;
  font-size: 10px;
  color: #999;
  margin-bottom: 3px;
  font-weight: 600;
}

/* ===== Emotion Tags ===== */
.ksp-insight-emotion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ksp-emotion-tag {
  background: linear-gradient(135deg, #ff5252 0%, #ff1493 100%);
  color: #fff;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 82, 82, 0.3);
}

/* ===== Related Articles ===== */
.ksp-insight-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ksp-insight-related-list li {
  margin-bottom: 8px;
  padding-left: 16px;
  position: relative;
}

.ksp-insight-related-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #52a9ff;
  font-weight: 700;
}

.ksp-insight-related-list li:last-child {
  margin-bottom: 0;
}

.ksp-insight-related-list a {
  color: #e0e0e0;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  transition: color 0.3s;
  display: block;
}

.ksp-insight-related-list a:hover {
  color: #52a9ff;
  text-decoration: underline;
}

/* ===== Animation ===== */
@keyframes insightFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ksp-hover-insight-tooltip.active .ksp-insight-content > * {
  animation: insightFadeIn 0.4s ease forwards;
}

.ksp-hover-insight-tooltip.active .ksp-insight-content > *:nth-child(1) {
  animation-delay: 0s;
}

.ksp-hover-insight-tooltip.active .ksp-insight-content > *:nth-child(2) {
  animation-delay: 0.05s;
}

.ksp-hover-insight-tooltip.active .ksp-insight-content > *:nth-child(3) {
  animation-delay: 0.1s;
}

.ksp-hover-insight-tooltip.active .ksp-insight-content > *:nth-child(4) {
  animation-delay: 0.15s;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .ksp-hover-insight-tooltip {
    min-width: 280px;
    max-width: calc(100vw - 40px);
  }

  .ksp-insight-content {
    padding: 15px;
  }

  .ksp-insight-header h4 {
    font-size: 14px;
  }

  .ksp-insight-score-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .ksp-insight-score-grid > div {
    padding: 6px 2px;
    font-size: 12px;
  }
}
