/* ==========================================================================
   TOOLBOX STYLES (Integrated with LearnBlox Theme)
   ========================================================================== */

/* --- Global Text Colors for Toolbox --- */
#toolbox-content h1,
#toolbox-content h2,
#toolbox-content h3 {
  color: var(--text-headings) !important;
}

#toolbox-content p {
  color: var(--text-secondary);
}

/* --- Filter Chips --- */
.filter-chip {
  background: var(--bg-content);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip:hover {
  background: var(--bg-alt);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--primary-accent);
  color: white;
  border-color: var(--primary-accent);
}

/* --- Snippet Badges --- */
.snippet-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-base {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.badge-player {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-physics {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.badge-ui {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
}

/* --- Code Preview --- */
.snippet-code-preview {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  color: #d4d4d4;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.snippet-code-preview code {
  display: block;
  white-space: pre;
  line-height: 1.5;
}

/* --- Snippet Card Overrides (More Space) --- */
.snippet-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.snippet-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.snippet-card .block-header {
  background: transparent !important;
  padding-bottom: 0.5rem !important;
  border-bottom: none !important;
}

.snippet-card h3 {
  font-size: 1.3rem !important;
  color: var(--text-headings);
}

.snippet-card .block-content {
  padding-top: 0.5rem !important;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.snippet-desc {
  font-size: 1rem !important;
  line-height: 1.6;
  margin-bottom: 1.5rem !important;
  color: var(--text-secondary);
}

.snippet-footer {
  margin-top: auto;
  padding-top: 1.25rem !important;
  border-top: 1px solid var(--border-color) !important;
}

.copy-btn {
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--bg-alt) !important;
  color: var(--primary-accent) !important;
  border-color: var(--primary-accent) !important;
}

/* --- Error Accordion --- */
.error-item {
  transition: all 0.3s ease;
}

.error-header:hover {
  background: var(--bg-alt);
}

.error-header i {
  transition: transform 0.3s;
}

.error-item.active .error-header i {
  transform: rotate(180deg);
}

.error-item.active .error-body {
  display: block !important;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Toolbox Grid (Max 2 columns) --- */
.toolbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 900px) {
  .toolbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- New Copy Button & Location --- */
.snippet-code-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.snippet-code-preview {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

.snippet-code-preview code {
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  color: #d4d4d4;
}

.copy-icon-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #d4d4d4;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.copy-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: scale(1.05);
}

.copy-icon-btn i {
  width: 16px;
  height: 16px;
}

.snippet-location {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-alt);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  border: 1px solid var(--border-color);
}

.snippet-location i {
  width: 14px;
  height: 14px;
}

/* --- Resources Tab Alignment --- */
#toolbox-resources .snippet-card .block-content {
  align-items: center;
}
