/**
 * Topic Action Buttons
 * F-029-F: Quiz and Flashcard buttons for each topic
 */

/* Topic actions container */
.topic-actions {
  display: flex;
  gap: var(--space-xs);
  margin-left: auto;
  align-items: center;
}

/* Topic action button base styles */
.topic-action-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-color);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

/* Hover state for enabled buttons */
.topic-action-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Active state */
.topic-action-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

/* Disabled state */
.topic-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Coming soon state - hide quiz buttons for topics without questions */
.topic-action-btn.coming-soon.quiz-btn {
  display: none;
}

/* Coming soon state for other action buttons */
.topic-action-btn.coming-soon {
  color: var(--text-muted);
}

/* Icon styles */
.topic-action-btn .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Button label */
.topic-action-btn .btn-label {
  font-weight: 500;
}

/* Count badge */
.topic-action-btn .btn-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.topic-action-btn:hover:not(:disabled) .btn-count {
  color: rgba(255, 255, 255, 0.8);
}

/* Specific button colors (optional enhancement) */
.quiz-btn:hover:not(:disabled) {
  background: var(--accent-primary, #2563EB);
  border-color: var(--accent-primary, #2563EB);
}

.flashcard-btn:hover:not(:disabled) {
  background: var(--accent-secondary, #8b5cf6);
  border-color: var(--accent-secondary, #8b5cf6);
}

/* Prevent clicks from triggering topic expansion */
.topic-actions {
  pointer-events: auto;
}

.topic-actions button {
  pointer-events: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
  /* Hide button labels on mobile, show icons only */
  .topic-action-btn .btn-label {
    display: none;
  }

  .topic-action-btn {
    padding: 0.5rem;
    min-width: 40px;
    justify-content: center;
  }

  /* Keep count visible but smaller */
  .topic-action-btn .btn-count {
    font-size: 0.7rem;
  }

  /* Reduce gap between buttons */
  .topic-actions {
    gap: 0.25rem;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  /* Make buttons even more compact */
  .topic-action-btn {
    padding: 0.375rem;
    min-width: 36px;
  }

  .topic-action-btn .icon {
    width: 14px;
    height: 14px;
  }

  .topic-action-btn .btn-count {
    font-size: 0.65rem;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .topic-action-btn {
    border-color: var(--border-dark, #374151);
    background: var(--bg-secondary-dark, #1f2937);
  }

  .topic-action-btn:hover:not(:disabled) {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}

/* Accessibility: Focus states */
.topic-action-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Loading state (optional for future) */
.topic-action-btn.loading {
  opacity: 0.6;
  cursor: wait;
}

.topic-action-btn.loading .icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
