/* static/css/style.css */
/* ==========================================================================
   AutomataLab — Custom Theme
   Dark, modern theme dengan aksen gradient indigo-violet.
   ========================================================================== */

:root {
  --bg-body: #0a120d;
  --bg-surface: #101a13;
  --bg-surface-2: #142018;
  --bg-elevated: #17251c;
  --border-subtle: #24352a;
  --text-primary: #e9f0ea;
  --text-secondary: #92a698;
  --accent-1: #22c55e;
  --accent-2: #84cc16;
  --accent-3: #2dd4bf;
  --success: #22c55e;
  --danger: #ef4444;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg-body);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(34, 197, 94, 0.14), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(132, 204, 22, 0.10), transparent 40%);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
}

.text-secondary { color: var(--text-secondary) !important; }
code, pre, .doc-code { font-family: var(--font-mono); }

.text-gradient {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Navbar ---------- */
.app-navbar {
  background: rgba(11, 13, 19, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 0;
}
.brand-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white; font-size: 1.1rem;
}
.brand-text { font-weight: 800; font-size: 1.15rem; color: var(--text-primary); }
.app-navbar .nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 0.9rem !important;
  border-radius: 8px;
  transition: 0.15s ease;
}
.app-navbar .nav-link:hover, .app-navbar .nav-link.active { color: white; background: rgba(255,255,255,0.06); }
.dropdown-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.5rem;
}
.dropdown-item { color: var(--text-secondary); border-radius: 8px; padding: 0.55rem 0.8rem; font-size: 0.92rem; }
.dropdown-item:hover { background: rgba(34, 197, 94, 0.15); color: white; }

.btn-gradient {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  border: none; color: white; font-weight: 600;
  border-radius: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-gradient:hover {
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.35);
}
.btn-outline-light { border-radius: 10px; }

/* ---------- Hero ---------- */
.hero { padding-top: 2rem; }
.badge-soft {
  display: inline-block;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #c7f0ce;
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
}
.hero-title { font-size: 2.85rem; font-weight: 800; line-height: 1.15; margin-bottom: 1.2rem; }
.hero-subtitle { color: var(--text-secondary); font-size: 1.08rem; max-width: 540px; }
.stat-number { font-weight: 800; font-size: 1.6rem; margin-bottom: 0.1rem; background: linear-gradient(90deg, var(--accent-1), var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }

.hero-visual { position: relative; }
.glow-blob {
  position: absolute; width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(34,197,94,0.35), transparent 70%);
  top: -40px; right: -20px; z-index: 0; filter: blur(10px);
}
.code-window {
  position: relative; z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.45);
}
.code-window-header {
  background: var(--bg-surface-2);
  padding: 0.7rem 1rem;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
}
.code-window-header .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ff5f56; } .dot.yellow { background: #ffbd2e; } .dot.green { background: #27c93f; }
.code-window-body {
  margin: 0; padding: 1.5rem; font-size: 0.88rem; color: #cbd0e0;
  font-family: var(--font-mono); white-space: pre-wrap;
}
.tk-kw { color: #a3e635; } .tk-fn { color: #5eead4; } .tk-comment { color: #6b7180; } .tk-accept { color: var(--success); font-weight: 700; }

/* ---------- Section Titles ---------- */
.section-title { font-weight: 800; font-size: 2rem; }
.section-subtitle { color: var(--text-secondary); }

/* ---------- Module Cards ---------- */
.module-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.8rem 1.5rem;
  height: 100%;
  text-decoration: none;
  color: var(--text-primary);
  transition: 0.2s ease;
}
.module-card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  color: var(--text-primary);
}
.module-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: white; margin-bottom: 1.1rem;
}
.bg-icon-1 { background: linear-gradient(135deg, #22c55e, #15803d); }
.bg-icon-2 { background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.bg-icon-3 { background: linear-gradient(135deg, #84cc16, #4d7c0f); }
.bg-icon-4 { background: linear-gradient(135deg, #facc15, #ca8a04); }
.module-card h5 { font-weight: 700; margin-bottom: 0.6rem; }
.module-card p { color: var(--text-secondary); font-size: 0.9rem; min-height: 62px; }
.module-link { color: var(--accent-3); font-weight: 600; font-size: 0.88rem; }

.workflow-banner {
  background: linear-gradient(120deg, rgba(99,102,241,0.15), rgba(168,85,247,0.1));
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 20px;
  padding: 2.5rem;
}

/* ---------- Page Header (inner pages) ---------- */
.page-header { border-bottom: 1px solid var(--border-subtle); }
.page-title { font-weight: 800; font-size: 2.1rem; }
.page-subtitle { color: var(--text-secondary); max-width: 640px; }

/* ---------- Cards / Panels ---------- */
.info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.6rem;
}
.footer-title { font-weight: 700; margin-bottom: 0.9rem; font-size: 0.95rem; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.88rem; }
.footer-links a:hover { color: var(--accent-3); }
.app-footer { background: var(--bg-surface); border-top: 1px solid var(--border-subtle); }
.tech-badge {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.75rem; border-radius: 999px; font-size: 0.78rem; color: var(--text-secondary);
}
.tech-badge-lg {
  background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34,197,94,0.3);
  padding: 0.5rem 1rem; border-radius: 10px; font-size: 0.85rem; color: #c7f0ce; font-weight: 600;
}

/* ---------- Forms ---------- */
.form-control-dark, .form-select {
  background: var(--bg-surface-2) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-primary) !important;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.form-control-dark::placeholder { color: #565c70; }
.form-control-dark:focus, .form-select:focus {
  border-color: var(--accent-1) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2) !important;
}
.form-label { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); }
select[multiple] { min-height: 90px; }

/* ---------- Transitions list (FSA) ---------- */
.transitions-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.transition-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 0.4rem; align-items: center; }
.transition-row input { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.btn-remove-row {
  background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}

/* ---------- Result / Status ---------- */
.status-badge { padding: 0.45rem 1rem; border-radius: 999px; font-weight: 700; font-size: 0.85rem; }
.status-badge.accepted { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.35); }
.status-badge.rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.35); }

.doc-table { color: var(--text-primary); border-color: var(--border-subtle) !important; }
.doc-table thead th { color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; border-color: var(--border-subtle) !important; font-weight: 700; }
.doc-table td, .doc-table th { border-color: var(--border-subtle) !important; vertical-align: middle; font-size: 0.9rem; }

.diagram-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
}

