/* Natural Remedies Directory - Main Stylesheet */

:root {
  --bg: #fdfdfd;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --tag-bg: #f3f4f6;
  --header-bg: #1e293b;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #3b82f6;
  --primary-dark: #60a5fa;
  --tag-bg: #334155;
  --header-bg: #0f172a;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* Header & Navigation */
header {
  background: var(--header-bg);
  color: white;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

header nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

header .logo {
  color: white;
  font-weight: bold;
  font-size: 1.25rem;
  text-decoration: none;
}

header nav ul.menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

header nav ul.menu li a {
  color: #ffffff;
  text-decoration: none;
  background: rgba(255,255,255,0.1);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

header nav ul.menu li a:hover {
  background: var(--primary);
  color: #ffffff;
}

.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-box input {
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  width: 220px;
}

.search-box input::placeholder { color: var(--muted); }

/* Main content */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; border-bottom: 2px solid var(--border); padding-bottom: 0.35rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; color: var(--text); }
h4 { font-size: 1rem; margin: 0.75rem 0 0.35rem; color: var(--text); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }

.tag {
  background: var(--tag-bg);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.tag.evidence-grade-a { background: #d1fae5; color: #065f46; }
.tag.evidence-grade-b { background: #fef3c7; color: #92400e; }
.tag.evidence-grade-c { background: #ffedd5; color: #9a3412; }
.tag.evidence-grade-d { background: #fed7aa; color: #9a3412; }
.tag.evidence-grade-e { background: #fed7aa; color: #9a3412; }
.tag.evidence-grade-f { background: #fecaca; color: #991b1b; }
.tag.evidence-testimonial { background: #f3e8fd; color: #6b21a8; }
.tag.evidence-peer_reviewed { background: #dbeafe; color: #1e3a8a; }
.tag.evidence-scientific { background: #d1fae5; color: #047857; }
.tag.evidence-opinion { background: #ffedd5; color: #9a3412; }
.tag.evidence-traditional { background: #f5f3f4; color: #5b5b60; }

/* Sections */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.field-label { font-weight: 600; color: var(--text); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.card h4 { margin-top: 0; }

.card .card-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card .card-actions a {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
}

.card .card-actions a:hover { text-decoration: underline; }

/* Lists */
ul { margin: 0.5rem 0; padding-left: 1.25rem; }
li { margin: 0.25rem 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Collection filters */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.filter-bar h4 { margin: 0; font-size: 0.95rem; }

.tag.filter-tag { cursor: pointer; }
.tag.filter-tag:hover { background: var(--tag-bg); opacity: 0.8; }
.tag.filter-tag.active { background: var(--primary); color: white; }

/* Stats / category grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

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

.stat-card .count { font-size: 2rem; font-weight: bold; color: var(--primary); }
.stat-card .label { color: var(--muted); font-size: 0.9rem; }
.stat-card a { text-decoration: none; }

/* Connection grid: ailment -> remedies */
.connection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.connection-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.connection-card .ailment-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.connection-card .ailment-title a { color: var(--text); }
.connection-card .ailment-title a:hover { color: var(--primary); }

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* Table */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
table th, table td { padding: 0.6rem; border: 1px solid var(--border); text-align: left; }
table th { background: var(--tag-bg); }

/* Responsive */
@media (max-width: 768px) {
  header nav { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  header nav ul.menu { width: 100%; }
  .search-box input { width: 100%; }
  main { padding: 1rem; }
  .connection-grid { grid-template-columns: 1fr; }
}

/* Search results */
#search-results li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
#search-results li:last-child { border-bottom: none; }
