/* SeedChat AI — Search Widget */

:root {
  --sc-search-accent: #1a73e8;
  --sc-search-bg: #ffffff;
  --sc-search-surface: #f8f9fa;
  --sc-search-border: #e0e0e0;
  --sc-search-text: #202124;
  --sc-search-muted: #5f6368;
  --sc-search-radius: 12px;
  --sc-search-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  --sc-search-z: 99999;
}

/* ====================================================================== */
/*  Overlay — full-screen                                                   */
/* ====================================================================== */

.sc-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--sc-search-z);
  overflow-y: auto;
  background: #fff;
}

.sc-search-overlay.sc-is-open {
  display: block;
  animation: sc-fade-in .2s ease;
}

/* Force dark color for theme elements rendered inside the overlay */
.sc-search-overlay .top-header a,
.sc-search-overlay .social-box a {
  color: #111f39 !important;
}

/* Top bar flush to overlay top — override theme margin/padding */
.sc-search-overlay .sc-search-modal {
  padding-top: 0;
}
.sc-search-overlay .top-header {
  margin-top: 0 !important;
  padding: 32px 0 20px;
  width: 100%;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}

.sc-search-backdrop { display: none; }

@keyframes sc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body.sc-search-open { overflow: hidden; }

/* ====================================================================== */
/*  Modal — full-page layout                                                */
/* ====================================================================== */

.sc-search-modal {
  position: relative;
  width: 100%;
  min-height: 100vh;
  max-width: none;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 70px 60px;
  animation: sc-fade-in .2s ease;
}

/* Close button — top right */
.sc-search-close {
  position: absolute;
  top: 24px;
  right: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #111f39;
  border-radius: 50%;
  padding: 0;
  transition: background .15s;
}
.sc-search-close:hover { background: #f0f0f0; }
.sc-search-close svg { width: 20px; height: 20px; }

/* Branding */
.sc-search-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  text-decoration: none;
}
.sc-search-brand img,
.sc-search-brand svg { max-height: 100px; width: auto; }
.sc-search-brand-name {
  font-size: 28px;
  font-weight: 700;
  color: #111f39;
  margin: 8px 0 0;
  text-align: center;
}
.sc-search-brand-tagline {
  font-size: 13px;
  color: #5f6368;
  margin: 4px 0 0;
  text-align: center;
  line-height: 1.5;
}

/* Search bar row */
.sc-search-form-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 660px;
  margin-bottom: 40px;
  margin-left: auto;
  margin-right: auto;
}

.sc-search-form-wrap form { flex: 1; }

/* ====================================================================== */
/*  Header (search bar row inside modal)                                    */
/* ====================================================================== */

.sc-search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  padding: 0 20px;
  border: 1px solid #ddd;
  border-radius: 100px;
  background: #fff;
  flex-shrink: 0;
}

.sc-search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sc-search-icon {
  width: 18px;
  height: 18px;
  color: var(--sc-search-muted);
  flex-shrink: 0;
}

.sc-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  line-height: 1.4;
  color: var(--sc-search-text);
  background: transparent;
  min-width: 0;
}

.sc-search-input::placeholder {
  color: var(--sc-search-muted);
}

.sc-search-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sc-search-divider {
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 4px;
  flex-shrink: 0;
}

.sc-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--sc-search-muted);
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.sc-search-clear:hover {
  background: var(--sc-search-surface);
  color: var(--sc-search-text);
}

.sc-search-clear[hidden] {
  display: none;
}

.sc-search-clear svg {
  width: 20px;
  height: 20px;
}

.sc-search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: opacity .15s;
}

.sc-search-submit:hover {
  opacity: .6;
}

.sc-search-submit svg {
  width: 20px;
  height: 20px;
}

/* ====================================================================== */
/*  Body                                                                    */
/* ====================================================================== */

.sc-search-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 80px;
}

