/* ============================================================
   WORKFLOW.CSS — AI Agent Workflow Visual Theme
   Fullstack Builder · Inspirado em n8n / Quarn.com
   ============================================================ */

/* ---- DOT GRID + NOISE (merge: não substituir ruído do main.css) ---- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 24px 24px, auto;
  background-repeat: repeat, repeat;
  pointer-events: none;
  opacity: 0.45;
  z-index: 0;
}

/* ---- WORKFLOW NODE CARDS (proj-card) ---- */
.proj-card {
  background: rgba(13, 13, 22, 0.75);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 20px 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  animation: nodeAppear 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stagger de entrada dos cards */
.proj-grid .proj-card:nth-child(1)  { animation-delay: 0.02s; }
.proj-grid .proj-card:nth-child(2)  { animation-delay: 0.05s; }
.proj-grid .proj-card:nth-child(3)  { animation-delay: 0.08s; }
.proj-grid .proj-card:nth-child(4)  { animation-delay: 0.11s; }
.proj-grid .proj-card:nth-child(5)  { animation-delay: 0.14s; }
.proj-grid .proj-card:nth-child(6)  { animation-delay: 0.17s; }
.proj-grid .proj-card:nth-child(7)  { animation-delay: 0.20s; }
.proj-grid .proj-card:nth-child(8)  { animation-delay: 0.23s; }
.proj-grid .proj-card:nth-child(9)  { animation-delay: 0.26s; }
.proj-grid .proj-card:nth-child(10) { animation-delay: 0.29s; }
.proj-grid .proj-card:nth-child(11) { animation-delay: 0.32s; }
.proj-grid .proj-card:nth-child(12) { animation-delay: 0.35s; }
.proj-grid .proj-card:nth-child(13) { animation-delay: 0.38s; }
.proj-grid .proj-card:nth-child(14) { animation-delay: 0.41s; }
.proj-grid .proj-card:nth-child(15) { animation-delay: 0.44s; }
.proj-grid .proj-card:nth-child(16) { animation-delay: 0.47s; }

@keyframes nodeAppear {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Hover: borda verde sutil + elevação */
.proj-card:hover:not(.active) {
  border-color: rgba(0, 255, 140, 0.25);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 14px rgba(0, 255, 140, 0.07);
  transform: translateY(-2px);
}

/* ATIVO: glow verde estilo n8n */
.proj-card.active {
  border-color: #00ff8c;
  background: rgba(0, 255, 140, 0.04);
  box-shadow:
    0 0 0 1px rgba(0, 255, 140, 0.28),
    0 0 20px rgba(0, 255, 140, 0.14),
    0 0 48px rgba(0, 255, 140, 0.06),
    inset 0 1px 0 rgba(0, 255, 140, 0.1);
}

/* Check indicator ✓ — canto direito */
.proj-card.active::after {
  content: '✓';
  position: absolute;
  top: 9px;
  right: 11px;
  color: #00ff8c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-family: system-ui, sans-serif;
}

/* Connection point — base do card ativo (saída do nó) */
.proj-card.active::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #00ff8c, transparent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 255, 140, 0.6);
}

/* Node label "node" discreto no topo esquerdo */
.proj-card .node-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 8px;
  font-family: 'DM Mono', monospace;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* ---- ICON SLOT ---- */
.proj-card-icon-slot {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 10px !important;
  transition: all 0.3s ease !important;
}

.proj-card:hover .proj-card-icon-slot,
.proj-card.active .proj-card-icon-slot {
  background: rgba(0, 255, 140, 0.08) !important;
  border-color: rgba(0, 255, 140, 0.28) !important;
  box-shadow: 0 0 18px rgba(0, 255, 140, 0.12) !important;
}

.proj-card.active .proj-card-icon-slot .picon,
.proj-card:hover .proj-card-icon-slot .picon {
  color: #00ff8c !important;
}

/* ---- STEP CONNECTOR (entre cards de passo) ---- */
.step-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  margin: -8px 0;
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.step-connector::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom,
    rgba(0, 229, 255, 0.0),
    rgba(0, 229, 255, 0.3),
    rgba(0, 255, 140, 0.3),
    rgba(0, 229, 255, 0.0)
  );
}

