@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  color-scheme: light;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  --bg: #f7f2ea;
  --card: #fffaf3;
  --text: #1f1a16;
  --muted: #6f6259;
  --accent: #e4572e;
  --accent-2: #2d5b5f;
  --border: #e6d7c7;
  --shadow: rgba(34, 22, 12, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(228, 87, 46, 0.08), transparent 60%),
    radial-gradient(circle at 80% 0%, rgba(45, 91, 95, 0.12), transparent 45%),
    var(--bg);
  color: var(--text);
}

.hero {
  background: linear-gradient(120deg, rgba(255, 248, 235, 0.9), rgba(255, 255, 255, 0.7)),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.02) 0, rgba(0, 0, 0, 0.02) 1px, transparent 1px, transparent 6px);
  padding: 44px 20px 32px;
  border-bottom: 1px solid var(--border);
}

.hero__content {
  max-width: 1200px;
  margin: 0 auto;
}

.hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: -0.02em;
}

.focus-toggle {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 20px var(--shadow);
}

.focus-toggle:hover {
  background: #fff6ea;
}

p {
  margin: 0 0 18px;
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
  background: rgba(255, 255, 255, 0.7);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px var(--shadow);
}

.file-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(228, 87, 46, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.file-input:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(228, 87, 46, 0.3);
}

.file-input input {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.field select,
.field input {
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.field select[multiple] {
  min-height: 120px;
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.9), rgba(255, 255, 255, 0.9));
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

body.is-table-focus .hero {
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(4px);
}

body.is-table-focus .hero p,
body.is-table-focus .hero .controls {
  display: none;
}

body.is-table-focus .status {
  margin-top: 6px;
  margin-bottom: 0;
}

body.is-table-focus .content {
  height: calc(100vh - 88px) !important;
  padding-top: 10px;
}

.content {
  margin: 0;
  padding: 0 20px 20px;
  height: calc(100vh - 200px);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

@media (min-height: 800px) {
  .content {
    height: calc(100vh - 240px);
  }
}

.table-wrap {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 18px 34px var(--shadow);
  border: 1px solid var(--border);
  overflow: auto;
  flex: 1;
  width: 100%;
}

/* Remove sidebar styles as it's been consolidated into the hero */

.table-wrap {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 18px 34px var(--shadow);
  border: 1px solid var(--border);
  overflow: auto;
  flex: 1 1 auto;
}

.pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px var(--shadow);
}

.pagination button {
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  background: #fff5eb;
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination__field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.pagination__field select,
.pagination__field input {
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 8px;
  font-size: 0.82rem;
  padding: 6px 8px;
}

.pagination__field select {
  min-width: 74px;
}

.pagination__field input {
  width: 78px;
}

.pagination__jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pagination__jump button {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.pagination__info {
  font-size: 0.84rem;
  color: var(--muted);
  padding: 0 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

/* make the table container fill available space and be keyboard-focusable */
.table-wrap:focus {
  outline: 2px solid rgba(45, 91, 95, 0.18);
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
  /* Ensure long text doesn't break layout */
  font-size: 0.9rem;
}

.html-cell {
  min-width: 320px;
}

.cell-content--html {
  word-break: break-word;
}

.cell-content--html.is-collapsed {
  max-height: 136px;
  overflow: hidden;
  position: relative;
}

.cell-content--html.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  background: linear-gradient(to bottom, rgba(255, 250, 243, 0), rgba(255, 250, 243, 1));
}

.cell-expand-btn {
  margin-top: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent-2);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
}

.cell-expand-btn:hover {
  background: #f0f8f8;
}

.virtual-spacer-row td {
  padding: 0;
  border: 0;
  background: transparent;
}

.virtual-spacer-cell {
  height: 0;
  line-height: 0;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  position: sticky;
  top: 0;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  border-bottom: 2px solid var(--border);
}

tr:hover td {
  background: #fdfaf6;
}

tbody tr:hover {
  background: rgba(228, 87, 46, 0.06);
}

.image-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.thumb {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: #f3ece2;
}

.thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 16px 26px rgba(34, 22, 12, 0.18);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

/* Dropdown Menu Styles */
.dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

.dropdown__toggle {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 0.85rem;
}

.dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px var(--shadow);
  padding: 10px;
  margin-top: 4px;
}

.dropdown__menu.is-open {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: #fff6ea;
}

.dropdown-item input {
  accent-color: var(--accent);
  min-width: auto;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  box-shadow: none;
  flex: 0 0 auto;
}

.dropdown-item span {
  font-size: 0.85rem;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom Scrollbars */
.table-wrap::-webkit-scrollbar,
.dropdown__menu::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  border: 3px solid transparent;
  background-clip: content-box;
}

.modal__content {
  position: relative;
  z-index: 1;
  background: white;
  padding: 20px;
  border-radius: 18px;
  max-width: min(95vw, 1200px);
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.modal__content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 10px;
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: #1f1a16;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .pagination {
    justify-content: center;
  }

  .pagination__info {
    width: 100%;
    text-align: center;
    order: -1;
  }

  .hero__top {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .focus-toggle {
    width: 100%;
  }
}
