:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --error: #ef4444;
  --success: #22c55e;
  --radius: 0.5rem;
  --container-width: 1024px;
}
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { overflow-x: hidden; 
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.2s, color 0.2s;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 1rem; width: 100%; }

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-container {
  display: flex; justify-content: space-between; align-items: center; height: 4rem;
}
.logo {
  display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.25rem; color: var(--text-main); text-decoration: none;
}
.logo:hover { text-decoration: none; }
.main-nav { display: flex; gap: 1.5rem; align-items: center; }
.main-nav a { color: var(--text-muted); font-weight: 500; }
.main-nav a.active, .main-nav a:hover { color: var(--primary); text-decoration: none; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-main); cursor: pointer; }
#theme-toggle { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0.5rem; border-radius: 50%; }
#theme-toggle:hover { background: var(--border); }

@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); gap: 1rem;
  }
  .main-nav.show { display: flex; }
}

/* Main Content */
.main-content { flex: 1; padding: 3rem 0; }
.hero { text-align: center; margin-bottom: 3rem; }
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.2; }
.hero p { font-size: 1.125rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 1.5rem; }

/* Tool Box */
.tool-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  margin-bottom: 3rem;
}
.controls-group {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 1rem;
}
.radio-group { display: flex; gap: 1rem; }
.radio-group label { display: flex; align-items: center; gap: 0.375rem; font-weight: 500; cursor: pointer; font-size: 0.875rem; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

textarea {
  width: 100%; height: 160px; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text-main); font-family: inherit; font-size: 1rem; resize: vertical; margin-bottom: 0.75rem;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
textarea[readonly] { background: var(--bg-card); cursor: text; }

.status-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 0.875rem; color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5rem 1rem; font-weight: 500; border-radius: var(--radius); cursor: pointer; border: 1px solid transparent; transition: 0.2s;
  font-size: 0.875rem; background: var(--border); color: var(--text-main); text-decoration: none;
}
.btn:hover { background: var(--text-muted); color: #fff; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--border); color: var(--text-main); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn svg { width: 16px; height: 16px; }

/* Sections */
.section { margin-bottom: 4rem; }
.section h2 { font-size: 1.875rem; margin-bottom: 1.5rem; font-weight: 700; }
.section h3 { font-size: 1.25rem; margin-top: 1.5rem; margin-bottom: 1rem; }
.section p { margin-bottom: 1rem; }
.section ul, .section ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.section li { margin-bottom: 0.5rem; }

/* Table */
.table-wrapper { overflow-x: auto; margin-bottom: 2rem; }
table { width: 100%; border-collapse: collapse; min-width: 400px; text-align: left; }
th, td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; background: var(--bg); }
tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; background: var(--bg-card); }
.faq-question { padding: 1rem 1.5rem; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: none; border: none; width: 100%; color: var(--text-main); font-size: 1rem; text-align: left; }
.faq-answer { padding: 0 1.5rem; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; color: var(--text-muted); }
.faq-item.active .faq-answer { padding: 0 1.5rem 1.5rem; max-height: 1000px; }
.faq-icon { transition: transform 0.3s ease; }
.faq-item.active .faq-icon { transform: rotate(180deg); }

/* Examples */
.example-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--bg-card); margin-bottom: 1rem; cursor: pointer; transition: border-color 0.2s; }
.example-card:hover { border-color: var(--primary); }
.example-card p { margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--text-muted); }
.example-card code { display: block; background: var(--bg); padding: 0.5rem; border-radius: 0.25rem; font-size: 0.875rem; color: var(--text-main); word-break: break-all; }

/* Footer */
.footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 4rem 0 2rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 3rem; }
.footer-col h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.footer-col a { display: block; color: var(--text-muted); margin-bottom: 0.5rem; }
.footer-col a:hover { color: var(--primary); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 2rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* Toast */
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--text-main); color: var(--bg); padding: 0.75rem 1.5rem; border-radius: 2rem; font-weight: 500; transition: transform 0.3s ease; z-index: 1000; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); opacity: 0; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--error); color: #fff; }
.toast.success { background: var(--success); color: #fff; }

/* Blog Grid */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.blog-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; background: var(--bg-card); transition: box-shadow 0.2s; }
.blog-card:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05); }
.blog-card h3 { margin-top: 0; margin-bottom: 0.5rem; }
.blog-card p { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.95rem; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; }
.form-group input, .form-group textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text-main); font-family: inherit; font-size: 1rem; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

