/* Container */
.zcs-page-search {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
  font-family: "Poppins", sans-serif;
}

.zcs-search-header-title {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: #005d87;
}

/* Search form */
/* Search bar wrapper */
#zcs-search-form {
  display: flex;
  align-items: center;
  max-width: 700px;
  margin: 0 auto 25px;
  background-color: #ffffff !important;
  background: #ffffff !important;
  border-radius: 999px;
  padding: 4px;
  border: 1px solid #dcdcdc;
  overflow: hidden;
}

/* Input */
#zcs-search-input,
.zcs-search-input {
  flex: 1;
  width: 100%;
  padding: 12px 18px;
  font-size: 16px;

  border: none !important;
  outline: none !important;
  border-radius: 999px;

  background: transparent !important;
  background-color: transparent !important;
}

.zcs-search-input:focus {
  transform: translateY(-1px);
}

.zcs-search-input::placeholder {
  color: #999;
}

/* Button */
.zcs-search-button,
#zcs-search-form button {
  display: flex;
  align-items: center;
  border: none;
  padding: 14px 32px;
  border-radius: 999px;
  background: #005d87;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

/* Hover & active */
.zcs-search-button:hover,
#zcs-search-form button:hover {
  background: #8dc63f;
}

.zcs-search-button:active,
#zcs-search-form button:active {
  transform: scale(0.96);
}

/* Focus highlight */
#zcs-search-form:focus-within {
  border-color: #005d87;
  box-shadow: 0 0 0 2px rgba(0, 93, 135, 0.15);
}

/* Mobile */
@media (max-width: 480px) {
  #zcs-search-form {
    max-width: 100%;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .zcs-search-overlay,
  .zcs-search-container {
    transition: none;
    transform: none;
    filter: none;
  }
}

/* Results list */
.zcs-search-results-page {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Each result */
.zcs-search-item {
  border-bottom: 1px solid #e6e6e6;
}

/* Article wrapper */
.zcs-search-article {
  padding: 48px 24px;
}

/* Title */
.zcs-search-title {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  line-height: 1.25;
}

.zcs-search-title a {
  color: #005d87;
  text-decoration: none;
}

.zcs-search-title a:hover {
  color: #8dc63f;
}

/* Date */
.zcs-search-date {
  display: block;
  margin-top: 16px;
  font-size: 14px;
  color: #6b7280;
}

/* No results */
.zcs-no-results {
  padding: 20px;
  color: #666;
  text-align: center;
}

.zcs-search-hint {
  margin-top: 15px;
  font-size: 14px;
  color: #666;
  text-align: center;
}

.zcs-relevanssi-highlight {
  background-color: #8dc63f;
  color: #005d87;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 2px;
}

/* Header */
.zcs-navsearch-button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zcs-navsearch-button svg {
  stroke: currentColor;
  fill: none;
}

.zcs-navsearch-button:hover {
  transform: scale(1.05);
}

.zcs-navsearch-button:active {
  transform: scale(0.95);
}

.zcs-search-overlay {
  position: fixed !important;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  pointer-events: none;
  z-index: 2147483647 !important;
  padding-top: 10%;

  display: flex;
  justify-content: center;
  align-items: start;

  transition: opacity 180ms ease-out, background-color 220ms ease-out;
}

.zcs-search-overlay.zcs-active {
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.85);
}

.zcs-search-container {
  width: 90%;
  max-width: 640px;
  position: relative;
  pointer-events: none;

  opacity: 0;
  transform: translateY(-16px) scale(0.98);

  transition: opacity 160ms ease-out,
    transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.zcs-search-overlay.zcs-active .zcs-search-container {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.zcs-search-input-wrapper {
  position: relative;
  width: 100%;
  pointer-events: auto;
}

.zcs-search-loader {
  margin: 10px;
  opacity: 0;
  transition: all 0.1s ease-in-out;
}

.zcs-search-loader.zcs-loading {
  opacity: 1 !important;
}

.zcs-search-loader svg {
  width: 20px;
  height: 20px;
  fill: #6b7280;
  animation: zcs-spin 1s linear infinite;
}

@keyframes zcs-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.zcs-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zcs-search-results.zcs-active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.zcs-search-message {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 14px;
  animation: zcs-fadeIn 0.3s ease;
}

@keyframes zcs-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.zcs-search-result-item {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  animation: zcs-slideIn 0.3s ease forwards;
  opacity: 0;
}

@keyframes zcs-slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.zcs-search-result-item:last-child {
  border-bottom: none;
}

.zcs-search-result-item:hover {
  background: #f8f9fa;
  transform: translateX(4px);
}

.zcs-search-result-item:active {
  transform: translateX(2px) scale(0.98);
}

.zcs-result-title {
  font-weight: 600;
  color: #005d87;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zcs-search-result-item:hover .zcs-result-title {
  color: #8dc63f;
}

.zcs-result-description {
  font-size: 14px;
  color: #666;
}

.zcs-close-overlay {
  position: absolute;
  top: 30px;
  right: 30px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.9);
  border-radius: 9999px;
  padding: 4px !important;
}

@media (max-width: 480px) {
  .zcs-close-overlay {
    display: none;
  }
}

.zcs-close-overlay svg {
  width: 100%;
  height: 100%;
  display: block;
}

.zcs-search-overlay.zcs-active .zcs-close-overlay {
  opacity: 0.7;
}

.zcs-close-overlay:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg) scale(1);
}

.zcs-close-overlay:active {
  transform: rotate(90deg) scale(0.95);
}

.zcs-search-results-summary {
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #666;
  animation: zcs-fadeIn 0.3s ease;
}

.zcs-search-show-all-button {
  background: none;
  border: none;
  color: #005d87;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zcs-search-show-all-button:hover {
  color: #8dc63f;
}
