/* =========================================================
   search.css — pagina di ricerca centralizzata
   Usa le CSS variables del tema synthwave82
   ========================================================= */

.search-page {
  width: min(var(--container-width), 95%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--content-gap);
}

/* Ensure the container takes full width of the parent (search-page) */
.search-page .search-container {
  width: 100%;
  margin: 0;
}

.search-header h1 {
  color: var(--color-brand);
}

.search-description {
  color: var(--color-brand-light);
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

/* ── Search Box Wrapper ───────────────────────────────── */
/* Matches layouts/partials/search-box.html structure */

.search-wrapper {
  display: flex;
  align-items: center;
  /* Removed gap to match archives.css/tutorial style */
  background: var(--color-transparent);
  border-radius: var(--border-radius-card);
  box-shadow: var(--box-shadow);
  padding: 0.5rem 1rem;
  transition: box-shadow 0.3s ease;
  position: relative; /* For suggestions dropdown if needed */
}

.search-wrapper:focus-within {
  box-shadow: var(--box-shadow-hover);
}

.search-wrapper .search-icon {
  color: var(--color-brand);
  width: 1.3rem;
  height: 1.3rem;
  flex-shrink: 0;
  margin-left: 0.8rem; /* Match archives.css margin */
}

.search-wrapper .search-input {
  width: 100%;
  background: transparent;
  color: var(--color-light);
  font-family: inherit;
  font-size: 1rem;
  border: none;
  outline: none;
  appearance: none;
}

.search-wrapper .search-input::placeholder {
  color: var(--color-brand-light);
  opacity: 0.6;
}

/* Hide native X button */
.search-wrapper .search-input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* ── Messaggi di stato ────────────────────────────────── */

.search-instructions,
.search-no-results {
  color: var(--color-brand-light);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.search-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.search-count {
  color: var(--color-brand-light);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.search-count strong {
  color: var(--color-contrast);
}

/* ── Grid risultati ───────────────────────────────────── */

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem; /* Increased gap */
}

/* Stile Card unificato con Home Page (.post-summary) */
.result-card {
  background-color: var(--color-transparent);
  padding: 1.5rem;
  border-radius: var(--border-radius-card);
  box-shadow: var(--box-shadow);
  transition: box-shadow 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: none; /* Rimosso border per matchare home page */
}

.result-card:hover {
  box-shadow: var(--box-shadow-hover);
  transform: none; /* Rimosso translateY per matchare home page behavior se diverso, o mantengo se piace */
}

.result-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.result-image img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--border-radius); /* Aggiunto radius all'immagine come home */
  margin-bottom: 1rem;
  border: none;
}

/* Hover Animation Image */
.result-card:hover .result-image img {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.result-content {
  padding: 0; /* Rimosso padding interno perché ora è sul container card */
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.result-title {
  font-size: 1.4rem; /* Match home h2 size roughly */
  margin: 0.5rem 0 0.75rem;
  color: var(--color-contrast);
  line-height: 1.3;
  font-weight: 400;
}

/* ── Meta Styles (Match Post Single) ──────────────────── */

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-warning);
  margin-bottom: 1rem;
  align-items: center;
}

/* Date separator if needed, but structure is messy in JS. 
   Currently JS puts date then cats.
   Let's style categories to match post-categories li */

.result-category {
  color: var(--color-brand);
  position: relative;
  padding-left: 1.2em;
  background: none;
  border-radius: 0;
  font-size: inherit;
}

.result-category::before {
  content: "~";
  position: absolute;
  left: 0;
  color: var(--color-brand);
}

/* ── Tags Styles (Match Post Single) ──────────────────── */

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto; /* Push to bottom */
  padding-top: 1rem;
}

.result-tag {
  font-size: 0.8rem;
  background: var(--color-transparent); /* Match post-tags li */
  padding: 0.4em 0.8em;
  border-radius: 2em;
  color: var(--color-post); /* Assuming text color */
}

.result-tag::before {
  content: "#";
  color: var(--color-brand);
  margin-right: 0.2em;
}

.result-summary {
  font-size: 0.95rem;
  color: var(--color-light);
  line-height: 1.6;
  margin-bottom: 1rem;
  text-align: justify;
}

.result-summary::before {
    content: "> ";
    color: var(--color-brand);
}

@media screen and (max-width: 768px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}
