@font-face {
  font-family: 'Adobe Jenson Pro';
  src: url('./fonts/AJensonPro-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
}

body {
  font-family: 'Adobe Jenson Pro', 'Crimson Text', 'Times New Roman', serif;
  color: #ffffff;
}

.admin-body {
  background: #120a1f;
  min-height: 100vh;
}

.container {
  width: min(1200px, 94vw);
}

.admin-grid {
  padding-bottom: 2rem;
}

.admin-grid > section {
  margin-bottom: 1.2rem;
}

input,
textarea,
select,
button {
  font-family: 'Adobe Jenson Pro', 'Crimson Text', 'Times New Roman', serif;
  font-size: 1rem;
}

input,
textarea,
select {
  border: 1px solid #4c76c8;
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: #19152a;
  color: #ffffff;
}

input::placeholder,
textarea::placeholder {
  color: #b8b4ff;
}

button {
  border: 1px solid #b8b4ff;
  border-radius: 12px;
  background: linear-gradient(135deg, #3732ad 0%, #4c76c8 100%);
  color: #ffffff;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  background: linear-gradient(135deg, #4c76c8 0%, #6b8dd6 100%);
  transform: translateY(-1px);
}

.clear-search-button {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
}

.clear-search-button.visible {
  display: inline-flex;
}

.clear-search-button:hover {
  transform: translateY(-50%);
}

.search-results-block {
  max-width: 980px;
  margin: 0 auto 2rem;
}

.search-results-list {
  background: #1a1525;
  border: 1px solid #3732ad;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}

.search-results-list li {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(55, 50, 173, 0.3);
  border-radius: 0;
  text-align: left;
}

.search-results-list li:last-child {
  border-bottom: none;
}

.search-results-list a,
.work-list a,
.category-sidebar a,
.tab,
.back-link {
  color: #d7e2ff;
}

.card,
.auth-box,
.category-sidebar,
.works-layout > div > section,
.works-layout > div > details,
.works-layout > div > .card-list > .card,
.works-layout > aside {
  background: linear-gradient(135deg, #2a2540 0%, #1f1a2e 100%);
  border: 1px solid #3732ad;
  border-radius: 12px;
  color: #ffffff;
}

.auth-box,
.card {
  box-shadow: 0 6px 20px rgba(55, 50, 173, 0.2);
}

.admin-grid header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(107, 141, 214, 0.35);
}

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

.entry-card > .row-actions {
  width: 100%;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.entry-card details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.35rem;
}

.entry-summary-main {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  text-align: left;
  padding-left: 20px;
}

.entry-dropdown-arrow {
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1;
}

.entry-card details[open] .entry-dropdown-arrow {
  transform: rotate(180deg);
}

.row-actions-inline {
  margin: 0;
  flex-wrap: nowrap;
  align-items: center;
}

.row-actions-inline form {
  margin: 0;
}

.row-actions-inline button {
  min-width: 2.1rem;
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.row-actions-inline button:hover {
  transform: none;
}

.danger {
  background: linear-gradient(135deg, #7a1f3b 0%, #b91c1c 100%);
}

.save-success {
  background: linear-gradient(135deg, #1a6b3a 0%, #22c55e 100%) !important;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}

.display-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

.display-order-header h3 {
  margin: 0;
}

.display-order-header form {
  margin: 0;
}

.admin-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.admin-category-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: linear-gradient(135deg, #2a2540 0%, #1f1a2e 100%);
  border: 2px solid #3732ad;
  border-radius: 16px;
  box-shadow: 0 8px 16px rgba(55, 50, 173, 0.2);
  transition: all 0.25s ease;
  aspect-ratio: auto;
  min-height: 280px;
  padding: 1rem 0.9rem;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
}

.admin-category-card:hover {
  border-color: #b8b4ff;
  box-shadow: 0 10px 30px rgba(124, 119, 255, 0.32);
}

.admin-category-card .category-image {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 0 auto 0.55rem;
}

.admin-category-card .category-name {
  margin: 0.2rem 0;
  font-size: 1.15rem;
}

.admin-category-card .category-count {
  margin: 0;
  color: #b8b4ff;
  font-size: 0.95rem;
}

.category-visibility-row {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.homepage-visibility-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}

.homepage-visibility-pill.is-visible {
  color: #d4ffeb;
  border-color: rgba(46, 204, 113, 0.65);
  background: rgba(39, 174, 96, 0.25);
}

.homepage-visibility-pill.is-hidden {
  color: #ffe1e1;
  border-color: rgba(231, 76, 60, 0.75);
  background: rgba(192, 57, 43, 0.25);
}

.inline-form {
  margin: 0;
  width: 100%;
}

.visibility-toggle-button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.45rem 0.65rem;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  transition: all 0.2s ease;
}

.visibility-toggle-button.hide {
  background: linear-gradient(135deg, #b23a48 0%, #c0392b 100%);
  border-color: rgba(255, 180, 173, 0.45);
}

.visibility-toggle-button.show {
  background: linear-gradient(135deg, #1f8f55 0%, #27ae60 100%);
  border-color: rgba(180, 255, 210, 0.45);
}

.visibility-toggle-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.admin-category-card details {
  width: 100%;
  margin-top: 0.8rem;
}

.admin-category-card .card-bottom-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  width: 100%;
}

.admin-category-card .card-bottom-actions button {
  flex: 1;
  min-width: 0;
}

.admin-category-card .stack-form {
  width: 100%;
}

.admin-category-card .stack-form input,
.admin-category-card .stack-form textarea,
.admin-category-card .stack-form select,
.admin-category-card .stack-form button {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-category-card .stack-form textarea {
  resize: vertical;
  min-height: 90px;
}

.admin-category-card details > summary {
  background: rgba(25, 21, 42, 0.45);
  border: 1px solid rgba(107, 141, 214, 0.3);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
}

.admin-card-info-enabled {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #b8b4ff;
}

.muted-note {
  color: #b8b4ff;
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

.stack-form {
  display: grid;
  gap: 0.55rem;
}

.tab {
  background: #1f1a2e;
  border: 1px solid #4c76c8;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
}

.tab.active {
  background: linear-gradient(135deg, #3732ad 0%, #4c76c8 100%);
  color: #ffffff;
}

.card-list {
  display: grid;
  gap: 0.75rem;
}

.draggable {
  cursor: grab;
}

.draggable.dragging {
  opacity: 0.7;
  border-color: #7c77ff;
}

.works-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1rem;
  align-items: start;
}

.category-sidebar {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  padding: 1rem;
  align-self: start;
  height: fit-content;
}

.works-layout > div button {
  text-align: left;
  justify-content: flex-start;
  padding-left: 20px;
  padding-right: 1.05rem;
}

.works-layout > div .row-actions-inline button {
  text-align: center;
  justify-content: center;
  padding-left: 0;
}

.category-sidebar h3 {
  margin: 0 0 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(107, 141, 214, 0.45);
}

.category-link {
  text-decoration: none;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
}

.category-link.active {
  background: rgba(76, 118, 200, 0.35);
  border: 1px solid #6b8dd6;
  font-weight: 600;
}

details > summary {
  cursor: pointer;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.works-layout > div > details > summary {
  text-align: left;
  display: flex;
  align-items: center;
  min-height: 2.35rem;
}

.works-layout > div > details.works-create-block > summary {
  padding-left: 20px;
}

.works-layout > div > details > .stack-form {
  width: min(100%, 680px);
  max-width: 680px;
}

.works-layout > div > details + details {
  margin-top: 0.55rem;
}

details .stack-form {
  margin-top: 0.5rem;
}

.upload-form {
  margin-top: 0.75rem;
}

/* ── Add Category block ─────────────────────────────────────── */
.add-category-block {
  display: inline-block;
}

.add-category-block > summary {
  list-style: none;
  cursor: pointer;
}

.add-category-block > summary::-webkit-details-marker {
  display: none;
}

.add-category-summary-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #3732ad 0%, #4c76c8 100%);
  border: 1px solid #b8b4ff;
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  color: #fff;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(55, 50, 173, 0.35);
}

.add-category-block > summary:hover .add-category-summary-inner {
  background: linear-gradient(135deg, #4c76c8 0%, #6b8dd6 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(76, 118, 200, 0.45);
}

.add-category-block[open] > summary .add-category-summary-inner {
  background: linear-gradient(135deg, #251f3b 0%, #2a2540 100%);
  border-color: #7c77ff;
}

.add-category-block > .card {
  margin-top: 0.75rem;
  padding: 1rem;
  width: min(100%, 520px);
}

/* ── Admin section title with decorative underline ──────────── */
.admin-section-title {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.55rem;
}

.admin-section-title::after {
  content: '';
  display: block;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, #7c77ff 0%, #4c76c8 60%, transparent 100%);
  border-radius: 2px;
}

.admin-section-title-sub {
  font-size: 0.82rem;
  font-weight: 400;
  color: #b8b4ff;
  letter-spacing: 0.3px;
}

.entry-card.entry-section {
  border: 1px solid #7c77ff;
  background: linear-gradient(135deg, #322c52 0%, #251f3b 100%);
  box-shadow: inset 0 0 0 1px rgba(124, 119, 255, 0.25);
}

.entry-card.entry-work {
  border: 1px solid #3732ad;
}

.entry-kind-label {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(124, 119, 255, 0.25);
  border: 1px solid rgba(184, 180, 255, 0.45);
  color: #d8d5ff;
  font-size: 0.82rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  color: #b8b4ff;
  cursor: grab;
  user-select: none;
  touch-action: none; /* prevents browser scroll-takeover that fires pointercancel */
  font-size: 0.95rem;
  letter-spacing: -1px;
}


/* Timeline admin — bulk category enable/color editor */
.tl-cat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
}

.tl-cat-name {
  flex: 1;
}

.tl-cat-enabled {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.tl-color-swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #444;
  vertical-align: middle;
}

.tl-color-input {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

@media (max-width: 900px) {
  .admin-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .works-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .admin-category-grid {
    grid-template-columns: 1fr;
  }
}

.curriculum-editor-tools {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.6rem;
  border: 1px solid rgba(130, 146, 195, 0.25);
  border-radius: 0.65rem;
  background: rgba(9, 14, 30, 0.45);
}

.curriculum-works-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.curriculum-work-row-admin {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem;
  border: 1px solid rgba(145, 161, 214, 0.22);
  border-radius: 0.55rem;
  background: rgba(5, 9, 22, 0.42);
}

.curriculum-work-row-admin textarea {
  grid-column: 1 / span 2;
  min-height: 72px;
}

.curriculum-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  align-content: start;
  min-width: 6rem;
}

.curriculum-row-actions .curriculum-move-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
}

.curriculum-row-actions .curriculum-move-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.curriculum-row-actions button[data-curriculum-remove-row] {
  grid-column: 1 / span 2;
}

@media (max-width: 860px) {
  .curriculum-work-row-admin {
    grid-template-columns: 1fr;
  }

  .curriculum-work-row-admin textarea {
    grid-column: 1;
  }

  .curriculum-row-actions {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }
}

.curriculum-admin-layout {
  display: grid;
  gap: 1rem;
}

.curriculum-admin-panel {
  padding: 0.9rem;
}

.curriculum-admin-panel__summary {
  cursor: pointer;
  list-style: none;
}

.curriculum-admin-panel__summary::-webkit-details-marker {
  display: none;
}

.curriculum-admin-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.curriculum-admin-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.curriculum-admin-builder {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(146, 168, 221, 0.28);
  background: rgba(14, 18, 35, 0.5);
}

.curriculum-admin-builder__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
