@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #0a0e14;
  --bg-card: #111820;
  --bg-input: #0d1219;
  --bg-hover: #161e29;
  --border: #1e2a38;
  --border-glow: #00e89644;
  --accent: #00e896;
  --accent-dim: #00c07a;
  --accent-glow: rgba(0, 232, 150, 0.15);
  --accent-secondary: #00bfff;
  --text: #e4e8ee;
  --text-dim: #7a8a9e;
  --text-muted: #4a5a6e;
  --danger: #ff6b6b;
  --warning: #ffd93d;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-glow: 0 0 30px rgba(0, 232, 150, 0.08);
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-display);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- NOISE TEXTURE ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ---- GRID BG ---- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,232,150,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,232,150,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ---- HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--bg-deep);
}
.logo-text {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
}
.logo-text span { color: var(--accent); }

.header-nav { display: flex; gap: 8px; align-items: center; }
.header-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.header-nav a:hover { color: var(--text); background: var(--bg-hover); }

/* ---- HERO ---- */
.hero {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-glow);
  border: 1px solid var(--border-glow);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  animation: fadeInUp 0.6s ease-out;
}
.hero h1 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}
.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto 36px;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}
.hero-search {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}
.hero-search input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-display);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.hero-search input::placeholder { color: var(--text-muted); }
.hero-search input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.hero-search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

/* ---- TOOLS GRID ---- */
.section {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 80px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 32px;
  font-family: var(--font-mono);
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  opacity: 0;
  transition: opacity 0.3s;
}
.tool-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.tool-card:hover::before { opacity: 1; }
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  background: var(--accent-glow);
}
.tool-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.tool-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.tool-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-secondary);
  background: rgba(0, 191, 255, 0.1);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ---- TOOL PAGE LAYOUT ---- */
.tool-page {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.tool-page-header {
  margin-bottom: 32px;
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.tool-page-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.tool-page-header p {
  color: var(--text-dim);
  font-size: 16px;
}

.tool-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
}

/* ---- FORM ELEMENTS ---- */
textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  resize: vertical;
  transition: border-color 0.3s, box-shadow 0.3s;
}
textarea:focus, input[type="text"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { min-height: 140px; line-height: 1.6; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.form-group { margin-bottom: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
}
.btn-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 20px rgba(0, 232, 150, 0.3);
}
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-danger {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.output-area {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 100px;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.6;
  color: var(--accent);
}
.output-area.error { color: var(--danger); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ---- COPY TOAST ---- */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--accent);
  color: var(--bg-deep);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---- AD SLOTS ---- */
.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 24px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- SEO CONTENT BLOCK ---- */
.seo-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 32px;
}
.seo-content h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.seo-content p, .seo-content li {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.seo-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 20px 0 10px;
}
.seo-content ul { padding-left: 20px; }
.seo-content code {
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* ---- FOOTER ---- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* ---- COLOR UTILITIES ---- */
.color-preview {
  width: 100%;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.color-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.color-chip {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}
.color-chip:hover { transform: scale(1.1); }

/* ---- REGEX MATCH HIGHLIGHTS ---- */
.match { background: rgba(0, 232, 150, 0.25); border-radius: 2px; padding: 1px 0; }

/* ---- SWITCH ---- */
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.switch {
  position: relative;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border-radius: 24px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: 0.2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .switch-slider { background: var(--accent-glow); border-color: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); background: var(--accent); }

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeInUp 0.5s ease-out both;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .hero { padding: 48px 16px 40px; }
  .hero h1 { font-size: 32px; }
  .tools-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .tool-container { padding: 20px; }
  .header-nav { display: none; }
}