.step-connector-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff8c;
  box-shadow: 0 0 10px rgba(0, 255, 140, 0.7);
  position: relative;
  z-index: 1;
  animation: pulseNode 2.2s ease-in-out infinite;
}

@keyframes pulseNode {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 10px rgba(0, 255, 140, 0.7); }
  50%       { opacity: 0.45; transform: scale(0.6); box-shadow: 0 0 4px rgba(0, 255, 140, 0.3); }
}

/* ---- STEP NUMBER (sec-num) ---- */
.sec-num {
  font-family: 'DM Mono', monospace !important;
  font-size: 9px !important;
  color: #00ff8c !important;
  letter-spacing: 2px !important;
  background: rgba(0, 255, 140, 0.08) !important;
  border: 1px solid rgba(0, 255, 140, 0.22) !important;
  border-radius: 6px !important;
  padding: 2px 9px !important;
}

/* ---- MAIN CARD (card wrapper dos steps) ---- */
.card {
  background: rgba(8, 8, 16, 0.65) !important;
  backdrop-filter: blur(24px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.055) !important;
  border-radius: 20px !important;
}

/* Top accent line nos cards glow */
.card.card-glow::before {
  content: '' !important;
  background: linear-gradient(90deg,
    transparent,
    rgba(0, 229, 255, 0.4),
    rgba(0, 255, 140, 0.6),
    rgba(0, 229, 255, 0.4),
    transparent
  ) !important;
  opacity: 0.7 !important;
}

/* ---- TECH TAGS (ttag) ---- */
.ttag {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.ttag:hover {
  border-color: rgba(0, 229, 255, 0.35);
  color: rgba(0, 229, 255, 0.9);
  background: rgba(0, 229, 255, 0.05);
}

.ttag.sel {
  background: rgba(0, 255, 140, 0.08);
  border-color: rgba(0, 255, 140, 0.42);
  color: #00ff8c;
  box-shadow: 0 0 8px rgba(0, 255, 140, 0.1);
}

.ttag.new.sel::after {
  background: rgba(0, 229, 255, 0.25);
  color: #00e5ff;
}

/* ---- GENERATE BUTTON (gbtn-main) ---- */
.gbtn-main {
  background: rgba(0, 255, 140, 0.1) !important;
  border: 1px solid rgba(0, 255, 140, 0.38) !important;
  color: #00ff8c !important;
  transition: all 0.2s ease !important;
}

.gbtn-main:hover {
  background: rgba(0, 255, 140, 0.18) !important;
  border-color: rgba(0, 255, 140, 0.65) !important;
  box-shadow: 0 0 22px rgba(0, 255, 140, 0.15), 0 4px 18px rgba(0, 0, 0, 0.45) !important;
  transform: translateY(-1px) !important;
}

.gbtn-main:active {
  transform: translateY(0) scale(0.98) !important;
}

/* ---- OUTPUT CARD (terminal/log style) ---- */
.output-card {
  background: rgba(4, 4, 10, 0.92) !important;
  border: 1px solid rgba(0, 229, 255, 0.18) !important;
  border-radius: 18px !important;
}

.output-card::before {
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.5), rgba(0, 255, 140, 0.5), rgba(0, 229, 255, 0.5), transparent) !important;
}

/* ---- SIDEBAR ---- */
.app-sidebar {
  background: rgba(4, 4, 10, 0.92) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.055) !important;
  backdrop-filter: blur(22px) !important;
  -webkit-backdrop-filter: blur(22px) !important;
}

.sidebar-item.tab-btn.active {
  background: rgba(0, 255, 140, 0.09) !important;
  border-color: rgba(0, 255, 140, 0.32) !important;
  color: #00ff8c !important;
}