.doc-code {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  color: #a7f3d0;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Documentation page ---------- */
.doc-nav { display: flex; flex-direction: column; gap: 0.3rem; }
.doc-nav-link { color: var(--text-secondary); text-decoration: none; padding: 0.6rem 0.8rem; border-radius: 8px; font-size: 0.9rem; font-weight: 500; }
.doc-nav-link:hover { background: rgba(255,255,255,0.05); color: white; }
.doc-section h3 { font-weight: 700; }
.check-list { list-style: none; padding: 0; }
.check-list li { padding-left: 1.8rem; position: relative; margin-bottom: 0.6rem; color: var(--text-secondary); }
.check-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--success); font-weight: 800; }
.arch-list { list-style: none; padding: 0; }
.arch-list li { padding: 0.5rem 0; border-bottom: 1px dashed var(--border-subtle); color: var(--text-secondary); font-size: 0.87rem; }
.arch-list li:last-child { border-bottom: none; }
.arch-list code { color: var(--accent-3); }

/* ---------- Contact page ---------- */
.contact-item { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.4rem; }
.contact-item i { font-size: 1.3rem; color: var(--accent-1); margin-top: 0.2rem; }

/* ---------- PDA tabs / parse tree ---------- */
#pdaTabs .nav-link { color: var(--text-secondary); border-radius: 10px; font-size: 0.85rem; font-weight: 600; margin-right: 0.4rem; }
#pdaTabs .nav-link.active { background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); color: white; }
.tree-container { overflow-x: auto; padding: 1rem 0; }
.tree-node-wrap { display: flex; flex-direction: column; align-items: center; }
.tree-node { background: var(--bg-elevated); border: 1px solid var(--accent-1); color: white; border-radius: 8px; padding: 0.3rem 0.7rem; font-family: var(--font-mono); font-size: 0.85rem; white-space: nowrap; }
.tree-node.terminal { border-color: var(--accent-3); color: #a7f3d0; }
.tree-children { display: flex; gap: 1.2rem; margin-top: 0.6rem; position: relative; }
.tree-children::before { content: ""; }

/* ---------- Chomsky hierarchy visualization ---------- */
.chomsky-hierarchy { display: flex; flex-direction: column; align-items: center; gap: 0; }
.chomsky-ring {
  width: 100%; border-radius: 14px; text-align: center;
  padding: 1.1rem 0.5rem; font-size: 0.8rem; font-weight: 700; color: white;
  margin-bottom: -0.6rem; position: relative;
}
.ring-0 { background: linear-gradient(135deg, #374151, #1f2937); z-index: 1; }
.ring-1 { background: linear-gradient(135deg, #16a34a, #15803d); width: 85%; z-index: 2; }
.ring-2 { background: linear-gradient(135deg, #65a30d, #4d7c0f); width: 65%; z-index: 3; }
.ring-3 { background: linear-gradient(135deg, #2dd4bf, #0f766e); width: 42%; z-index: 4; margin-bottom: 0; }
.chomsky-ring.highlight { outline: 3px solid #fbbf24; }

/* ---------- CNF steps ---------- */
.cnf-step-card { margin-bottom: 1.2rem; }
.cnf-step-number {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #363c4e; border-radius: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .hero-title { font-size: 2.1rem; }
  .glow-blob { display: none; }
}
