/**
 * Ajax Live Search – Styles
 * 
 * Datei ablegen unter: child-theme/css/ajax-live-search.css
 * 
 * Farben/Abstände bei den Custom Properties anpassen
 */

/* =============================================
   CUSTOM PROPERTIES – hier anpassen
   ============================================= */

:root {
  --als-bg: #ffffff;
  --als-border: #e2e8f0;
  --als-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --als-radius: 8px;
  --als-hover-bg: #f7fafc;
  --als-active-bg: #edf2f7;
  --als-title-color: #1a202c;
  --als-excerpt-color: #718096;
  --als-type-color: #2b63ac;
  --als-type-bg: #e8f0fa;
  --als-mark-bg: #fefcbf;
  --als-mark-color: #744210;
  --als-font: inherit;
  --als-max-height: 420px;
  --als-width: 100%;
  --als-z-index: 99999;
}


/* =============================================
   WRAPPER
   ============================================= */

.als-wrapper {
  position: relative;
  width: var(--als-width);
}


/* =============================================
   DROPDOWN
   ============================================= */

.als-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: var(--als-z-index);
  margin-top: 4px;
  max-height: var(--als-max-height);
  overflow-y: auto;
  background: var(--als-bg);
  border: 1px solid var(--als-border);
  border-radius: var(--als-radius);
  box-shadow: var(--als-shadow);
  font-family: var(--als-font);
}

.als-dropdown.als-visible {
  display: block;
  animation: alsSlideIn 0.15s ease-out;
}

@keyframes alsSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =============================================
   EINZELNES ERGEBNIS
   ============================================= */

.als-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--als-border);
  transition: background 0.1s ease;
  cursor: pointer;
}

.als-result:last-of-type {
  border-bottom: none;
}

.als-result:hover,
.als-result.als-active {
  background: var(--als-hover-bg);
}

.als-result.als-active {
  background: var(--als-active-bg);
}


/* =============================================
   THUMBNAIL
   ============================================= */

.als-thumb {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--als-active-bg);
}

.als-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--als-type-bg);
}

.als-thumb-placeholder::after {
  content: '🔍';
  font-size: 18px;
}


/* =============================================
   ERGEBNIS-CONTENT
   ============================================= */

.als-result-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.als-result-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--als-type-color);
  background: var(--als-type-bg);
  padding: 1px 6px;
  border-radius: 3px;
  align-self: flex-start;
  line-height: 1.4;
}

.als-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--als-title-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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


/* =============================================
   HIGHLIGHT (MARK)
   ============================================= */

.als-result-excerpt mark {
  background: var(--als-mark-bg);
  color: var(--als-mark-color);
  padding: 0 2px;
  border-radius: 2px;
}


/* =============================================
   STATUS-MELDUNGEN
   ============================================= */

.als-loading,
.als-no-results {
  padding: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--als-excerpt-color);
}

.als-loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--als-border);
  border-top-color: var(--als-type-color);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  animation: alsSpin 0.6s linear infinite;
}

@keyframes alsSpin {
  to {
    transform: rotate(360deg);
  }
}


/* =============================================
   "ALLE ERGEBNISSE" LINK
   ============================================= */

.als-view-all {
  display: block;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--als-type-color);
  text-decoration: none;
  border-top: 1px solid var(--als-border);
  transition: background 0.1s ease;
}

.als-view-all:hover {
  background: var(--als-hover-bg);
}


/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 600px) {
  .als-dropdown {
    position: fixed;
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: 60vh;
    border-radius: 12px;
    margin-top: 0;
  }

  .als-result {
    padding: 12px;
  }

  .als-thumb {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
}


/* =============================================
   SCROLLBAR
   ============================================= */

.als-dropdown::-webkit-scrollbar {
  width: 6px;
}

.als-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.als-dropdown::-webkit-scrollbar-thumb {
  background: var(--als-border);
  border-radius: 3px;
}

.als-dropdown::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}


/* ==============================================
   ==============================================
   SEARCH RESULTS PAGE – search.php
   ==============================================
   ============================================== */

.als-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  font-family: var(--als-font);
}


/* HEADER
   ============================================= */

.als-page-header {
  margin-bottom: 40px;
}

.als-page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--als-title-color);
  margin: 0 0 4px;
}

.als-page-query {
  color: var(--als-type-color);
}

.als-page-count {
  font-size: 14px;
  color: var(--als-excerpt-color);
  margin: 0 0 20px;
}

.als-page-search-form {
  display: flex;
  gap: 8px;
}

.als-page-search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--als-border);
  border-radius: var(--als-radius);
  outline: none;
  transition: border-color 0.15s;
}

.als-page-search-input:focus {
  border-color: var(--als-type-color);
}

.als-page-search-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff !important;
  background: #2b63ac !important;
  border: none;
  border-radius: var(--als-radius);
  cursor: pointer;
  transition: opacity 0.15s;
}

.als-page-search-btn:hover {
  opacity: 0.85;
  background: #2b63ac !important;
}


/* ERGEBNIS-KARTEN
   ============================================= */

.als-page-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.als-page-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--als-bg);
  border: 1px solid var(--als-border);
  border-radius: var(--als-radius);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.als-page-card:hover {
  border-color: var(--als-type-color);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.als-page-card-thumb {
  width: 120px;
  height: 90px;
  min-width: 120px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--als-active-bg);
}

.als-page-card-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.als-page-card-thumb-empty::after {
  content: '📄';
  font-size: 28px;
}

.als-page-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.als-page-card-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--als-type-color);
  background: var(--als-type-bg);
  padding: 1px 6px;
  border-radius: 3px;
  align-self: flex-start;
}

.als-page-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--als-title-color);
  margin: 0;
  line-height: 1.3;
}

.als-page-card-excerpt {
  font-size: 14px;
  color: var(--als-excerpt-color);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.als-page-card-excerpt mark {
  background: var(--als-mark-bg);
  color: var(--als-mark-color);
  padding: 0 2px;
  border-radius: 2px;
}

.als-page-card-url {
  font-size: 12px;
  color: var(--als-excerpt-color);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* PAGINATION
   ============================================= */

.als-page-pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 40px;
}

.als-page-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--als-title-color);
  background: var(--als-bg);
  border: 1px solid var(--als-border);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s;
}

.als-page-pagination .page-numbers:hover {
  border-color: var(--als-type-color);
  color: var(--als-type-color);
}

.als-page-pagination .page-numbers.current {
  background: var(--als-type-color);
  border-color: var(--als-type-color);
  color: #fff;
}


/* KEINE ERGEBNISSE
   ============================================= */

.als-page-empty {
  text-align: center;
  padding: 60px 20px;
}

.als-page-empty-text {
  font-size: 18px;
  color: var(--als-title-color);
  margin: 0 0 16px;
}

.als-page-empty-tips {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  color: var(--als-excerpt-color);
}

.als-page-empty-tips li {
  padding: 4px 0;
}

.als-page-empty-tips li::before {
  content: '→ ';
  color: var(--als-type-color);
}


/* RESPONSIVE
   ============================================= */

@media (max-width: 600px) {
  .als-page {
    padding: 24px 16px 60px;
  }

  .als-page-title {
    font-size: 20px;
  }

  .als-page-search-form {
    flex-direction: column;
  }

  .als-page-card {
    flex-direction: column;
    gap: 12px;
  }

  .als-page-card-thumb {
    width: 100%;
    height: 160px;
    min-width: unset;
  }
}