/* =========================================
   Search Theme — Layui 风格设计
   ========================================= */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Tahoma, Arial, sans-serif;
  color: #333;
  background: #f2f2f2;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* =========================================
   Page
   ========================================= */

.search-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15vh 1.5rem 3rem;
  min-height: 100vh;
}

/* --- Brand --- */

.brand {
  text-align: center;
  margin-bottom: 2.5rem;
}

.brand-title {
  font-size: 2.2rem;
  font-weight: 400;
  color: #333;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 0.9rem;
  color: #999;
  margin-top: 0.35rem;
}

/* =========================================
   Search Bar — Layui 风格
   ========================================= */

.layui-search {
  position: relative;
  width: 100%;
  max-width: 620px;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.layui-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #c2c2c2;
  pointer-events: none;
  z-index: 1;
}

.layui-search-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.layui-search-input {
  flex: 1;
  height: 46px;
  padding: 0 44px 0 42px;
  border: 1px solid #e6e6e6;
  border-right: none;
  border-radius: 2px 0 0 2px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #333;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.layui-search-input:focus {
  border-color: #5FB878;
}

.layui-search-input::placeholder {
  color: #bfbfbf;
}

.layui-search-clear {
  position: absolute;
  right: 90px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  padding: 2px;
  border: none;
  background: none;
  cursor: pointer;
  color: #ccc;
  display: none;
  z-index: 1;
}

.layui-search-clear.show {
  display: block;
}

.layui-search-clear:hover {
  color: #666;
}

.layui-search-clear svg {
  width: 16px;
  height: 16px;
  display: block;
}

.layui-search-btn {
  height: 46px;
  padding: 0 24px;
  border: none;
  border-radius: 0 2px 2px 0;
  background: #5FB878;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.04em;
  transition: background 0.2s;
}

.layui-search-btn:hover {
  background: #4eae6a;
}

.layui-search-btn:active {
  background: #449d5f;
}

/* =========================================
   Stats
   ========================================= */

.search-stats {
  width: 100%;
  max-width: 620px;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: #999;
  display: none;
}

.search-stats.show {
  display: block;
}

/* =========================================
   Loading
   ========================================= */

.search-loading {
  display: none;
  width: 100%;
  max-width: 620px;
  margin-top: 2rem;
  text-align: center;
}

.search-loading.show {
  display: block;
}

.layui-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid #e6e6e6;
  border-top-color: #5FB878;
  border-radius: 50%;
  animation: layui-rotate 0.6s linear infinite;
}

@keyframes layui-rotate {
  to { transform: rotate(360deg); }
}

/* =========================================
   Results
   ========================================= */

.search-results {
  width: 100%;
  max-width: 620px;
  margin-top: 1.5rem;
  display: none;
}

.search-results.show {
  display: block;
}

.result-item {
  display: flex;
  gap: 1rem;
  background: #fff;
  border-radius: 2px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.15s;
}

.result-item:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.result-thumb {
  flex-shrink: 0;
  width: 90px;
  height: 64px;
  border-radius: 2px;
  overflow: hidden;
  background: #f6f6f6;
}

.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.result-title {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.15rem;
}

.result-item:hover .result-title {
  color: #5FB878;
}

.result-title em {
  font-style: normal;
  color: #FF5722;
}

.result-desc {
  font-size: 0.85rem;
  color: #999;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.result-desc em {
  font-style: normal;
  color: #FF5722;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.result-url {
  color: #5FB878;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

.result-date {
  color: #bfbfbf;
  flex-shrink: 0;
}

/* =========================================
   Empty / Error
   ========================================= */

.search-empty,
.search-error {
  width: 100%;
  max-width: 620px;
  margin-top: 2rem;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  display: none;
  padding: 2rem 0;
}

.search-empty.show,
.search-error.show {
  display: block;
}

.search-error {
  color: #FF5722;
}

.search-empty .layui-icon-empty {
  display: block;
  font-size: 3rem;
  color: #ddd;
  margin-bottom: 0.75rem;
}

/* =========================================
   Post Page
   ========================================= */

.post-page,
.page-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: #999;
  transition: color 0.2s;
}
.back-link:hover { color: #5FB878; }

.post-article {
  background: #fff;
  border-radius: 2px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.post-header { margin-bottom: 1.75rem; }

.post-featured-image {
  margin: -2rem -2rem 1.75rem;
  overflow: hidden;
  max-height: 360px;
}

.post-featured-image img {
  width: 100%;
  object-fit: cover;
}

.post-title {
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.4;
  color: #333;
  margin-bottom: 0.4rem;
}
.post-date { font-size: 0.85rem; color: #999; }
.post-categories { margin-top: 0.6rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.category-tag {
  padding: 0.15rem 0.7rem;
  background: #f0f9f3;
  color: #5FB878;
  border-radius: 2px;
  font-size: 0.78rem;
}

.post-content {
  font-size: 1rem;
  line-height: 1.85;
  color: #555;
}
.post-content p { margin-bottom: 1.1rem; }
.post-content h2, .post-content h3 { color: #333; margin: 1.75rem 0 0.6rem; font-weight: 500; }
.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.18rem; }
.post-content ul, .post-content ol { margin-bottom: 1.1rem; padding-left: 1.5rem; }
.post-content pre {
  background: #f6f6f6;
  padding: 1rem 1.2rem;
  border-left: 3px solid #5FB878;
  overflow-x: auto;
  margin-bottom: 1.1rem;
  font-size: 0.88rem;
  line-height: 1.7;
}
.post-content code {
  background: #f0f0f0;
  padding: 0.12rem 0.35rem;
  border-radius: 2px;
  font-size: 0.88em;
}
.post-content pre code { background: none; padding: 0; }
.post-content blockquote {
  border-left: 3px solid #e6e6e6;
  padding: 0.5rem 1rem;
  margin-bottom: 1.1rem;
  background: #fafafa;
  color: #888;
}
.post-content img { border-radius: 2px; margin: 1.25rem auto; }
.post-content a { color: #5FB878; }
.post-content a:hover { color: #449d5f; }

.post-tags {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tag-item { font-size: 0.82rem; color: #999; }
.tag-item:hover { color: #5FB878; }

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 600px) {
  .search-page { padding: 10vh 1rem 2rem; }
  .brand-title { font-size: 1.7rem; }
  .layui-search-input { height: 42px; font-size: 0.88rem; padding-right: 38px; }
  .layui-search-btn { height: 42px; padding: 0 16px; font-size: 0.88rem; }
  .layui-search-clear { right: 72px; }

  .result-item { flex-direction: column; padding: 0.9rem; }
  .result-thumb { width: 100%; height: 130px; }

  .post-article { padding: 1.25rem; }
  .post-featured-image { margin: -1.25rem -1.25rem 1.25rem; }
  .post-title { font-size: 1.4rem; }
}
