/* ═══════════════════════════════════════════════════════════════════════════
   FOGSIGHT ANIMATION ARTIFACT STYLES
   HTML5 Educational Animation Code + Preview UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   Animation Artifact Card Container
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card {
  background: linear-gradient(
    145deg,
    rgba(30, 30, 46, 0.95) 0%,
    rgba(24, 24, 36, 0.98) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  margin: 16px 0;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* ─────────────────────────────────────────────────────────────────
   Code Section (Collapsible)
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card .code-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.animation-artifact-card .code-section summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s ease;
}

.animation-artifact-card .code-section summary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.animation-artifact-card .code-section summary::-webkit-details-marker {
  display: none;
}

.animation-artifact-card .code-section summary::before {
  content: "▶";
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease;
}

.animation-artifact-card .code-section[open] summary::before {
  transform: rotate(90deg);
}

.animation-artifact-card .code-icon {
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 14px;
  font-weight: 600;
  color: #5d9cec;
  background: rgba(93, 156, 236, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
}

.animation-artifact-card .code-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.animation-artifact-card .code-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.animation-artifact-card .copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.animation-artifact-card .copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.animation-artifact-card .copy-btn.copied {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.3);
}

/* Code Block */
.animation-artifact-card .code-block {
  margin: 0;
  padding: 16px 20px;
  max-height: 300px;
  overflow: auto;
  font-family: "SF Mono", "Monaco", "Consolas", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #e0e0e0;
  background: rgba(0, 0, 0, 0.3);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Syntax Highlighting (Basic) */
.animation-artifact-card .code-block .tag {
  color: #ff79c6;
}

.animation-artifact-card .code-block .attr {
  color: #8be9fd;
}

.animation-artifact-card .code-block .string {
  color: #f1fa8c;
}

.animation-artifact-card .code-block .comment {
  color: #6272a4;
  font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────
   Preview Section (iframe)
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card .preview-section {
  position: relative;
  width: 100%;
  background: #fff;
  border-radius: 0;
}

.animation-artifact-card .animation-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  background: #1a1a2e;
}

/* Loading State */
.animation-artifact-card .preview-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.95);
  color: white;
  font-size: 14px;
}

.animation-artifact-card .preview-loading .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #5d9cec;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

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

/* ─────────────────────────────────────────────────────────────────
   Action Row (Buttons)
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card .action-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.animation-artifact-card .action-row button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.animation-artifact-card .action-row button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
  transform: translateY(-1px);
}

.animation-artifact-card .action-row button:active {
  transform: translateY(0);
}

.animation-artifact-card .action-row button i {
  font-size: 14px;
  opacity: 0.8;
}

/* Primary Action (Open in New Window) */
.animation-artifact-card .action-row button.primary {
  background: linear-gradient(135deg, #5d9cec 0%, #4a89dc 100%);
  border-color: transparent;
  color: white;
}

.animation-artifact-card .action-row button.primary:hover {
  background: linear-gradient(135deg, #6ba8f0 0%, #5a96e6 100%);
  box-shadow: 0 4px 12px rgba(93, 156, 236, 0.3);
}

/* ─────────────────────────────────────────────────────────────────
   Topic Header (Optional)
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card .topic-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(
    90deg,
    rgba(93, 156, 236, 0.1) 0%,
    transparent 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.animation-artifact-card .topic-header .topic-icon {
  font-size: 24px;
}

.animation-artifact-card .topic-header .topic-info {
  flex: 1;
}

.animation-artifact-card .topic-header .topic-name {
  font-size: 16px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.animation-artifact-card .topic-header .topic-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* ─────────────────────────────────────────────────────────────────
   Streaming Code Animation
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card .code-block.streaming::after {
  content: "▋";
  display: inline;
  animation: blink 0.8s infinite;
  color: #5d9cec;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────
   Responsive Design
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .animation-artifact-card {
    margin: 12px 0;
    border-radius: 12px;
  }

  .animation-artifact-card .code-section summary {
    padding: 12px 16px;
  }

  .animation-artifact-card .code-block {
    padding: 12px 16px;
    font-size: 11px;
    max-height: 200px;
  }

  .animation-artifact-card .action-row {
    padding: 10px 12px;
  }

  .animation-artifact-card .action-row button {
    padding: 8px 12px;
    font-size: 12px;
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .animation-artifact-card .action-row {
    flex-direction: column;
  }

  .animation-artifact-card .action-row button {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────────────
   Dark Mode Scrollbar for Code Block
   ───────────────────────────────────────────────────────────────── */

.animation-artifact-card .code-block::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.animation-artifact-card .code-block::-webkit-scrollbar-track {
  background: transparent;
}

.animation-artifact-card .code-block::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.animation-artifact-card .code-block::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