.sc-search-hint,
.sc-search-empty {
  margin: 0;
  padding: 16px 0;
  text-align: center;
  color: var(--sc-search-muted);
  font-size: 14px;
}

.sc-search-error {
  margin: 0;
  padding: 16px 0;
  text-align: center;
  color: #d93025;
  font-size: 14px;
}

/* ====================================================================== */
/*  Footer                                                                  */
/* ====================================================================== */

.sc-search-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--sc-search-border);
  flex-shrink: 0;
  justify-content: flex-end;
}

.sc-search-footer[hidden] {
  display: none;
}

.sc-search-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
}

.sc-search-btn--outline {
  background: transparent;
  border: 1px solid var(--sc-search-border);
  color: var(--sc-search-text);
}

.sc-search-btn--outline:hover {
  background: var(--sc-search-surface);
}

.sc-search-btn--primary {
  background: var(--sc-search-accent);
  color: #fff;
}

.sc-search-btn--primary:hover {
  opacity: .88;
}

/* ====================================================================== */
/*  AI Overview box (inside modal)                                          */
/* ====================================================================== */

.sc-overview-box {
  background: var(--sc-search-surface);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-left: 3px solid var(--sc-search-accent);
}

.sc-overview-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sc-search-accent);
  margin-bottom: 8px;
}

.sc-overview-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--sc-search-text);
  white-space: pre-line;
}

/* ====================================================================== */
/*  Result cards                                                            */
/* ====================================================================== */

.sc-results-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sc-result-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}

.sc-result-card:hover {
  background: var(--sc-search-surface);
}

.sc-result-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--sc-search-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.sc-result-thumb--placeholder {
  color: var(--sc-search-muted);
}

.sc-result-thumb--placeholder svg {
  width: 40px;
  height: 40px;
}

.sc-result-info {
  flex: 1;
  min-width: 0;
}

.sc-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sc-search-text);
  line-height: 1.4;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-result-excerpt {
  font-size: 13px;
  color: var(--sc-search-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ====================================================================== */
/*  Skeleton loading                                                         */
/* ====================================================================== */

@keyframes sc-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.sc-skeleton-line,
.sc-skeleton-thumb {
  background: linear-gradient(90deg, #e8e8e8 25%, #f4f4f4 50%, #e8e8e8 75%);
  background-size: 800px 100%;
  animation: sc-shimmer 1.4s infinite linear;
  border-radius: 4px;
}

.sc-skeleton-line {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.sc-skeleton-line--title {
  height: 16px;
  width: 75%;
  margin-bottom: 6px;
}

.sc-skeleton-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
}

.sc-skeleton-overview {
  background: var(--sc-search-surface);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-left: 3px solid var(--sc-search-border);
}

.sc-result-card--skeleton {
  pointer-events: none;
}

/* ====================================================================== */
/*  AI Overview box on search results page                                  */
/* ====================================================================== */

.sc-search-overview-box {
  position: relative;
  width: 100%;
  max-width: 660px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 32px;
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0px 8px 24px 0px rgba(166, 197, 254, 0.3),
    0px 0px 6px 0px rgba(223, 234, 255, 0.5),
    -2px -2px 2px 0px rgba(17, 31, 57, 0.04) inset,
    2px 2px 6px 0px rgba(17, 31, 57, 0.03) inset;
}

.sc-search-overview-box::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  background: linear-gradient(90.51deg, #8BACE9 0.41%, #111F39 58.19%);
  z-index: -1;
}

.sc-search-overview-box .sc-overview-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-family: sansfrancais, sans-serif;
  font-weight: 400;
  color: #111f39;
  margin-bottom: 12px;
  text-transform: none;
  letter-spacing: normal;
}

.sc-search-overview-box .sc-overview-label svg {
  width: 21px;
  height: 20px;
  flex-shrink: 0;
}

.sc-overview-content {
  font-size: 16px;
  line-height: 1.6;
  color: #111f39;
  white-space: pre-line;
  margin-bottom: 20px;
  font-family: "Sukhumvit Tadmai", "Sukhumvit Set", sans-serif;
}

.sc-overview-footer {
  margin-top: 4px;
}

.sc-ai-mode-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  background: #111f39;
  color: #fff;
  border-radius: 100px;
  font-size: 16px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}

.sc-ai-mode-btn:hover {
  opacity: .88;
  color: #fff;
  text-decoration: none;
}

.sc-btn-thai {
  font-family: "Sukhumvit Tadmai", "Sukhumvit Set", sans-serif;
}

.sc-btn-en {
  font-family: sansfrancais, sans-serif;
  margin-left: 5px;
}

/* Skeleton on search overview page */
.sc-search-overview-box.sc-overview-loading .sc-overview-content {
  padding-top: 4px;
}

/* ====================================================================== */
/*  Search results page layout  (page wrapper/grid → cloud-5 theme CSS)   */
/* ====================================================================== */

/* Search bar on results page (plugin fallback template) */
.sc-search-page-bar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.sc-search-page-bar {
  display: flex;
  align-items: center;
  width: 660px;
  max-width: 100%;
  height: 50px;
  padding: 0 20px;
  border: 1px solid #ddd;
  border-radius: 100px;
  background: #fff;
  gap: 10px;
}

.sc-search-page-bar__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: #333;
  background: transparent;
  min-width: 0;
}

