/* ─── Categories ─── */
.category + .category {
  border-top: 1px solid var(--border-color);
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.category-header:hover {
  background: var(--bg-tertiary);
}

.category-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.125rem 0.5rem;
  border-radius: 99px;
}

.category-tools {
  display: flex;
  flex-direction: column;
}

.tool-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.5rem 1.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.tool-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tool-link.active {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--accent);
}

.tool-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

/* ─── Tool Container ─── */
.tool-container {
  max-width: 900px;
  margin: 0 auto;
}

.tool-header {
  margin-bottom: 1.5rem;
}

.tool-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-header p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-size: 0.9375rem;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-tertiary);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 0.5rem;
  line-height: 1;
}

/* ─── Inputs ─── */
.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--accent);
}

textarea.input {
  min-height: 120px;
  line-height: 1.6;
  font-family: var(--font-mono);
  resize: vertical;
}

select.input {
  cursor: pointer;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  align-items: start;
}

.input-group .input {
  flex: 1;
}

/* ─── Cards ─── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card + .card {
  margin-top: 1rem;
}

.card-header {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ─── Toolbar ─── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.toolbar .btn {
  font-size: 0.8125rem;
  padding: 0.375rem 0.625rem;
}

/* ─── Result ─── */
.result-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow: auto;
}

.result-box .label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.stat-card {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: flex;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 20;
    box-shadow: var(--shadow-lg);
  }
}
