/**
 * streak-widget.css
 * ストリークウィジェットコンポーネント
 */

.streak-widget {
  background: white;
  border-radius: var(--border-radius-xl, 24px);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.streak-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.streak-widget__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text, #212121);
  margin: 0;
}

.streak-widget__refresh {
  padding: 8px 12px;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-light, #757575);
  transition: all 0.2s ease;
}

.streak-widget__refresh:hover {
  background: #e0e0e0;
  transform: scale(1.05);
}

.streak-widget__refresh:active {
  transform: scale(0.95);
}

.streak-current {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  background: var(--gradient-primary, linear-gradient(135deg, #ff6b35 0%, #f7c331 100%));
  border-radius: var(--border-radius-xl, 24px);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.streak-current::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  animation: sparkle-drift 30s linear infinite;
}

.streak-flame {
  font-size: 64px;
  margin-bottom: 12px;
  animation: flame-flicker 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.4));
  position: relative;
  z-index: 1;
}

.streak-flame--hot {
  animation:
    flame-flicker-hot 1.5s ease-in-out infinite,
    pulse-scale 2s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(255, 107, 53, 0.6));
}

.streak-flame--warm {
  animation:
    flame-flicker 2s ease-in-out infinite,
    gentle-bounce 3s ease-in-out infinite;
}

@keyframes flame-flicker {
  0%,
  100% {
    transform: scale(1) rotate(-2deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.05) rotate(2deg);
    opacity: 0.95;
  }
}

@keyframes flame-flicker-hot {
  0%,
  100% {
    transform: scale(1) rotate(-3deg);
    opacity: 1;
  }
  33% {
    transform: scale(1.08) rotate(3deg);
    opacity: 0.98;
  }
  66% {
    transform: scale(1.05) rotate(-2deg);
    opacity: 0.96;
  }
}

@keyframes pulse-scale {
  0%,
  100% {
    filter: drop-shadow(0 6px 16px rgba(255, 107, 53, 0.6));
  }
  50% {
    filter: drop-shadow(0 8px 24px rgba(255, 107, 53, 0.8));
  }
}

@keyframes gentle-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.streak-number {
  font-size: 56px;
  font-weight: 800;
  color: white;
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.streak-label {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

.streak-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.streak-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
}

.streak-stat__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text, #212121);
  margin-bottom: 4px;
}

.streak-stat__label {
  font-size: 13px;
  color: var(--color-text-light, #757575);
  text-align: center;
}

.streak-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 24px;
}

.streak-rank__icon {
  font-size: 24px;
}

.streak-rank__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #212121);
}

.streak-progress {
  margin-bottom: 24px;
}

.streak-progress__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.streak-progress__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #212121);
}

.streak-progress__value {
  font-size: 13px;
  color: var(--color-text-light, #757575);
}

.streak-progress__bar {
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.streak-progress__fill {
  height: 100%;
  background: var(--gradient-primary, linear-gradient(135deg, #ff6b35 0%, #f7c331 100%));
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.streak-progress__message {
  font-size: 13px;
  color: var(--color-text-light, #757575);
  text-align: center;
  margin: 0;
}

.streak-calendar {
  margin-top: 24px;
}

.streak-calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.streak-calendar__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #212121);
}

.streak-calendar__nav {
  display: flex;
  gap: 8px;
}

.streak-calendar__nav-btn {
  padding: 6px 12px;
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-light, #757575);
  transition: all 0.2s ease;
}

.streak-calendar__nav-btn:hover {
  background: #e0e0e0;
}

.streak-calendar__heatmap {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 3px;
  margin-bottom: 12px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.heatmap-cell--empty {
  background: #ebedf0;
}

.heatmap-cell--level-1 {
  background: #ffe0cc;
}

.heatmap-cell--level-2 {
  background: #ffb380;
}

.heatmap-cell--level-3 {
  background: #ff8833;
}

.heatmap-cell--level-4 {
  background: #ff6b35;
}

.heatmap-cell:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.streak-calendar__legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 12px;
}

.streak-calendar__legend-label {
  font-size: 12px;
  color: var(--color-text-light, #757575);
  margin-right: 4px;
}

.streak-calendar__legend-item {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.streak-widget__empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-light, #757575);
}

.streak-widget__empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.streak-widget__empty-message {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px 0;
}

.streak-widget__empty-hint {
  font-size: 14px;
  margin: 0;
}

.streak-widget__loading {
  text-align: center;
  padding: 40px 20px;
}

.streak-widget__error {
  text-align: center;
  padding: 20px;
  background: #ffebee;
  border-radius: 12px;
  color: #c62828;
}

@media (prefers-reduced-motion: reduce) {
  .streak-flame,
  .streak-flame--hot,
  .streak-flame--warm,
  .streak-current::before,
  .streak-progress__fill {
    animation: none !important;
  }
}

.streak-calendar__toggle {
  display: none;
  padding: 6px 10px;
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-light, #757575);
  transition: all 0.2s ease;
}

.streak-calendar__toggle:hover {
  background: #e0e0e0;
}

@media (max-width: 768px) {
  .streak-widget {
    padding: 20px;
  }

  .streak-current {
    padding: 24px 16px;
  }

  .streak-flame {
    font-size: 48px;
  }

  .streak-number {
    font-size: 48px;
  }

  .streak-stats {
    gap: 8px;
  }

  .streak-stat {
    padding: 12px;
  }

  .streak-stat__value {
    font-size: 24px;
  }

  .streak-calendar__heatmap {
    grid-template-columns: repeat(26, 1fr);
    gap: 2px;
  }

  .streak-calendar__toggle {
    display: inline-flex;
  }
}

@media (max-width: 576px) {
  .streak-flame {
    font-size: 40px;
  }

  .streak-number {
    font-size: 40px;
  }

  .streak-stats {
    grid-template-columns: 1fr;
  }

  .streak-calendar__heatmap {
    grid-template-columns: repeat(12, 1fr);
  }
}

/* ダークモード */
[data-theme='dark'] .streak-calendar__toggle {
  background: var(--color-surface-light, #2c2c2c);
  color: var(--color-text-secondary, #b3b3b3);
}

[data-theme='dark'] .streak-calendar__toggle:hover {
  background: var(--color-border, #333333);
}
