:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --font-family: system-ui, -apple-system, sans-serif;
}

body.dark-mode {
  --bg-color: #0F172A;
  --card-bg: #1E293B;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.2s, color 0.2s;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.header-container {
  display: flex; justify-content: space-between; align-items: center; height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 0.5rem; font-weight: bold; font-size: 1.25rem; color: var(--text-main); text-decoration: none;
}
.logo:hover { text-decoration: none; }
.desktop-nav { display: none; gap: 1.5rem; }
.desktop-nav a { color: var(--text-muted); font-weight: 500; }
.desktop-nav a:hover, .desktop-nav a.active { color: var(--primary); text-decoration: none; }
@media(min-width: 768px) { .desktop-nav { display: flex; } #mobile-menu-btn { display: none; } }
.actions { display: flex; gap: 0.5rem; align-items: center; }
.actions button {
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: var(--radius);
}
.actions button:hover { background: var(--border); color: var(--text-main); }
.mobile-menu {
  display: none; background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 1rem; flex-direction: column; gap: 1rem;
}
.mobile-menu.open { display: flex; }

/* Layout Grid */
.layout-grid {
  display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; margin-bottom: 4rem;
}
@media(min-width: 1024px) {
  .layout-grid { grid-template-columns: 280px 1fr; }
}

/* Sidebar */
.sidebar {
  display: flex; flex-direction: column; gap: 1.5rem;
}
.search-box {
  position: relative;
}
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input {
  width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg); color: var(--text-main);
}
.tool-nav { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.tool-nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--radius); color: var(--text-muted); font-weight: 500;
}
.tool-nav a:hover, .tool-nav a.active { background: var(--card-bg); color: var(--primary); text-decoration: none; }
.tool-nav .icon { display: flex; width: 20px; }

/* Content Area */
.tool-header { margin-bottom: 1.5rem; }
.tool-title { font-size: 2rem; font-weight: bold; margin-bottom: 0.5rem; }
.tool-desc { color: var(--text-muted); font-size: 1.1rem; }

.text-editor {
  width: 100%; min-height: 300px; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg); color: var(--text-main); font-family: inherit; font-size: 1rem; resize: vertical; margin-bottom: 1rem;
}
.text-editor:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }

.editor-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.btn {
  padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg);
  color: var(--text-main); font-weight: 500; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1.125rem; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--card-bg); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.stat-value { font-size: 1.75rem; font-weight: bold; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; }

/* Advanced Stats */
.advanced-stats { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; margin-bottom: 2rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
th { background: rgba(0,0,0,0.02); font-weight: 600; color: var(--text-muted); }
.dark-mode th { background: rgba(255,255,255,0.02); }

/* Home Hero */
.hero { text-align: center; padding: 4rem 1rem; background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 3rem; }
.hero-title { font-size: 3rem; margin-bottom: 1rem; color: var(--text-main); }
.hero-subtitle { font-size: 1.25rem; color: var(--text-muted); max-width: 800px; margin: 0 auto 2rem; }
.hero-actions { display: flex; justify-content: center; gap: 1rem; margin-bottom: 2rem; }
.trust-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem; color: var(--success); font-weight: 500; }

/* Home Categories */
.category-section { margin-bottom: 3rem; }
.category-title { margin-bottom: 1.5rem; font-size: 1.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.tool-card {
  background: var(--card-bg); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s; color: var(--text-main); display: flex; flex-direction: column; gap: 0.75rem;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1); text-decoration: none; }
.tool-icon { color: var(--primary); }
.tool-card p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.footer { text-align: center; padding: 2rem; margin-top: auto; border-top: 1px solid var(--border); color: var(--text-muted); }
.footer-links { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }

.file-upload-zone { border: 2px dashed var(--border); padding: 1.5rem; text-align: center; border-radius: var(--radius); margin-bottom: 1rem; color: var(--text-muted); transition: border-color 0.2s; }
.file-upload-zone.dragover { border-color: var(--primary); background: rgba(37,99,235,0.05); }

.options-bar { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; align-items: center; }
.input-field { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); color: var(--text-main); }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.5rem; }

.diff-container { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
@media(min-width: 768px) { .diff-container { flex-direction: row; } .diff-pane { flex: 1; } }
.diff-pane label { display: block; font-weight: bold; margin-bottom: 0.5rem; }
.diff-output-box { min-height: 200px; padding: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; white-space: pre-wrap; font-family: monospace; }
.diff-add { background: #dcfce7; color: #166534; display: block; }
.diff-remove { background: #fee2e2; color: #991b1b; text-decoration: line-through; display: block; }
.dark-mode .diff-add { background: rgba(22,101,52,0.3); color: #4ade80; }
.dark-mode .diff-remove { background: rgba(153,27,27,0.3); color: #f87171; }

.text-warning { color: var(--warning); font-weight: bold; margin-top: 0.5rem; }
