:root {
  --primary: #c0392b;
  --primary-dark: #96281b;
  --accent: #e74c3c;
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --text: #2c3e50;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ───── HEADER ───── */
.site-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #c0392b 100%);
  color: white;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 10px rgba(255,100,0,0.8));
  animation: flicker 3s infinite alternate;
}

@keyframes flicker {
  0% { filter: drop-shadow(0 0 8px rgba(255,100,0,0.8)); }
  50% { filter: drop-shadow(0 0 16px rgba(255,150,0,1)); }
  100% { filter: drop-shadow(0 0 8px rgba(255,80,0,0.7)); }
}

.site-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: white;
}

.site-subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 2px;
  color: #ffd0cc;
}

.lang-switcher {
  display: flex;
  gap: 6px;
}

.lang-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  font-family: var(--font);
}

.lang-btn:hover { background: rgba(255,255,255,0.25); }
.lang-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
  border-color: white;
}

/* ───── ABOUT ───── */
.about-section {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  color: white;
  padding: 50px 0;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.about-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.2s, background 0.2s;
}

.about-card:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

.about-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.about-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #ffd0cc;
}

.about-card p {
  font-size: 0.9rem;
  line-height: 1.7;
  opacity: 0.9;
}

/* ───── CATEGORIES ───── */
.categories-section {
  padding: 50px 0;
  background: var(--bg);
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.cat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  border-left: 4px solid var(--cat-color, #ccc);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.cat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.cat-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.cat-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.cat-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ───── SEARCH ───── */
.search-section {
  padding: 40px 0 60px;
  background: #f0f2f5;
}

.search-bar-wrapper {
  margin-bottom: 18px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 30px;
  border: 2px solid var(--border);
  padding: 6px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 700px;
}

.search-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(192,57,43,0.1);
}

.search-icon {
  font-size: 1.1rem;
  margin-right: 10px;
  opacity: 0.6;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  padding: 6px 0;
}

.search-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.search-clear:hover {
  background: #f0f0f0;
  color: var(--text);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--fc, var(--border));
  background: white;
  color: var(--fc, var(--text));
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.filter-btn:hover {
  background: var(--fc, #f0f0f0);
  color: white;
  border-color: var(--fc, #ccc);
}

.filter-btn.active {
  background: var(--fc, var(--primary));
  color: white;
  border-color: var(--fc, var(--primary));
}

.filter-btn[data-cat="ALL"] { --fc: var(--primary); }

.filter-count {
  background: rgba(255,255,255,0.3);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 0.75rem;
  min-width: 20px;
  text-align: center;
}

.filter-btn.active .filter-count {
  background: rgba(255,255,255,0.3);
}

.filter-btn:not(.active) .filter-count {
  background: rgba(0,0,0,0.08);
  color: var(--text-muted);
}

.results-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  min-height: 20px;
}

/* ───── TABLE ───── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: white;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead {
  background: linear-gradient(135deg, #1a1a2e, #c0392b);
  color: white;
  position: sticky;
  top: 72px;
  z-index: 10;
}

.data-table th {
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
  transition: background 0.2s;
}

.data-table th.sortable:hover {
  background: rgba(255,255,255,0.12);
}

.sort-icon {
  opacity: 0.5;
  font-size: 0.8rem;
}

.sort-asc .sort-icon, .sort-desc .sort-icon {
  opacity: 1;
}

.data-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: #fff5f5;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table td {
  padding: 11px 12px;
  vertical-align: middle;
}

.td-num {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  width: 40px;
}

.td-name {
  font-weight: 600;
  color: var(--text);
  min-width: 160px;
}

.td-name small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.td-formula {
  font-family: 'Courier New', monospace;
  color: #1565c0;
  font-size: 0.85rem;
}

.td-val {
  text-align: right;
  white-space: nowrap;
  color: var(--text);
}

.td-cat {
  text-align: center;
}

.badge-cat {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.highlight {
  background: #fff3cd;
  border-radius: 3px;
  padding: 0 2px;
}

.no-results {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ───── MODAL ───── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: white;
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: #f0f0f0;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover { background: #e0e0e0; }

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.modal-props {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.prop-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  border-left: 3px solid var(--primary);
}

.prop-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.prop-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.prop-unit {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.modal-antoine {
  background: #f0f4ff;
  border-radius: 8px;
  padding: 14px;
  margin-top: 8px;
}

.modal-antoine h4 {
  font-size: 0.85rem;
  color: #1565c0;
  margin-bottom: 8px;
}

.modal-antoine code {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

/* ───── SOURCES ───── */
.sources-section {
  padding: 50px 0;
  background: white;
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.source-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  border-left: 4px solid var(--border);
}

.source-card.primary-source {
  border-left-color: var(--primary);
  background: linear-gradient(135deg, #fff5f5, #ffe0e0);
}

.source-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.source-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.source-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.source-ref {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 8px;
}

.source-note {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.source-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.source-links {
  list-style: none;
  padding: 0;
}

.source-links li {
  margin-bottom: 8px;
}

.source-links a {
  font-size: 0.88rem;
  color: var(--primary);
  transition: opacity 0.2s;
}

.source-links a:hover { opacity: 0.75; }

/* ───── FOOTER ───── */
.site-footer {
  background: #1a1a2e;
  color: rgba(255,255,255,0.8);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-left p, .footer-right p {
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer-disclaimer {
  font-size: 0.78rem !important;
  opacity: 0.6;
  margin-top: 4px;
}

.footer-link {
  color: #ffd0cc;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ───── RESPONSIVE ───── */
@media (max-width: 768px) {
  .site-title { font-size: 1.2rem; }
  .header-icon { font-size: 1.8rem; }
  .about-grid { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .th-dens, .th-molmass { display: none; }
}

@media (max-width: 480px) {
  .categories-grid { grid-template-columns: 1fr; }
  .th-ufl, .th-heat { display: none; }
}
