/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f172a;
  color: #f1f5f9;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  line-height: 1.6;
}

/* ===== Navigation ===== */
#nav-placeholder { display: block; }

#main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid #334155;
  position: relative;
}

.nav-brand {
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.nav-brand .brand-name {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-brand .brand-tagline {
  font-size: 0.7rem;
  color: #94a3b8;
}

.nav-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid #334155;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-toggle:hover { background: #1e293b; }

.nav-toggle .hamburger {
  font-size: 1.2rem;
  color: #f1f5f9;
}

.nav-toggle-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 0.5rem 0;
  min-width: 220px;
  z-index: 999;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.nav-menu.open { display: block; }

.nav-menu a {
  display: block;
  padding: 0.5rem 1.25rem;
  color: #f1f5f9;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.nav-menu a:hover {
  background: #334155;
  color: #38bdf8;
}

/* ===== Typography ===== */
h1 {
  font-size: 2rem;
  color: #f1f5f9;
  margin-bottom: 0.25rem;
}

h1 .highlight { color: #38bdf8; }

.subtitle {
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

p { margin-bottom: 1rem; color: #94a3b8; }

/* ===== Trust Badges ===== */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.trust-badges span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trust-badges .badge-icon { font-size: 1.1rem; }

/* ===== Form Elements ===== */
textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: #38bdf8;
}

textarea[readonly] {
  background: #0f172a;
  color: #cbd5e1;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 1rem;
  background: #1e293b;
  color: #f1f5f9;
  transition: border-color 0.2s;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: #38bdf8;
}

/* ===== Buttons ===== */
.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.btn-group button {
  background: #334155;
  color: #f1f5f9;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.btn-group button:hover {
  background: #475569;
  transform: translateY(-2px);
}

.btn-group button.primary {
  background: #38bdf8;
  color: #0f172a;
}

.btn-group button.primary:hover {
  background: #7dd3fc;
}

.btn-group button.copy-btn {
  background: #22c55e;
  color: #0f172a;
}

.btn-group button.copy-btn:hover {
  background: #4ade80;
}

.btn-group button.clear-btn {
  background: #ef4444;
  color: #f1f5f9;
}

.btn-group button.clear-btn:hover {
  background: #f87171;
}

/* ===== Status Messages ===== */
#status {
  margin: 0.5rem 0;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: none;
  font-size: 0.9rem;
}

#status.success {
  display: block;
  background: #14532d;
  color: #86efac;
  border-left: 4px solid #22c55e;
}

#status.error {
  display: block;
  background: #450a0a;
  color: #fca5a5;
  border-left: 4px solid #ef4444;
}

#status.info {
  display: block;
  background: #1e3a5f;
  color: #7dd3fc;
  border-left: 4px solid #38bdf8;
}

