/* ==========================================================================
   CAS Industrial Instruments - Global Search Modal & Results Styles
   File: css/search.css
   Benchmarked from CAS official website (cas.co.kr/integration/seach.jsp)
   ========================================================================== */

/* 1. Header Search Trigger Button */
.header-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.header-search-btn:hover {
  background: #0052cc;
  border-color: #0052cc;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.2);
}

.header-search-btn svg {
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.header-search-btn:hover svg {
  transform: scale(1.1);
}

/* 2. Fullscreen Search Modal Overlay */
.cas-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cas-search-overlay.active {
  display: flex;
  opacity: 1;
}

/* 3. Search Modal Dialog Box */
.cas-search-modal {
  background: #ffffff;
  width: 100%;
  max-width: 680px;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: casSearchSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  margin-top: 20px;
}

@keyframes casSearchSlideDown {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 4. Modal Header */
.cas-search-header {
  padding: 24px 28px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
}

.cas-search-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cas-search-close-btn {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cas-search-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

/* 5. Search Input Bar */
.cas-search-input-wrap {
  padding: 20px 28px 16px;
  position: relative;
}

.cas-search-input-box {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 6px 14px;
  transition: all 0.2s ease;
}

.cas-search-input-box:focus-within {
  background: #ffffff;
  border-color: #0052cc;
  box-shadow: 0 0 0 4px rgba(0, 82, 204, 0.12);
}

.cas-search-input-box svg {
  color: #64748b;
  flex-shrink: 0;
  margin-right: 10px;
}

.cas-search-input-field {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  padding: 8px 0;
}

.cas-search-input-field::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.cas-search-clear-btn {
  background: #cbd5e1;
  border: none;
  color: #475569;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 8px;
}

.cas-search-clear-btn:hover {
  background: #94a3b8;
  color: #ffffff;
}

.cas-search-submit-btn {
  background: #0052cc;
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.cas-search-submit-btn:hover {
  background: #003d99;
}

/* 6. Tags Area: Recent & Recommended */
.cas-search-tags-container {
  padding: 0 28px 24px;
}

.cas-search-tag-group {
  margin-top: 16px;
}

.cas-search-tag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cas-search-tag-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cas-search-tag-clear-all {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}

.cas-search-tag-clear-all:hover {
  color: #dc2626;
  text-decoration: underline;
}

.cas-search-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cas-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cas-search-chip:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
  transform: translateY(-1px);
}

.cas-search-chip.recommended {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.cas-search-chip.recommended:hover {
  background: #0052cc;
  border-color: #0052cc;
  color: #ffffff;
}

.cas-search-chip-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 0.7rem;
  margin-left: 2px;
}

.cas-search-chip-del:hover {
  color: #dc2626;
}

.cas-search-empty-text {
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 4px 0;
}

/* 7. Live Autocomplete Results Container */
.cas-search-live-results {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  max-height: 360px;
  overflow-y: auto;
  display: none;
}

.cas-search-live-header {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}

.cas-search-live-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.cas-search-live-item:last-child {
  border-bottom: none;
}

.cas-search-live-item:hover,
.cas-search-live-item.focused {
  background: #f0f7ff;
}

.cas-search-live-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}

.cas-search-live-info {
  flex: 1;
  min-width: 0;
}

.cas-search-live-model {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cas-search-live-model mark {
  background: #fef08a;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 2px;
}

.cas-search-live-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cas-search-live-cat {
  font-size: 0.72rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.cas-search-live-footer {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.cas-search-live-view-all-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: #0052cc;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.cas-search-live-view-all-btn:hover {
  background: #003d99;
}

/* 8. Search Results Page Styles (Inside products.html?search=...) */
.search-results-banner {
  background: linear-gradient(135deg, #0b132b 0%, #1c2541 100%);
  color: #ffffff;
  padding: 36px 28px;
  border-radius: 14px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(11, 19, 43, 0.2);
}

.search-results-query {
  color: #38bdf8;
  font-weight: 800;
}

.search-results-stats {
  font-size: 1.05rem;
  color: #cbd5e1;
  margin-top: 8px;
}

.search-inline-box {
  display: flex;
  gap: 8px;
  max-width: 540px;
  margin-top: 18px;
}

.search-inline-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
}

.search-inline-input:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: #38bdf8;
}

.search-inline-input::placeholder {
  color: #94a3b8;
}

.search-inline-btn {
  padding: 10px 20px;
  background: #0052cc;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-inline-btn:hover {
  background: #003d99;
}

.search-category-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  background: #f8fafc;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.search-category-tab {
  padding: 8px 16px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-category-tab:hover {
  border-color: #0052cc;
  color: #0052cc;
}

.search-category-tab.active {
  background: #0052cc;
  border-color: #0052cc;
  color: #ffffff;
}

.search-category-tab .badge {
  display: inline-block;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-left: 4px;
}

.search-category-tab.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* 9. Zero-Result State (검색 결과 없음) */
.search-zero-state {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 60px 24px;
  text-align: center;
  margin: 30px 0;
  grid-column: 1 / -1;
}

.search-zero-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.8;
}

.search-zero-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 12px;
}

.search-zero-tips {
  display: inline-block;
  text-align: left;
  background: #f8fafc;
  padding: 16px 24px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin: 16px 0 24px;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.8;
}

.search-zero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .cas-search-overlay {
    padding: 16px 10px;
  }
  .cas-search-modal {
    margin-top: 10px;
    border-radius: 14px;
  }
  .cas-search-header {
    padding: 16px 18px 12px;
  }
  .cas-search-input-wrap {
    padding: 14px 18px 12px;
  }
  .cas-search-tags-container {
    padding: 0 18px 18px;
  }
  .header-search-btn span {
    display: none;
  }
  .header-search-btn {
    padding: 7px;
    border-radius: 50%;
  }
  .search-inline-box {
    flex-direction: column;
  }
}


/* Top Bar Search Link (Next to 회사소개/오시는길) */
.top-search-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #ffffff !important;
  font-weight: 700 !important;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 11px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}

.top-search-link span {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.top-search-link svg {
  stroke: #38bdf8;
  transition: stroke 0.2s ease;
}

.top-search-link:hover {
  background: #0052cc !important;
  border-color: #0052cc !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 82, 204, 0.4);
  transform: translateY(-1px);
}

.top-search-link:hover svg {
  stroke: #ffffff;
}