.sc-search-page-bar__input::placeholder {
  color: #999;
}

.sc-search-page-bar__icon {
  color: #666;
  flex-shrink: 0;
  line-height: 0;
}

.sc-search-page-bar__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #999;
  border-radius: 50%;
  text-decoration: none;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .15s, color .15s;
}

.sc-search-page-bar__clear:hover {
  background: #f0f0f0;
  color: #333;
}

/* Article card (plugin fallback template only) */
.sc-search-card {
  position: relative;
  overflow: hidden;
}

.sc-search-card__image {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f0f0f0;
  text-decoration: none;
}

.sc-search-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.sc-search-card:hover .sc-search-card__image img {
  transform: scale(1.03);
}

.sc-search-card__no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
}

.sc-search-card__info {
  background: #fff;
  padding: 8px 12px 12px;
  min-height: 174px;
}

.sc-search-card__category {
  font-size: 14px;
  color: #111f39;
  margin-bottom: 4px;
  line-height: 1.625;
}

.sc-search-card__category a {
  color: inherit;
  text-decoration: none;
}

.sc-search-card__category a:hover {
  text-decoration: underline;
}

.sc-search-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  min-height: 24px;
  overflow: hidden;
}

.sc-search-card__meta .posted-on {
  display: none;
}

.sc-search-card__meta .column {
  order: 1;
  font-size: 14px;
  line-height: 1.625;
  color: #111f39;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-search-card__meta .column:hover {
  text-decoration: underline;
}

.sc-search-card__meta .icons {
  order: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sc-search-card__title {
  font-size: 20px;
  line-height: 1.3;
  color: #333;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sc-search-card__title a {
  color: inherit;
  text-decoration: none;
}

.sc-search-card__title a:hover {
  color: #111f39;
}

.sc-search-card__author {
  font-size: 12px;
  color: #464646;
  line-height: 1.5;
}

.sc-search-card__author a {
  color: inherit;
  text-decoration: none;
}

.sc-search-card__author a:hover {
  text-decoration: underline;
}

/* ====================================================================== */
/*  Responsive — modal                                                      */
/* ====================================================================== */

@media (max-width: 768px) {
  .sc-search-modal {
    padding: 24px 20px 40px;
  }

  .sc-search-form-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sc-ai-mode-btn {
    justify-content: center;
    width: 100%;
    height: 44px;
  }
}

@media (max-width: 640px) {
  .sc-search-page-bar {
    width: 100%;
  }
}
