/* MikroTik Script Generator — premium layout */
.mtk-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 48px;
  overflow-x: hidden;
}

.mtk-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 45%, #7c3aed 100%);
  color: #fff;
  border-radius: 20px;
  padding: 28px 24px 32px;
  margin-bottom: 22px;
  box-shadow: 0 20px 50px rgba(67, 56, 202, 0.35);
}

.mtk-hero h1 { margin: 0 0 10px; font-size: clamp(1.35rem, 3vw, 2rem); }
.mtk-hero p { margin: 0; opacity: 0.92; line-height: 1.55; max-width: 720px; }
.mtk-badge-free {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mtk-section {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.mtk-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(90deg, #f8fafc, #eef2ff);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.mtk-section-num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mtk-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.mtk-section-body { padding: 18px 20px 22px; }

.mtk-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.mtk-mode-card {
  display: block;
  cursor: pointer;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface, #fff);
}

.mtk-mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mtk-mode-card:has(input:checked) {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: #f5f3ff;
}

.mtk-mode-title { font-weight: 700; font-size: 13px; color: #312e81; margin-bottom: 4px; }
.mtk-mode-desc { font-size: 11px; color: #64748b; line-height: 1.4; }

.mtk-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.mtk-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text, #334155);
}

.mtk-form-group input,
.mtk-form-group select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, #d1d5db);
  font-size: 14px;
  box-sizing: border-box;
}

.mtk-form-help { font-size: 11px; color: #64748b; margin-top: 4px; }

.mtk-wan-list { display: flex; flex-direction: column; gap: 12px; }

.mtk-wan-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.mtk-wan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.mtk-wan-card-head strong { font-size: 14px; color: #4338ca; }

.mtk-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.mtk-btn-purple {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}

.mtk-btn-purple:hover { filter: brightness(1.05); }
.mtk-btn-outline {
  background: #fff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.mtk-btn-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.mtk-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.mtk-check-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}

.mtk-check-card input { margin-top: 3px; flex-shrink: 0; }
.mtk-check-title { font-weight: 600; font-size: 13px; }
.mtk-check-desc { font-size: 11px; color: #64748b; margin-top: 2px; }

.mtk-hidden { display: none !important; }

.mtk-alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.mtk-alert-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.mtk-alert-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.mtk-val-errors {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.mtk-val-errors li {
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #991b1b;
}

.mtk-result-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.mtk-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: #64748b;
}

.mtk-tab.active {
  background: #eef2ff;
  color: #4338ca;
}

.mtk-code {
  max-height: 480px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.mtk-prose {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

.mtk-prose ul { padding-left: 1.2rem; }

@media (max-width: 640px) {
  .mtk-mode-grid { grid-template-columns: 1fr 1fr; }
  .mtk-form-row { grid-template-columns: 1fr; }
  .mtk-section-body { padding: 14px; }
}

/* ============================================================
   PREMIUM REFINEMENT + DARK-MODE FIX
   The base styles above hardcode light colors (#fff sections,
   light gradients, dark text) with no dark variants — broken in
   dark mode. These token-based rules load LATER, so they win and
   make BOTH themes intentional. Purely presentational; no JS hooks.
   ============================================================ */
.mtk-wrap {
  --mk-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --mk-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Dark-safe surfaces ---- */
.mtk-wrap .mtk-section {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 40px -26px rgba(15, 23, 42, 0.16);
}
[data-theme="dark"] .mtk-wrap .mtk-section {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 40px -26px rgba(0, 0, 0, 0.7);
}
.mtk-wrap .mtk-section-head {
  background: var(--bg-secondary);
  border-bottom-color: var(--border);
}
[data-theme="dark"] .mtk-wrap .mtk-section-head {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06));
}
.mtk-wrap .mtk-section-head h2 { color: var(--text); }

.mtk-wrap .mtk-mode-card { background: var(--bg-card); border-color: var(--border); }
.mtk-wrap .mtk-mode-card:hover { border-color: rgba(99, 102, 241, 0.4); }
.mtk-wrap .mtk-mode-card:has(input:checked) {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06));
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
.mtk-wrap .mtk-mode-title { color: var(--text); }
.mtk-wrap .mtk-mode-desc { color: var(--text-muted); }

.mtk-wrap .mtk-form-group label { color: var(--text); }
.mtk-wrap .mtk-form-group input,
.mtk-wrap .mtk-form-group select {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}
.mtk-wrap .mtk-form-group input:focus,
.mtk-wrap .mtk-form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
.mtk-wrap .mtk-form-help { color: var(--text-muted); }

.mtk-wrap .mtk-wan-card { background: var(--bg-secondary); border-color: var(--border); }
.mtk-wrap .mtk-wan-card-head strong { color: var(--primary); }

.mtk-wrap .mtk-btn-outline { background: var(--bg-card); color: var(--primary); border-color: var(--border); }
.mtk-wrap .mtk-btn-outline:hover { border-color: var(--primary); }
.mtk-wrap .mtk-btn-danger {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.30);
  color: #ef4444;
}

.mtk-wrap .mtk-check-card {
  background: var(--bg-card);
  border-color: var(--border);
  transition: border-color 0.18s ease, box-shadow 0.2s var(--mk-ease);
}
.mtk-wrap .mtk-check-card:hover { border-color: rgba(99, 102, 241, 0.4); }
.mtk-wrap .mtk-check-card:has(input:checked) {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.05));
}
.mtk-wrap .mtk-check-title { color: var(--text); }
.mtk-wrap .mtk-check-desc { color: var(--text-muted); }

.mtk-wrap .mtk-tab { color: var(--text-secondary); }
.mtk-wrap .mtk-tab:hover { color: var(--text); }
.mtk-wrap .mtk-tab.active { background: rgba(99, 102, 241, 0.12); color: var(--primary); }
[data-theme="dark"] .mtk-wrap .mtk-tab.active { background: rgba(139, 92, 246, 0.20); color: var(--primary-light, #a5b4fc); }
.mtk-wrap .mtk-result-tabs { border-bottom-color: var(--border); }
.mtk-wrap .mtk-prose { color: var(--text-secondary); }
.mtk-wrap .mtk-prose strong { color: var(--text); }
.mtk-wrap .mtk-val-errors li { background: rgba(239, 68, 68, 0.10); color: #ef4444; }

/* Safety / warning alert — clear but not loud, dark-safe */
.mtk-wrap .mtk-alert-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-left: 4px solid var(--warning, #f59e0b);
  color: var(--text-secondary);
  border-radius: 12px;
}
.mtk-wrap .mtk-alert-warn strong { color: var(--warning, #d97706); }
.mtk-wrap .mtk-alert-warn code {
  background: rgba(245, 158, 11, 0.12);
  color: var(--text);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}
.mtk-wrap .mtk-alert-err {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--text-secondary);
}
/* .mtk-code stays dark in both themes by design (terminal look) */
[data-theme="dark"] .mtk-wrap .mtk-code { border: 1px solid var(--border); }

/* ============================================================
   HERO — generate pills + trust badges
   ============================================================ */
.mtk-wrap .mtk-hero { position: relative; overflow: hidden; }
.mtk-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.mtk-hero-pills li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 12px;
  font-weight: 650;
  color: #fff;
}
.mtk-hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.mtk-hero-trust li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}
.mtk-hero-trust li svg { width: 13px; height: 13px; }

/* ============================================================
   SCRIPT TYPE CARDS — complexity + best-for
   ============================================================ */
.mtk-mode-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}
.mtk-mode-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.mtk-mode-badge--beginner { background: rgba(16, 185, 129, 0.14); color: #059669; border-color: rgba(16, 185, 129, 0.3); }
.mtk-mode-badge--intermediate { background: rgba(245, 158, 11, 0.14); color: #d97706; border-color: rgba(245, 158, 11, 0.32); }
.mtk-mode-badge--advanced { background: rgba(99, 102, 241, 0.14); color: var(--primary); border-color: rgba(99, 102, 241, 0.3); }
[data-theme="dark"] .mtk-mode-badge--beginner { color: #34d399; }
[data-theme="dark"] .mtk-mode-badge--intermediate { color: #fbbf24; }
[data-theme="dark"] .mtk-mode-badge--advanced { color: var(--primary-light, #a5b4fc); }
.mtk-mode-best { font-size: 10.5px; font-weight: 600; color: var(--text-muted); }

/* ============================================================
   FEATURES — SaaS feature cards
   ============================================================ */
.mtk-features { margin: 26px 0 0; }
.mtk-features__head { text-align: center; margin-bottom: 20px; }
.mtk-features__head h2 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 8px;
}
.mtk-features__head p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; max-width: 620px; margin: 0 auto; }
.mtk-features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.mtk-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 26px -20px rgba(15, 23, 42, 0.16);
  transition: border-color 0.18s ease, box-shadow 0.2s var(--mk-ease), transform 0.18s var(--mk-ease);
}
.mtk-feature:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 18px 38px -20px rgba(99, 102, 241, 0.35); }
[data-theme="dark"] .mtk-feature { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 26px -20px rgba(0, 0, 0, 0.6); }
.mtk-feature__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.10));
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12);
}
.mtk-feature__body { min-width: 0; }
.mtk-feature h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); margin: 2px 0 5px; }
.mtk-feature p { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); margin: 0; }

