/* =============================================================================
   Linux SOP Charts — Custom Styles (한국어)
   ============================================================================= */

/* Font stack — Pretendard for Korean UI */
:root {
  --font-primary: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --color-bg: #f0f0f0;
  --color-text: #333;
  --color-accent: #3498db;
  --color-accent-hover: #2980b9;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  color: var(--color-text);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus-visible ring (global fallback) */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =============================================================================
   Typography helpers
   ============================================================================= */
.font-pretendard { font-family: var(--font-primary); }
.font-inter      { font-family: var(--font-primary); }

/* Monospace fallback for code/terminal content */
.font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Menlo', monospace;
}

/* =============================================================================
   Spinner animation
   ============================================================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* =============================================================================
   Toast animations
   ============================================================================= */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-4px); }
}

.toast-item {
  animation: slideInRight 0.25s ease-out both;
}

.toast-item.removing {
  animation: fadeOut 0.2s ease-in forwards;
}

/* =============================================================================
   Step add / remove animation
   ============================================================================= */
@keyframes stepEnter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes stepLeave {
  from {
    opacity: 1;
    transform: scale(1);
    max-height: 400px;
  }
  to {
    opacity: 0;
    transform: scale(0.96);
    max-height: 0;
  }
}

.step-item {
  animation: stepEnter 0.2s ease-out both;
  overflow: hidden;
}

.step-item.leaving {
  animation: stepLeave 0.2s ease-in forwards;
}

/* =============================================================================
   Drag and drop states
   ============================================================================= */
.step-item[draggable="true"] {
  cursor: default;
}

.step-item.drag-over {
  border-color: var(--color-accent) !important;
  background: #eaf4fd;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.18);
}

.step-item.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}

/* =============================================================================
   Chart card hover
   ============================================================================= */
.chart-card {
  transform: translateY(0);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.chart-card:hover {
  transform: translateY(-2px);
}

/* =============================================================================
   Flow chart viewer
   ============================================================================= */
.flow-card {
  position: relative;
  transition: box-shadow 0.15s ease;
}

.flow-card:hover {
  box-shadow: 0 4px 20px -4px rgba(0,0,0,0.12);
}

.start-end-node {
  letter-spacing: 0.12em;
  font-size: 0.75rem;
}

/* =============================================================================
   Preview connector lines
   ============================================================================= */
.preview-step {
  position: relative;
  padding-bottom: 2px;
}

.connector-line {
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  width: 2px;
  height: 14px;
  background: #d1d5db;
  z-index: 0;
}

/* =============================================================================
   Step type icon (viewer)
   ============================================================================= */
.step-type-icon svg {
  width: 20px;
  height: 20px;
}

/* =============================================================================
   Pre / code blocks inside step descriptions
   ============================================================================= */
pre {
  tab-size: 2;
}

/* =============================================================================
   Scrollbar styling (subtle, webkit only)
   ============================================================================= */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* =============================================================================
   Line clamp utility (2 lines)
   ============================================================================= */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =============================================================================
   Alpine x-cloak
   ============================================================================= */
[x-cloak] { display: none !important; }

/* =============================================================================
   Print styles
   ============================================================================= */
@media print {
  header, footer, button, .drag-handle { display: none !important; }
  body { background: white !important; }
  .flow-card { break-inside: avoid; }
}
