/**
 * ksp-density.css
 * Semantic Density Heatmap Styles
 * 棒グラフ・ヒートマップ・アニメーション
 */

/* ===== Container ===== */
.ksp-density-container {
  max-width: 1400px;
  margin: 40px auto;
  padding: 20px;
}

.ksp-density-heatmap {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ksp-density-title {
  color: #52a9ff;
  font-size: 24px;
  margin: 0 0 30px 0;
  padding-bottom: 15px;
  border-bottom: 2px solid #333;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ksp-density-title i {
  font-size: 28px;
}

/* ===== KSP Sections ===== */
.ksp-density-section {
  margin-bottom: 40px;
}

.ksp-density-section:last-child {
  margin-bottom: 0;
}

.ksp-density-ksp-label {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ksp-knowledge);
}

.ksp-density-ksp-label i {
  font-size: 22px;
}

/* ===== Bar Wrappers ===== */
.ksp-density-bars {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.ksp-density-bar-wrapper {
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.ksp-density-bar-wrapper:hover {
  background: #1a1a1a;
  border-color: #52a9ff;
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(82, 169, 255, 0.2);
}

.ksp-density-bar-wrapper::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--eidbo-emotion);
  border-radius: 8px 0 0 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.ksp-density-bar-wrapper:hover::before {
  opacity: 1;
}

/* ===== Bar Labels ===== */
.ksp-density-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 500;
}

.ksp-density-bar-label i {
  margin-right: 8px;
  font-size: 16px;
  color: var(--eidbo-emotion);
}

.ksp-density-count {
  background: #2a2a2a;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #52a9ff;
  font-weight: 600;
}

/* ===== Bar Container ===== */
.ksp-density-bar-container {
  width: 100%;
  height: 32px;
  background: #0a0a0a;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.ksp-density-bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.3s ease;
  background: linear-gradient(90deg,
    var(--eidbo-emotion) 0%,
    var(--eidbo-emotion) 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ksp-density-bar-wrapper:hover .ksp-density-bar {
  filter: brightness(1.2);
}

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

/* ===== Animation Entrance ===== */
@keyframes densityBarSlideIn {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.ksp-density-bar {
  animation: densityBarSlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Error State ===== */
.ksp-density-error {
  text-align: center;
  padding: 40px 20px;
  color: #ff5252;
}

.ksp-density-error i {
  font-size: 48px;
  margin-bottom: 15px;
}

.ksp-density-error p {
  font-size: 18px;
  font-weight: 600;
  margin: 10px 0 5px;
}

.ksp-density-error small {
  font-size: 13px;
  color: #999;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .ksp-density-container {
    padding: 15px;
  }

  .ksp-density-heatmap {
    padding: 20px 15px;
  }

  .ksp-density-title {
    font-size: 20px;
  }

  .ksp-density-ksp-label {
    font-size: 18px;
  }

  .ksp-density-bar-label {
    font-size: 13px;
  }

  .ksp-density-bar-container {
    height: 28px;
  }

  .ksp-density-bar-value {
    font-size: 12px;
  }
}

/* ===== Theme Transition ===== */
body.ksp-theme-transitioning .ksp-density-bar {
  transition: background 0.6s ease, width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
