/* ── Advanced Search ───────────────────────────────────────────────────── */

.pkae-search-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

/* Alignment */
.pkae-search-align-left .pkae-search-wrapper {
  margin-left: 0;
  margin-right: auto;
}

.pkae-search-align-center .pkae-search-wrapper {
  margin-left: auto;
  margin-right: auto;
}

.pkae-search-align-right .pkae-search-wrapper {
  margin-left: auto;
  margin-right: 0;
}

.pkae-search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* Input Wrapper */
.pkae-search-input-wrapper {
  position: relative;
  display: flex !important;
  align-items: center;
  flex: 1 1 auto !important;
  min-width: 0;
  width: 100%;
}

.pkae-search-input {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  border: 1px solid #ddd;
  outline: none;
  transition: all 0.3s ease;
  font-size: 15px;
  box-sizing: border-box !important;
}

.pkae-search-input:focus {
  outline: none;
}

/* Search Icon */
.pkae-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  transition: opacity 0.2s ease;
}

.pkae-icon-left .pkae-search-icon {
  left: 15px;
}

.pkae-icon-right .pkae-search-icon {
  right: 15px;
}

/* Close Icon */
.pkae-close-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  cursor: pointer;
  padding: 5px;
  transition: all 0.2s ease;
}

.pkae-close-icon i,
.pkae-close-icon svg {
  transition: all 0.2s ease;
}

.pkae-icon-left .pkae-close-icon {
  left: 15px;
}

.pkae-icon-right .pkae-close-icon {
  right: 15px;
}

.pkae-icon-left .pkae-search-input {
  padding-left: 45px;
}

.pkae-icon-right .pkae-search-input {
  padding-right: 45px;
}

/* Search Button */
.pkae-search-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.pkae-search-button:hover {
  transform: translateY(-1px);
}

.pkae-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pkae-button-text {
  display: inline-block;
}

/* Results Dropdown */
.pkae-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 9999;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
}

/* Grid Layout */
.pkae-search-results.pkae-style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 15px;
}

.pkae-search-results::-webkit-scrollbar {
  width: 6px;
}

.pkae-search-results::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.pkae-search-results::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

/* Result Item (List Style) */
.pkae-result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
}

.pkae-result-item:last-child {
  border-bottom: none;
}

.pkae-result-item:hover {
  text-decoration: none;
}

/* Result Card (Grid Style) */
.pkae-result-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #f0f0f0;
}

.pkae-result-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pkae-result-card .pkae-result-thumb {
  width: 100% !important;
  height: 180px !important;
  margin: 0 !important;
  flex-shrink: 0;
}

.pkae-result-card .pkae-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pkae-result-card .pkae-result-content {
  padding: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pkae-result-card .pkae-result-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pkae-result-card .pkae-result-excerpt {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pkae-result-card .pkae-result-meta {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  font-size: 12px;
}

/* Thumbnail */
.pkae-result-thumb {
  flex-shrink: 0;
  overflow: hidden;
}

.pkae-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Result Content */
.pkae-result-content {
  flex: 1;
  min-width: 0;
}

.pkae-result-title {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #333;
}

.pkae-result-excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #666;
}

.pkae-result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 12px;
  color: #999;
}

.pkae-result-date,
.pkae-result-type {
  display: inline-block;
}

/* Loading State */
.pkae-search-loading {
  padding: 20px;
  text-align: center;
  color: #999;
}

.pkae-search-loading:after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #6040e0;
  border-radius: 50%;
  animation: pkae-spin 1s linear infinite;
}

@keyframes pkae-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* No Results */
.pkae-no-results {
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 767px) {
  .pkae-search-button .pkae-button-text {
    display: none;
  }
  
  .pkae-search-button {
    padding: 12px 15px;
  }
}