/* ============================================================
   RELATED TOOLS — Tools-Hub quality
   ============================================================ */
.mtk-wrap .related-tools { max-width: 1100px; margin-left: auto; margin-right: auto; }
.mtk-wrap .related-tools h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.015em; }
.mtk-wrap .related-tools-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.mtk-wrap .related-tool-card {
  position: relative;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px -16px rgba(15, 23, 42, 0.16);
  transition: border-color 0.18s ease, box-shadow 0.2s var(--mk-ease), transform 0.18s var(--mk-ease);
}
.mtk-wrap .related-tool-card:hover { transform: translateY(-3px); box-shadow: 0 18px 38px -18px rgba(99, 102, 241, 0.35); }
[data-theme="dark"] .mtk-wrap .related-tool-card { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 20px -16px rgba(0, 0, 0, 0.6); }
.mtk-wrap .related-tool-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.10));
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12);
}
.mtk-wrap .related-tool-name { font-size: 15px; font-weight: 700; color: var(--text); }
.mtk-wrap .related-tool-desc { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.mtk-wrap .related-tool-card::after {
  content: '→';
  position: absolute;
  top: 16px;
  right: 16px;
  font-weight: 700;
  color: var(--primary);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.mtk-wrap .related-tool-card:hover::after { opacity: 1; transform: translateX(0); }

/* ============================================================
   SEO CONTENT BLOCKS (.mtk-seo-wrap)
   ============================================================ */
.mtk-seo-wrap .seo-block__title { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; letter-spacing: -0.02em; }
.mtk-seo-wrap .seo-usecases__item {
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px -16px rgba(15, 23, 42, 0.14);
  transition: border-color 0.18s ease, box-shadow 0.2s var(--mk-ease), transform 0.18s var(--mk-ease);
}
.mtk-seo-wrap .seo-usecases__item:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 16px 34px -18px rgba(99, 102, 241, 0.3); }
[data-theme="dark"] .mtk-seo-wrap .seo-usecases__item { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 20px -16px rgba(0, 0, 0, 0.6); }
.mtk-seo-wrap .seo-usecases__item h3 { font-weight: 700; letter-spacing: -0.01em; }
.mtk-seo-wrap .seo-faq__item { transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.mtk-seo-wrap .seo-faq__item:hover { border-color: var(--primary); }
.mtk-seo-wrap .seo-faq__item summary { position: relative; padding-right: 2.75rem; transition: color 0.18s ease; }
.mtk-seo-wrap .seo-faq__item summary::after {
  content: '';
  position: absolute;
  right: 1.2rem;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.22s var(--mk-ease), border-color 0.18s ease;
}
.mtk-seo-wrap .seo-faq__item[open] summary { color: var(--primary); }
.mtk-seo-wrap .seo-faq__item[open] summary::after { transform: translateY(-35%) rotate(-135deg); border-color: var(--primary); }
.mtk-seo-wrap .seo-faq__item summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 12px; }
.mtk-seo-wrap .seo-related__card strong { font-size: 0.97rem; }

@media (prefers-reduced-motion: reduce) {
  .mtk-wrap .mtk-check-card,
  .mtk-feature,
  .mtk-wrap .related-tool-card,
  .mtk-seo-wrap .seo-usecases__item { transition: none !important; }
}

/* keep original closing brace below */
@media (max-width: 640px) {
  .mtk-features__grid { grid-template-columns: 1fr; }
}
