/* ============================================================
   AI Workflow Lab — Design System
   Linear / Raycast style · Glassmorphism + Gradient
   ============================================================ */

/* ===== Design Tokens ===== */
:root {
  /* Background */
  --bg-primary:    #0a0f1e;
  --bg-secondary:  #111827;
  --bg-card:       rgba(17, 24, 39, 0.7);
  --bg-hover:      rgba(255, 255, 255, 0.04);

  /* Accent */
  --accent-primary:    #3b82f6;
  --accent-secondary:  #8b5cf6;
  --accent-gradient:   linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --accent-glow:       0 0 24px rgba(59, 130, 246, 0.4);

  /* Text */
  --text-primary:    #f1f5f9;
  --text-secondary:  #94a3b8;
  --text-muted:      #64748b;

  /* Glass */
  --glass-bg:     rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-blur:   blur(12px);

  /* Status */
  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  /* Category colors */
  --cat-chat:  #3b82f6;
  --cat-code:  #22c55e;
  --cat-image: #a855f7;
  --cat-audio: #f97316;
  --cat-doc:   #ec4899;
  --cat-data:  #06b6d4;

  /* Difficulty */
  --difficulty-beginner:     #22c55e;
  --difficulty-intermediate: #f59e0b;
  --difficulty-advanced:     #ef4444;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 32px rgba(59, 130, 246, 0.25);

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.3s ease;
  --transition-slow:   0.5s ease;

  /* Typography */
  --font-base: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Noto Sans KR', 'Segoe UI', sans-serif;

  /* Breakpoints (for JS use) */
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;

  /* ── Legacy aliases (used in JSP inline styles) ── */
  --bg:              var(--bg-primary);
  --bg-contrast:     var(--bg-secondary);
  --accent:          var(--accent-primary);
  --accent-hover:    var(--accent-secondary);
  --text:            var(--text-primary);
  --card:            var(--bg-secondary);
  --surface:         rgba(255, 255, 255, 0.06);
  --border:          var(--glass-border);
  --shadow:          rgba(0, 0, 0, 0.4);
  --shadow-hover:    rgba(0, 0, 0, 0.6);
  --primary-gradient: var(--accent-gradient);
  --primary-solid:    var(--accent-primary);
  --primary-hover:    var(--accent-secondary);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  position: relative;
}

/* ===== Ambient background glow ===== */
body::before {
  content: '';
  position: fixed;
  top: -30vh;
  left: 50%;
  translate: -50% 0;
  width: 80vw;
  height: 60vh;
  background: radial-gradient(ellipse at center,
    rgba(59, 130, 246, 0.08) 0%,
    rgba(139, 92, 246, 0.05) 50%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 3vw, 2rem); }

p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { opacity: 0.8; }

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 56px;
  display: flex;
  align-items: center;
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: var(--glass-blur) saturate(180%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition-base);
}

.navbar.scrolled {
  background: rgba(10, 15, 30, 0.92);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.navbar-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  font-size: 1rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.navbar-menu-wrapper {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar-menu {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  align-items: center;
  margin: 0;
  padding: 0;
}

.navbar-menu a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: var(--transition-fast);
  white-space: nowrap;
  -webkit-text-fill-color: var(--text-secondary);
}

.navbar-menu a:hover,
.navbar-menu a.active {
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
  background: var(--glass-bg);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

@media (max-width: 768px) {
  .navbar { height: 52px; }

  .navbar-menu-wrapper {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 52px; left: 0; right: 0;
    background: rgba(10, 15, 30, 0.97);
    backdrop-filter: var(--glass-blur);
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    gap: 0.25rem;
  }

  .navbar-menu-wrapper.active { display: flex; }

  .navbar-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  .navbar-menu a {
    display: block;
    padding: 10px 16px;
    border-radius: var(--radius-md);
  }

  .navbar-menu-auth {
    padding-top: 0.75rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 0.25rem;
  }

  .navbar-toggle { display: flex; }
}

/* ===== Glass Card ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* Primary — gradient */
.btn.primary,
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn.primary:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  color: #fff;
}

.btn.primary:active,
.btn-primary:active {
  transform: translateY(0);
}

/* Secondary — outline */
.btn.secondary,
.btn-secondary {
  background: transparent;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn.secondary:hover,
.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Ghost */
.btn.ghost {
  background: var(--glass-bg);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Danger */
.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.btn.danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  color: #fff;
}

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-large { padding: 14px 28px; font-size: 1.0625rem; }
.btn-gradient {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
}
.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  color: #fff;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
}

/* Difficulty */
.badge-difficulty,
.badge-beginner {
  background: rgba(34, 197, 94, 0.15);
  color: var(--difficulty-beginner);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-intermediate {
  background: rgba(245, 158, 11, 0.15);
  color: var(--difficulty-intermediate);
  border-color: rgba(245, 158, 11, 0.25);
}

.badge-advanced {
  background: rgba(239, 68, 68, 0.15);
  color: var(--difficulty-advanced);
  border-color: rgba(239, 68, 68, 0.25);
}

/* Price */
.badge-price-free {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-price-premium {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  border-color: rgba(59, 130, 246, 0.25);
}

.badge-price-paid {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-secondary);
  border-color: rgba(139, 92, 246, 0.25);
}

/* Category */
.badge-category { border-color: transparent; }
.badge-chat  { background: rgba(59, 130, 246, 0.15); color: var(--cat-chat); }
.badge-code  { background: rgba(34, 197, 94, 0.15);  color: var(--cat-code); }
.badge-image { background: rgba(168, 85, 247, 0.15); color: var(--cat-image); }
.badge-audio { background: rgba(249, 115, 22, 0.15); color: var(--cat-audio); }
.badge-doc   { background: rgba(236, 72, 153, 0.15); color: var(--cat-doc); }
.badge-data  { background: rgba(6, 182, 212, 0.15);  color: var(--cat-data); }

/* ===== Cards ===== */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow), var(--shadow-md);
}

.lab-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  height: 100%;
}

.lab-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

/* ===== Forms ===== */
.form-control,
.form-select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.9375rem;
  transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

/* ===== Filter Sidebar ===== */
.filter-sidebar {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.filter-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

/* ===== Nav Tabs ===== */
.nav-tabs {
  border-bottom: 1px solid var(--glass-border);
  gap: 0;
}

.nav-tabs .nav-link {
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition-fast);
  background: transparent;
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-bottom-color: rgba(59, 130, 246, 0.5);
}

.nav-tabs .nav-link.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: transparent;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table th {
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}

table td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9375rem;
}

table tbody tr:last-child td { border-bottom: none; }

table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--accent-primary); }

.toast-message {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 1.1rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover { color: var(--text-primary); }

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@media (max-width: 768px) {
  .toast-container { right: 12px; left: 12px; }
  .toast { min-width: auto; max-width: 100%; }
}

/* ===== Loading ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.active { display: flex; }

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text  { height: 1em; margin: 6px 0; }
.skeleton-title { height: 1.4em; width: 60%; margin-bottom: 10px; }
.skeleton-card  { height: 280px; border-radius: var(--radius-lg); }

@keyframes shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Utility ===== */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted    { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* ===== Animations (base) ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.gsap-stagger > * { opacity: 0; transform: translateY(20px); }
.gsap-stagger.revealed > * { opacity: 1; transform: translateY(0); }

/* ===== Image fallback ===== */
.image-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  color: var(--text-muted);
  font-size: 2rem;
  border-radius: var(--radius-md);
}

/* ===== Responsive base ===== */
@media (max-width: 768px) {
  .filter-sidebar { margin-bottom: 1rem; }
}
