/* ========================================================================
   Logo Search & Preview (logo-search.css)
   ======================================================================== */

/* 폰트: IBM Plex (없으면 시스템 폰트로 폴백) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans:wght@400;600;700&display=swap');

/* 스코프 기본값 */
.ls-wrapper,
.ls-wrapper * { box-sizing: border-box; }
.ls-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
  font-family: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto,
               Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  color: #0f172a;
}

.ls-inner { width: 100%; }

/* ---------------- Preview card ---------------- */
.ls-preview { margin: 8px 0 14px; }

.ls-card{
  display: flex;
  align-items: center;         /* 수직 가운데 */
  justify-content: center;     /* 수평 가운데 */
  gap: 16px;
  flex-wrap: wrap;             /* 좁아지면 아래줄로 자연스럽게 */
  border: 1px solid #e8eef6;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.ls-thumb{
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;              /* 고정 폭(랩해도 축소되지 않도록) */
}

.ls-thumb img{
  width: 128px;
  height: 128px;
  object-fit: contain;
  border: 1px solid #eef2f6;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.ls-noimg{
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa6b2;
  border: 1px dashed #e5eaf0;
  border-radius: 10px;
  background: #fafbfc;
}

/* 메타(오른쪽 텍스트) */
.ls-meta{
  flex: 1 1 360px;             /* 기본 제안폭 */
  min-width: 260px;            /* 이보다 좁아지면 아래로 내려가게 */
  display: flex;
  flex-direction: column;
  justify-content: center;     /* 세로 중앙 */
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ls-ticker{
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
}
.ls-name{
  color: #64748b;
  margin: 6px 0 10px;
}
.ls-row{
  display: flex;
  justify-content: space-between;
  border-top: 1px dashed #edf2f7;
  padding-top: 8px;
  font-size: 13px;
}
.ls-label{ color:#67748a; }
.ls-val{
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color:#111827;
}

/* ---------------- Search area / form ---------------- */
.ls-search-area { width: 100%; }
.ls-form        { width: 100%; margin: 0; }
.ls-input-wrap  { position: relative; width: 100%; max-width: 100%; }

/* 테마 스타일을 이겨서 항상 100% 차지 */
.ls-wrapper .ls-form,
.ls-wrapper .ls-input-wrap,
.ls-wrapper #ls-input{
  width: 100% !important;
  max-width: 100% !important;
}

/* Input */
.ls-input{
  width: 100%;
  height: 52px;
  border-radius: 14px;
  padding: 0 52px 0 44px;         /* 아이콘, 클리어 여백 */
  border: 1px solid #e3e8ef;
  background: #fff;
  font-size: 16px;
  line-height: 52px;
  color: #0f172a;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.02), 0 0 0 3px transparent;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.ls-input::placeholder{ color:#9aa6b2; }
.ls-input:focus{
  outline: none;
  border-color: #c9e4ff;
  box-shadow: 0 0 0 3px rgba(56,149,255,.18);
}

/* Magnifier */
.ls-icon{
  position:absolute;
  left: 14px; top:50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  color: #6b7280;
  pointer-events: none;
}
.ls-icon circle, .ls-icon line{
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Clear (×) */
.ls-clear{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
}
.ls-clear:hover{ background:#e2e8f0; }

/* ---------------- Suggestions (autocomplete) ---------------- */
.ls-suggestions{
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 8px);           /* 인풋 바로 아래 */
  width: 100%;
  max-width: 100%;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e8eef6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
  z-index: 1000;
  display: none;                    /* JS로 토글 */
}

.ls-sug-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f6f9fc;
  cursor: pointer;
  font-size: 13px;                  /* 컴팩트 */
}
.ls-suggestions .ls-sug-item:last-child{ border-bottom: none; }
.ls-sug-item:hover, .ls-sug-item.active{ background: #f6fbff; }

.ls-sug-thumb{
  width: 32px; height: 32px;
  object-fit: contain;
  border: 1px solid #eef2f6;
  border-radius: 6px;
  padding: 4px;
  background: #fff;
}
.ls-sug-thumb.noimg{
  display: flex; align-items: center; justify-content: center;
  color: #9aa6b2;
}
.ls-sug-text{ min-width: 0; }
.ls-sug-text strong{
  display: block;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}
.ls-sug-name{
  color: #6b7280;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty state */
.ls-empty{ color:#6b7280; }

/* ---------------- Responsive ---------------- */
/* 태블릿~작은 폰: 썸네일 약간 축소, 메타 최소폭 축소 */
@media (max-width: 720px){
  .ls-thumb img, .ls-noimg{ width:112px; height:112px; }
  .ls-meta{ flex:1 1 300px; min-width:220px; }
}

/* 작은 폰: 메타를 아래로 100% 배치(가장 읽기 쉽도록) */
@media (max-width: 480px){
  .ls-card{ justify-content:center; }
  .ls-thumb{ justify-content:center; }
  .ls-thumb img, .ls-noimg{ width:96px; height:96px; }
  .ls-meta{
    flex:1 1 100%;
    min-width:0;
    width:100%;
    margin-top:8px;
  }
  .ls-input{ height: 48px; line-height:48px; padding:0 48px 0 42px; font-size:15px; }
  .ls-icon{ width:18px; height:18px; left:12px; }
  .ls-clear{ width:26px; height:26px; right:8px; }
  .ls-sug-thumb{ width:28px; height:28px; }
}

/* ---------------- Dark mode (polish) ---------------- */
@media (prefers-color-scheme: dark){
  .ls-card{ background:#0b0e12; border-color:#1f2937; box-shadow:none; }
  .ls-thumb img{ background:#0b0e12; border-color:#1f2937; }
  .ls-noimg{ background:#0b0e12; border-color:#1f2937; color:#94a3b8; }
  .ls-ticker{ color:#e5e7eb; }
  .ls-name, .ls-label{ color:#9aa6b2; }
  .ls-row{ border-top-color:#1f2937; }
  .ls-input{ background:#0b0e12; color:#e5e7eb; border-color:#1f2937; }
  .ls-suggestions{ background:#0b0e12; border-color:#1f2937; box-shadow: 0 8px 20px rgba(0,0,0,.45); }
  .ls-sug-item{ border-bottom-color:#121821; }
  .ls-sug-item:hover, .ls-sug-item.active{ background:#0f141b; }
  .ls-sug-thumb{ background:#0b0e12; border-color:#1f2937; }
}

.ls-preview { background: #fff !important; }


/* ---------------------------
  Replace clear button with left search icon
  - hide existing clear button (#ls-clear)
  - add inline SVG background icon to input on left
  - ensure padding so text doesn't overlap icon
----------------------------*/
#ls-clear,
.ls-clear {
  display: none !important; /* 기존 X 버튼 숨김 */
}

/* input: add left icon */
.ls-input {
  /* make room for the icon */
  padding-left: 40px !important;
  /* background icon (inline SVG). tweak stroke color if needed */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='11' cy='11' r='6' stroke='%23666' stroke-width='2' fill='none'/><line x1='16' y1='16' x2='22' y2='22' stroke='%23666' stroke-width='2' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 18px 18px;
  box-sizing: border-box;
}

/* dark mode: lighter icon for dark background (adjust depending on your theme) */
.lgb-mode-dark .ls-input,
.ls-wrapper.lgb-mode-dark .ls-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='11' cy='11' r='6' stroke='%23ddd' stroke-width='2' fill='none'/><line x1='16' y1='16' x2='22' y2='22' stroke='%23ddd' stroke-width='2' stroke-linecap='round'/></svg>");
}

/* small screens: keep spacing reasonable */
@media (max-width:420px){
  .ls-input { padding-left: 36px !important; background-position: 10px center; background-size:16px 16px; }
}
