/* Learning Goals Section - in Branch Sidebar */

.learning-goals-section {
  padding: var(--s-4);
  border-top: 1px solid rgba(78, 205, 196, 0.15);
  background: var(--surface);
}

.goals-header {
  margin-bottom: var(--s-3);
}

.goals-header h4 {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

/* Input section */
.goal-input-container {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

.goal-input {
  flex: 1;
  padding: var(--s-2);
  font-size: var(--text-sm);
  background: var(--surface-muted);
  border: 1px solid rgba(78, 205, 196, 0.15);
  border-radius: var(--r-s);
  color: var(--ink);
  transition: all var(--dur-fast) var(--ease-out);
}

.goal-input:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--surface);
}

.goal-input::placeholder {
  color: var(--ink-soft);
}

.add-button {
  width: 32px;
  height: 32px;
  border-radius: var(--r-s);
  background: var(--teal);
  border: none;
  color: white;
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}

.add-button:hover {
  background: var(--teal);
  transform: scale(1.05);
}

.add-button:active {
  transform: scale(0.95);
}

/* Goals list */
.goals-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.goal-item {
  position: relative;
  padding: var(--s-3);
  background: var(--surface-muted);
  border-radius: var(--r-m);
  border: 1px solid rgba(78, 205, 196, 0.15);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  transition: all var(--dur-fast) var(--ease-out);
}

.goal-item:hover {
  background: var(--teal-tint);
  border-color: var(--teal);
}

.goal-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--ink);
  word-break: break-word;
}

.goal-item .delete-button {
  position: relative;
  top: unset;
  right: unset;
  width: 20px;
  height: 20px;
  background: transparent;
  border: 1px solid var(--ink-soft);
  border-radius: var(--r-s);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}

.goal-item .delete-button:hover {
  opacity: 1;
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}

/* Modernized Add Form & Buttons */
.add-learning-item-form {
  margin-top: var(--s-4);
  padding: var(--s-3);
  background: var(--surface-muted);
  border-radius: var(--r-m);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.save-learning-item-button {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  background: var(--teal);
  color: white;
  border: none;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-button);
}

.save-learning-item-button:hover {
  background: #3FBBBB;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.save-learning-item-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.cancel-learning-item-button {
  padding: var(--s-2) var(--s-3);
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.cancel-learning-item-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.form-buttons {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.learning-item-type-selector {
  width: 100%;
  padding: var(--s-2);
  margin-bottom: var(--s-2);
  border-radius: var(--r-s);
  border: 1px solid var(--ink-faint);
  background: var(--surface);
  color: var(--ink);
}

/* Modern Glass Cards (Sidebar) */
.learning-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  margin-bottom: var(--s-3);

  /* Glassmorphism */
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-m);

  transition: all var(--dur-fast) var(--ease-out);
  overflow: hidden;
  cursor: default;
}

.learning-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  min-width: 0;
  /* Text truncation */
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
}

.score-text {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-color);
  opacity: 0.8;
}

.card-delete-button {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  /* Hidden until hover */
  transition: opacity var(--dur-fast);
}

.learning-card:hover .card-delete-button {
  opacity: 1;
}

.card-delete-button:hover {
  color: var(--coral);
}

/* Slim Progress Line at bottom */
.card-progress-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.progress-fill {
  height: 100%;
  /* background set inline by render_learning_item */
  transition: width 0.5s ease-out;
}

/* State Badge */
.state-badge {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.state-icon {
  font-size: 12px;
  line-height: 1;
}

.state-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

/* State-based card styling - intensity/glow variations */
/* New: Low opacity, minimal glow */
.learning-card.state-new {
  opacity: 0.7;
  filter: saturate(0.5);
}

.learning-card.state-new .state-badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.learning-card.state-new .state-label {
  color: rgba(255, 255, 255, 0.4);
}

/* Started: Slightly increased opacity and saturation */
.learning-card.state-started {
  opacity: 0.8;
  filter: saturate(0.7);
}

.learning-card.state-started .state-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.learning-card.state-started .state-label {
  color: rgba(255, 255, 255, 0.5);
}

/* Activated: Normal opacity, normal saturation */
.learning-card.state-activated {
  opacity: 0.9;
  filter: saturate(1);
}

.learning-card.state-activated .state-badge {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.learning-card.state-activated .state-label {
  color: rgba(255, 255, 255, 0.6);
}

/* Competent: Full opacity, enhanced saturation, subtle glow */
.learning-card.state-competent {
  opacity: 1;
  filter: saturate(1.2) drop-shadow(0 0 4px var(--accent-color));
}

.learning-card.state-competent .state-badge {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.learning-card.state-competent .state-label {
  color: rgba(255, 255, 255, 0.7);
}

/* Mastered: Full opacity, high saturation, medium glow */
.learning-card.state-mastered {
  opacity: 1;
  filter: saturate(1.4) brightness(1.05) drop-shadow(0 0 6px var(--accent-color));
}

.learning-card.state-mastered .state-badge {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.learning-card.state-mastered .state-label {
  color: rgba(255, 255, 255, 0.8);
}

/* Perfected: Full everything, intense glow */
.learning-card.state-perfected {
  opacity: 1;
  filter: saturate(1.6) brightness(1.1) drop-shadow(0 0 10px var(--accent-color)) drop-shadow(0 0 20px var(--accent-color));
  animation: perfected-pulse 2s ease-in-out infinite;
}

.learning-card.state-perfected .state-badge {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.4);
}

.learning-card.state-perfected .state-icon {
  color: rgba(255, 215, 0, 1);
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}

.learning-card.state-perfected .state-label {
  color: rgba(255, 215, 0, 1);
}

@keyframes perfected-pulse {
  0%, 100% {
    filter: saturate(1.6) brightness(1.1) drop-shadow(0 0 10px var(--accent-color)) drop-shadow(0 0 20px var(--accent-color));
  }
  50% {
    filter: saturate(1.6) brightness(1.15) drop-shadow(0 0 15px var(--accent-color)) drop-shadow(0 0 30px var(--accent-color));
  }
}