/* === Quality Tools Hub - Shared Styles === */
:root {
  --primary: #1a56db;
  --primary-dark: #1242b0;
  --primary-light: #e8eefb;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --max-width: 960px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* Header */
header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 0;
}
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.logo span { color: var(--gray-500); font-weight: 400; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
nav a {
  font-size: 0.85rem;
  color: var(--gray-600);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
nav a:hover, nav a.active { background: var(--primary-light); color: var(--primary); }

/* Hero / Page Header */
.page-header {
  text-align: center;
  padding: 40px 20px 30px;
}
.page-header h1 {
  font-size: 1.8rem;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.page-header p {
  font-size: 1.05rem;
  color: var(--gray-500);
  max-width: 600px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.card h2 {
  font-size: 1.15rem;
  color: var(--gray-900);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full-width { grid-column: 1 / -1; }
label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}
label .unit { font-weight: 400; color: var(--gray-400); }
input[type="number"], input[type="text"], select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--gray-800);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
textarea { resize: vertical; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Results */
.results { display: none; }
.results.visible { display: block; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.result-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.result-item .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.result-item .label {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.result-item.highlight { border-color: var(--primary); background: var(--primary-light); }
.result-item.highlight .value { color: var(--primary); }
.result-item.good { border-color: var(--success); background: var(--success-light); }
.result-item.good .value { color: var(--success); }
.result-item.warn { border-color: var(--warning); background: var(--warning-light); }
.result-item.warn .value { color: var(--warning); }
.result-item.bad { border-color: var(--danger); background: var(--danger-light); }
.result-item.bad .value { color: var(--danger); }

/* Rating badge */
.rating {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.rating-world-class { background: var(--success-light); color: var(--success); }
.rating-good { background: #dbeafe; color: #1d4ed8; }
.rating-typical { background: var(--warning-light); color: var(--warning); }
.rating-needs-work { background: var(--danger-light); color: var(--danger); }

/* Interpretation box */
.interpretation {
  background: var(--gray-50);
  border-left: 4px solid var(--primary);
  padding: 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 16px;
  font-size: 0.9rem;
  line-height: 1.7;
}
.interpretation strong { color: var(--gray-900); }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { background: var(--gray-50); font-weight: 600; color: var(--gray-700); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
td { color: var(--gray-700); }
tr:last-child td { border-bottom: none; }

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, var(--primary-light), #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
  text-align: center;
}
.cta-section h3 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.cta-section p {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 16px;
}
.cta-section .btn { margin: 0 6px; }

/* Info section / SEO content */
.info-section {
  padding: 40px 0;
}
.info-section h2 {
  font-size: 1.3rem;
  color: var(--gray-900);
  margin-bottom: 12px;
}
.info-section h3 {
  font-size: 1.05rem;
  color: var(--gray-800);
  margin-top: 20px;
  margin-bottom: 8px;
}
.info-section p, .info-section li {
  font-size: 0.95rem;
  color: var(--gray-600);
  line-height: 1.7;
}
.info-section ul { padding-left: 20px; margin-top: 8px; }
.info-section li { margin-bottom: 4px; }

/* Footer */
footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 30px 0;
  margin-top: 60px;
  font-size: 0.85rem;
}
footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
footer a { color: var(--gray-300); text-decoration: none; }
footer a:hover { color: #fff; }
.footer-links { display: flex; gap: 16px; }

/* Chart container */
.chart-container {
  width: 100%;
  max-height: 400px;
  margin-top: 16px;
}

/* Tool grid (homepage) */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.tool-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.15s;
}
.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.tool-card h3 {
  font-size: 1.05rem;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.tool-card p {
  font-size: 0.88rem;
  color: var(--gray-500);
  line-height: 1.5;
}
.tool-card .tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  margin-top: 12px;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
  .page-header h1 { font-size: 1.4rem; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  header .container { flex-direction: column; align-items: flex-start; }
  nav { width: 100%; overflow-x: auto; }
}
