:root {
  --bg-color: #0b0f19;
  --card-bg: #111827;
  --card-header: #1e293b;
  --border-color: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --view-btn-bg: #0284c7;
  --view-btn-hover: #0369a1;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  padding: 2rem 1.5rem;
}

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

/* Header & Controls */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.title-group h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: #ffffff;
}

.title-group p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.title-group a {
  color: var(--accent);
  text-decoration: none;
}

.title-group a:hover {
  text-decoration: underline;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-input {
  width: 320px;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.row-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Responsive Table Wrapper (modern web guidance: responsive-table) */
.table-wrapper {
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 180px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.95rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  background: var(--card-header);
  color: #f1f5f9;
  padding: 0.85rem 1rem;
  font-weight: 600;
  border-bottom: 2px solid #334155;
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Molecule Structure Thumbnail */
.mol-thumb {
  width: 110px;
  height: 80px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 6px;
  padding: 4px;
  display: block;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mol-thumb:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px var(--accent);
}

/* SMILES Code Button */
.smiles-copy {
  display: inline-block;
  background: #0f172a;
  color: var(--accent);
  border: 1px solid #334155;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  cursor: pointer;
  word-break: break-all;
  user-select: all;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.smiles-copy:hover {
  background: #1e293b;
  border-color: var(--accent);
}

.smiles-copy.copied {
  background: #065f46;
  border-color: #10b981;
  color: #ecfdf5;
}

/* View 3D Button */
.view-btn {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  background: var(--view-btn-bg);
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease;
}

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

/* Notes Column */
.notes-cell {
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 380px;
}

/* Floating Image Popover */
.img-preview-popover {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  background: #ffffff;
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  display: none;
}

.img-preview-popover img {
  max-width: 320px;
  max-height: 240px;
  display: block;
  object-fit: contain;
}