/* ===== Character Counter ===== */
.char-counter {
  text-align: right;
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.char-counter span { color: #38bdf8; font-weight: 600; }

/* ===== Ad Container ===== */
.ad-container {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  margin: 2rem 0;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-container .ad-label {
  color: #64748b;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== SEO Content ===== */
.seo-content {
  background: #1e293b;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border: 1px solid #334155;
}

.seo-content h2 {
  color: #f1f5f9;
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.seo-content h2:first-child { margin-top: 0; }

.seo-content p, .seo-content li { color: #cbd5e1; }

.seo-content ul, .seo-content ol { padding-left: 1.5rem; }

.seo-content code {
  background: #0f172a;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #38bdf8;
}

.seo-content a { color: #38bdf8; text-decoration: none; }
.seo-content a:hover { text-decoration: underline; }

/* ===== Share Buttons ===== */
.share-section {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.share-section a {
  background: #1e293b;
  color: #f1f5f9;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid #334155;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.share-section a:hover {
  border-color: #38bdf8;
  background: #334155;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 2rem 0 1rem;
  border-top: 1px solid #334155;
  margin-top: 2rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: #38bdf8;
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover { text-decoration: underline; }

footer p { color: #64748b; font-size: 0.8rem; }

/* ===== JSON Formatter Error Display ===== */
#errorDisplay {
  display: none;
  background: #450a0a;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.5rem 0;
  color: #fca5a5;
  font-size: 0.8rem;
  max-height: 150px;
  overflow-y: auto;
  font-family: monospace;
  line-height: 1.5;
}

#errorDisplay .error-line {
  display: inline-block;
  background: #fee2e2;
  color: #dc2626;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-family: monospace;
}

/* ===== Side-by-side Panels (JSON/SQL) ===== */
.panel-container {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel label {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.panel textarea {
  flex: 1;
  min-height: 300px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ===== Line Numbers ===== */
.editor-wrap {
  position: relative;
  flex: 1;
  display: flex;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
}

.line-numbers {
  padding: 12px 8px;
  background: #1e293b;
  color: #64748b;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: right;
  user-select: none;
  overflow: hidden;
  min-width: 2.5rem;
}

.line-numbers .error-ln {
  color: #dc2626;
  font-weight: 700;
  background: #451a1a;
  display: block;
  padding: 0 0.25rem;
  border-radius: 2px;
}

.editor-wrap textarea {
  flex: 1;
  border: none;
  border-radius: 0;
  margin: 0;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: none;
  min-height: 300px;
}

/* ===== Controls Row (SQL Formatter) ===== */
.controls-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  align-items: center;
}

.controls-row label {
  color: #94a3b8;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.controls-row select {
  padding: 6px 12px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 0.85rem;
  cursor: pointer;
  width: auto;
  margin: 0;
}

.controls-row .spacer { flex: 1; }

/* ===== Stats ===== */
.stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.stats span strong { color: #f1f5f9; }

/* ===== Homepage Hero ===== */
.hero {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #334155;
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero .tagline {
  font-size: 1.3rem;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
}

.hero p {
  color: #94a3b8;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Tools Grid ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.tool-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  transition: all 0.3s ease;
  text-decoration: none;
  display: block;
  position: relative;
}

.tool-card:hover {
  border-color: #38bdf8;
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.15);
}

.tool-card .icon {
  display: inline-block;
  font-size: 1.3rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.tool-card h2 {
  display: inline;
  font-size: 1rem;
  color: #f1f5f9;
  vertical-align: middle;
}

.tool-card p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0.4rem 0 0;
  line-height: 1.4;
}

.tool-card .tool-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #38bdf8;
  color: #0f172a;
  font-size: 0.65rem;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.tool-card.upcoming {
  opacity: 0.6;
  cursor: not-allowed;
}

.tool-card.upcoming .tool-tag {
  background: #64748b;
  color: #f1f5f9;
}

/* ===== Visitor Counter ===== */
#visitor-counter {
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

#visitor-counter span { color: #38bdf8; font-weight: 600; }

/* ===== Password Generator ===== */
.password-display {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
}

.password-display input {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.password-display button {
  background: #38bdf8;
  color: #0f172a;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.password-display button:hover { background: #7dd3fc; }

.controls {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0;
}

.control-group { margin-bottom: 1rem; }
.control-group:last-child { margin-bottom: 0; }

.control-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.control-group .value {
  background: #38bdf8;
  color: #0f172a;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
}

.control-group input[type="range"] { width: 100%; accent-color: #38bdf8; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] { accent-color: #38bdf8; width: 16px; height: 16px; }

.strength-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
}

.strength-bar { height: 8px; background: #334155; border-radius: 4px; overflow: hidden; }
.strength-bar .fill { height: 100%; border-radius: 4px; transition: width 0.3s, background 0.3s; }

.strength-info { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: #94a3b8; }

.strength-badge { padding: 3px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: #334155; color: #94a3b8; }
.strength-badge.weak { background: #450a0a; color: #fca5a5; }
.strength-badge.fair { background: #451a00; color: #fbbf24; }
.strength-badge.good { background: #052e16; color: #86efac; }
.strength-badge.strong { background: #052e16; color: #4ade80; }
.strength-badge.excellent { background: #0c4a6e; color: #38bdf8; }

.action-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }

.action-buttons button {
  background: #334155;
  color: #f1f5f9;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.action-buttons button:hover { background: #475569; transform: translateY(-2px); }
.action-buttons button.primary { background: #38bdf8; color: #0f172a; }
.action-buttons button.primary:hover { background: #7dd3fc; }

/* ===== Form Group (AI Prompt) ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; color: #94a3b8; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }

/* ===== Drop Zone (PDF tools) ===== */
.drop-zone {
  border: 2px dashed #334155;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin: 1rem 0;
}

.drop-zone:hover, .drop-zone.dragover { border-color: #38bdf8; background: rgba(56, 189, 248, 0.05); }
.drop-zone .icon { font-size: 2rem; margin-bottom: 0.5rem; }
.drop-zone .file-name { color: #38bdf8; margin-top: 0.5rem; font-weight: 600; }

#progress { display: none; height: 6px; background: #334155; border-radius: 3px; margin: 0.5rem 0; overflow: hidden; }
#progress .bar { height: 100%; background: #38bdf8; border-radius: 3px; transition: width 0.3s; }
#downloadBtn { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero .tagline { font-size: 1rem; }
  .tools-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .trust-badges { gap: 1rem; font-size: 0.75rem; }
  .btn-group button { min-width: 70px; padding: 8px 14px; font-size: 0.8rem; }
  .seo-content { padding: 1.25rem; }
  .panel-container { flex-direction: column; }
  .panel textarea { min-height: 200px; }
  .controls-row { flex-direction: column; align-items: stretch; }
  .controls-row .spacer { display: none; }
}