/* ---- APP HEADER ---- */
.app-page-header {
  background: rgba(4, 4, 10, 0.82) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055) !important;
}

.header-eyebrow {
  background: rgba(0, 255, 140, 0.06) !important;
  border-color: rgba(0, 255, 140, 0.2) !important;
  color: #00ff8c !important;
}

.header-eyebrow .dot {
  background: #00ff8c !important;
  box-shadow: 0 0 8px #00ff8c !important;
}

/* ---- SELECTION FOOTER (bottom bar) ---- */
.selection-footer {
  background: rgba(4, 4, 10, 0.96) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
  backdrop-filter: blur(22px) !important;
}

/* ---- LOADING BAR ---- */
.loading-bar {
  border: 1px solid rgba(0, 255, 140, 0.2) !important;
  background: rgba(0, 255, 140, 0.03) !important;
  border-radius: 14px !important;
}

.loading-text { color: #00ff8c !important; }
.loader {
  border-color: rgba(0, 255, 140, 0.15) !important;
  border-top-color: #00ff8c !important;
}

/* ---- COMPLEXITY LABELS ---- */
.clabel.active {
  background: rgba(0, 229, 255, 0.09) !important;
  color: #00e5ff !important;
}

/* ---- API KEY INPUT FOCUS ---- */
.api-key-input:focus {
  border-color: rgba(0, 255, 140, 0.45) !important;
  box-shadow: 0 0 0 3px rgba(0, 255, 140, 0.07), 0 0 18px rgba(0, 255, 140, 0.05) !important;
}

/* ---- SITE CARDS ---- */
.site-card:hover {
  border-color: rgba(0, 255, 140, 0.2) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55) !important;
  transform: translateY(-2px) !important;
}

/* ---- SCROLLBARS ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); border-radius: 2px; }
::-webkit-scrollbar-thumb { background: rgba(0, 255, 140, 0.22); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 255, 140, 0.42); }

/* ---- APP MODAL ---- */
.app-modal-panel {
  background: linear-gradient(160deg, rgba(16, 16, 28, 0.99) 0%, rgba(6, 6, 14, 0.99) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
}

/* ---- FOUNDER / INNOV CARDS ---- */
.founder-card:hover,
.innov-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55) !important;
}

/* ---- PROJ PREVIEW PANEL ---- */
.proj-preview-panel {
  background: linear-gradient(165deg, rgba(18, 16, 34, 0.99) 0%, rgba(8, 8, 18, 0.99) 100%) !important;
  border: 1px solid rgba(0, 255, 140, 0.15) !important;
}

/* ---- MORE BTN ---- */
.more-btn {
  background: rgba(0, 229, 255, 0.07) !important;
  border-color: rgba(0, 229, 255, 0.28) !important;
  color: #00e5ff !important;
}
.more-btn:hover {
  background: rgba(0, 229, 255, 0.14) !important;
  border-color: rgba(0, 229, 255, 0.5) !important;
}

/* ---- FOOTER TECH PILL ---- */
.footer-tech-pill {
  background: rgba(0, 255, 140, 0.05) !important;
  border-color: rgba(0, 255, 140, 0.2) !important;
  color: rgba(0, 255, 140, 0.85) !important;
}

/* ---- USAGE BAR ---- */
.usage-ok  { background: #00ff8c !important; }
.usage-warn { background: #ffb800 !important; }
.usage-over { background: #ff3d6e !important; }

/* ---- DEV SEARCH ---- */
.dev-search-input:focus,
.dev-paste-textarea:focus {
  border-color: rgba(0, 255, 140, 0.4) !important;
  box-shadow: 0 0 0 2px rgba(0, 255, 140, 0.06) !important;
}

/* ---- REDUCE MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  .proj-card { animation: none !important; opacity: 1 !important; }
  .step-connector-dot { animation: none !important; }
  .proj-card:hover { transform: none !important; }
}
