
/* ============================================================
   X-PEN ID Search Page - uses global root tokens where available
   ============================================================ */
   
.xpen-search-main {
  min-height: calc(100vh - 160px);
  padding: 38px 18px 60px;
}

.search-page-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.search-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl, 20px);
  background:
    radial-gradient(circle at 12% 0%, rgba(27,165,163,0.14), transparent 42%),
    radial-gradient(circle at 88% 110%, rgba(212,162,76,0.12), transparent 45%),
    linear-gradient(135deg, #ffffff, var(--surface-2, #fafcfc));
  border: 1px solid var(--border, #e4ecef);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(11,31,42,0.08));
  padding: 34px;
  margin-bottom: 22px;
}

.search-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(27,165,163,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27,165,163,0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.55;
  pointer-events: none;
}

.search-hero-content {
  position: relative;
  z-index: 1;
}

.search-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-full, 999px);
  background: var(--teal-50, #effcfb);
  border: 1px solid var(--teal-200, #a3ebe7);
  color: var(--teal-800, #155556);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.search-hero h1 {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(32px, 5vw, 57px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink-900, #0b1f2a);
  margin: 0;
}

.search-hero h1 span {
  color: var(--teal-700, #156b6b);
}

.search-hero p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--ink-600, #3d5566);
  font-size: 16px;
}

.search-panel {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  padding: 14px;
  border-radius: var(--r-lg, 14px);
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--border, #e4ecef);
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(11,31,42,0.06));
}

.search-form-row {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: 10px;
  align-items: center;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-500, #5a7383);
  font-size: 14px;
}

.search-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  border-radius: var(--r-md, 10px);
  border: 1px solid var(--border-strong, #cbd8de);
  background: #fff;
  color: var(--ink-900, #0b1f2a);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 15px;
  outline: none;
  transition: all .18s ease;
}

.search-input-wrap input:focus {
  border-color: var(--teal-500, #1ba5a3);
  box-shadow: 0 0 0 4px rgba(27,165,163,0.12);
}

.search-select {
  height: 48px;
  border-radius: var(--r-md, 10px);
  border: 1px solid var(--border-strong, #cbd8de);
  background: #fff;
  color: var(--ink-800, #010f17);
  padding: 0 12px;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 14px;
  outline: none;
}

.search-advanced-btn {
  height: 48px;
  border-radius: var(--r-md, 10px);
  border: 1px solid var(--teal-300, #6bdad4);
  background: var(--teal-50, #effcfb);
  color: var(--teal-800, #155556);
  font-weight: 800;
  font-family: var(--font-body, system-ui, sans-serif);
  padding: 0 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s ease;
}

.search-advanced-btn:hover {
  background: var(--teal-100, #d0f5f2);
  border-color: var(--teal-500, #1ba5a3);
}

.search-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink-500, #5a7383);
  font-size: 13px;
}



.search-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.search-block {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e4ecef);
  border-radius: var(--r-xl, 20px);
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(11,31,42,0.06));
  overflow: hidden;
}

.search-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border, #e4ecef);
  background: linear-gradient(180deg, #fff, var(--surface-2, #fafcfc));
}

.search-block-head h2 {
  font-family: var(--font-display, Georgia, serif);
  font-size: 22px;
  color: var(--ink-900, #0b1f2a);
}

.search-status {
  color: var(--ink-500, #5a7383);
  font-size: 13px;
  font-weight: 700;
}

.search-results-inner,
.feed-results-inner {
  padding: 16px;
}

#search-results:empty {
  display: none;
}

#feed-container:empty {
  display: none;
}

.search-empty {
  padding: 26px;
  text-align: center;
  color: var(--ink-500, #5a7383);
  border: 1px dashed var(--border-strong, #cbd8de);
  border-radius: var(--r-lg, 14px);
  background: var(--ink-50, #f7fafb);
}

.search-loader {
  padding: 22px;
  color: var(--teal-700, #156b6b);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-loader::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--teal-200, #a3ebe7);
  border-top-color: var(--teal-600, #158785);
  animation: xpenSpin .8s linear infinite;
}

@keyframes xpenSpin {
  to { transform: rotate(360deg); }
}

.search-error {
  padding: 14px 16px;
  border-radius: var(--r-md, 10px);
  background: #fff1f1;
  border: 1px solid #ffd3d3;
  color: #9b1c1c;
  font-size: 13px;
  font-weight: 700;
}

.search-feed-actions {
  display: flex;
  justify-content: center;
  padding: 0 16px 18px;
}

.load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 138px;
  min-height: 42px;
  border-radius: var(--r-md, 10px);
  background: linear-gradient(180deg, var(--teal-500, #1ba5a3), var(--teal-600, #158785));
  color: #fff;
  border: none;
  font-family: var(--font-body, system-ui, sans-serif);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-teal, 0 8px 24px rgba(27,165,163,0.22));
  transition: all .18s ease;
}

.load-more:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(27,165,163,0.30);
}

/* Returned feed cards */
.feed-item {
  background: linear-gradient(180deg, #fff, var(--surface-2, #fafcfc)) !important;
  border: 1px solid var(--border, #e4ecef);
  border-radius: var(--r-lg, 14px);
  padding: 18px;
  margin-bottom: 14px;
  color: var(--ink-800, #010f17);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(11,31,42,0.04));
}

.feed-text h3,
.feed-text h3 a {
  color: var(--ink-900, #0b1f2a) !important;
}

.feed-text .tag {
  display: inline-flex;
  border-radius: var(--r-full, 999px);
  background: var(--teal-50, #effcfb);
  color: var(--teal-800, #155556);
  border: 1px solid var(--teal-200, #a3ebe7);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.feed-text .meta,
.feed-text .abstract {
  color: var(--ink-600, #3d5566) !important;
}

.feed-tags span {
  display: inline-flex;
  border-radius: var(--r-full, 999px);
  background: var(--ink-50, #f7fafb);
  color: var(--ink-600, #3d5566);
  border: 1px solid var(--border, #e4ecef);
  padding: 4px 9px;
  margin: 3px 3px 0 0;
  font-size: 12px;
}

.like-btn,
.share-btn {
  color: var(--ink-600, #3d5566) !important;
}

@media (max-width: 760px) {
  .xpen-search-main {
    padding: 22px 12px 42px;
  }

  .search-hero {
    padding: 24px 16px;
    border-radius: var(--r-lg, 14px);
  }

  .search-form-row {
    grid-template-columns: 1fr;
  }

  .search-select,
  .search-advanced-btn {
    width: 100%;
  }

  .search-meta-row {
    align-items: flex-start;
  }

  .search-block-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   X-PEN ID Live Search Result Cards
   For /search/fetch_results.php output
   ============================================================ */

.xpen-live-results {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.result-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 12px;
  border-radius: var(--r-full, 999px);
  background: linear-gradient(180deg, var(--teal-50, #effcfb), #fff);
  border: 1px solid var(--teal-200, #a3ebe7);
  color: var(--teal-800, #155556);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.result-group-title i {
  color: var(--teal-600, #158785);
  font-size: 13px;
}

/* Main Card */
.xpen-result-card {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 18px;
  border-radius: var(--r-xl, 20px);
  background:
    radial-gradient(circle at 0% 0%, rgba(27,165,163,0.08), transparent 34%),
    linear-gradient(180deg, #ffffff, var(--surface-2, #fafcfc));
  border: 1px solid var(--border, #e4ecef);
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(11,31,42,0.06));
  color: var(--ink-800, #010f17);
  overflow: hidden;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.xpen-result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--teal-400, #36c1bd), var(--teal-700, #156b6b));
  opacity: .85;
}

.xpen-result-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal-300, #6bdad4);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(11,31,42,0.08));
}

/* Author Card */
.xpen-author-card {
  align-items: flex-start;
}

.result-avatar {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--teal-400, #36c1bd), var(--gold, #d4a24c));
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(11,31,42,0.04));
}

.result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--ink-50, #f7fafb);
}

/* Work Cards */
.xpen-work-card {
  align-items: flex-start;
}

.result-icon {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(11,31,42,0.04));
}

.result-icon.article {
  background: linear-gradient(135deg, var(--teal-50, #effcfb), var(--teal-100, #d0f5f2));
  color: var(--teal-700, #156b6b);
  border: 1px solid var(--teal-200, #a3ebe7);
}

.result-icon.book {
  background: linear-gradient(135deg, #fff8eb, #fff);
  color: #9b6b20;
  border: 1px solid rgba(212,162,76,0.35);
}

/* Body */
.result-body {
  flex: 1;
  min-width: 0;
}

.result-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.result-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--r-full, 999px);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
}

.result-type-pill.author {
  background: var(--teal-50, #effcfb);
  color: var(--teal-800, #155556);
  border: 1px solid var(--teal-200, #a3ebe7);
}

.result-type-pill.article {
  background: var(--teal-50, #effcfb);
  color: var(--teal-800, #155556);
  border: 1px solid var(--teal-200, #a3ebe7);
}

.result-type-pill.book {
  background: #fff8eb;
  color: #8a5d16;
  border: 1px solid rgba(212,162,76,0.35);
}

.result-id,
.result-date {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: var(--r-full, 999px);
  background: var(--ink-50, #f7fafb);
  border: 1px solid var(--border, #e4ecef);
  color: var(--ink-500, #5a7383);
  font-size: 11.5px;
  font-weight: 750;
}

.result-title {
  margin: 0;
  color: var(--ink-900, #0b1f2a);
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.result-title a {
  color: var(--ink-900, #0b1f2a);
  text-decoration: none;
  transition: color .15s ease;
}

.result-title a:hover {
  color: var(--teal-700, #156b6b);
}

.verify-dot {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
  color: var(--teal-600, #158785);
  font-size: 15px;
}

.result-mini-icon {
  display: inline-block;
  width: 17px;
  height: 17px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 6px;
}

.result-subtitle,
.result-subtitle-inline {
  color: var(--ink-600, #3d5566);
  font-size: 14px;
  font-weight: 600;
}

.result-subtitle {
  margin-top: 4px;
}

/* Authors */
.result-authors {
  margin-top: 8px;
  color: var(--ink-700, #2d4352);
  font-size: 13.5px;
  line-height: 1.55;
  font-weight: 650;
}

.result-authors a {
  color: var(--teal-700, #156b6b);
  font-weight: 800;
  text-decoration: none;
}

.result-authors a:hover {
  color: var(--teal-600, #158785);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.role-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  margin-right: 5px;
  padding: 2px 7px;
  border-radius: var(--r-full, 999px);
  background: var(--ink-50, #f7fafb);
  border: 1px solid var(--border, #e4ecef);
  color: var(--ink-500, #5a7383);
  font-size: 10.5px;
  font-weight: 800;
}

/* Meta */
.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  margin-top: 9px;
  color: var(--ink-500, #5a7383);
  font-size: 13px;
  font-weight: 650;
}

.result-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.result-meta i {
  color: var(--teal-600, #158785);
  font-size: 12px;
}

.meta-dot {
  color: var(--ink-300, #c0cfd8);
  font-weight: 900;
}

/* Snippet */
.result-snippet {
  margin: 10px 0 0;
  color: var(--ink-600, #3d5566);
  font-size: 13.5px;
  line-height: 1.62;
}

/* Actions */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.result-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: var(--r-md, 10px);
  background: linear-gradient(180deg, var(--teal-500, #1ba5a3), var(--teal-600, #158785));
  color: #fff !important;
  font-size: 12.5px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: var(--shadow-teal, 0 8px 24px rgba(27,165,163,0.22));
  transition: all .15s ease;
}

.result-link-btn:hover {
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(27,165,163,0.30);
}

/* Empty State */
.search-empty {
  padding: 26px 20px;
  border-radius: var(--r-lg, 14px);
  background:
    radial-gradient(circle at 0% 0%, rgba(27,165,163,0.08), transparent 38%),
    var(--ink-50, #f7fafb);
  border: 1px dashed var(--border-strong, #cbd8de);
  color: var(--ink-600, #3d5566);
  text-align: center;
  font-size: 14px;
}

.search-empty strong {
  display: block;
  color: var(--ink-900, #0b1f2a);
  font-family: var(--font-display, Georgia, serif);
  font-size: 20px;
  margin-bottom: 4px;
}

/* Keep returned cards clean inside the live result block */
#search-results .xpen-live-results {
  animation: xpenResultsIn .22s ease both;
}

@keyframes xpenResultsIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile */
@media (max-width: 760px) {
  .xpen-result-card {
    padding: 15px;
    gap: 12px;
    border-radius: var(--r-lg, 14px);
  }

  .xpen-author-card {
    display: grid;
    grid-template-columns: 58px 1fr;
  }

  .result-avatar {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .result-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 13px;
    font-size: 17px;
  }

  .result-title {
    font-size: 18px;
  }

  .result-meta {
    gap: 5px 8px;
    font-size: 12.5px;
  }

  .result-snippet {
    font-size: 13px;
  }
}

@media (max-width: 520px) {
  .xpen-work-card {
    display: block;
  }

  .xpen-work-card .result-icon {
    margin-bottom: 10px;
  }

  .xpen-author-card {
    grid-template-columns: 52px 1fr;
  }

  .result-avatar {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .result-topline {
    gap: 6px;
  }

  .result-type-pill,
  .result-id,
  .result-date {
    font-size: 10.5px;
  }

  .result-actions {
    margin-top: 11px;
  }

  .result-link-btn {
    width: 100%;
    justify-content: center;
  }
}


/* Prevent feed Ajax from pushing Load More/footer downward */
#feed-container{
  min-height:980px;
}

.feed-skeleton{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.feed-skeleton-card{
  height:148px;
  border-radius:var(--r-lg,14px);
  border:1px solid var(--border,#e4ecef);
  background:
    linear-gradient(90deg,
      var(--ink-50,#f7fafb) 0%,
      #ffffff 45%,
      var(--ink-50,#f7fafb) 100%);
  background-size:220% 100%;
  animation:xpenSkeleton 1.15s ease-in-out infinite;
}

@keyframes xpenSkeleton{
  0%{background-position:100% 0;}
  100%{background-position:-100% 0;}
}

.search-feed-actions[hidden]{
  display:none !important;
}

@media (max-width:760px){
  #feed-container{
    min-height:1120px;
  }

  .feed-skeleton-card{
    height:165px;
  }
}