/**
 * Package Search Popup Styles
 */

/* Overlay */
.twicely-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 999999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Popup Container */
.twicely-search-popup {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  margin: auto;
  animation: slideUp 0.3s ease;
  border: 2px solid black;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.twicely-search-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 2px solid black;
}

.twicely-search-header-content {
  flex: 1;
}

.twicely-search-title {
  font-family: 'Recoleta', 'Recoleta Alt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: #000;
}

.twicely-search-subtitle {
  font-size: 0.875rem;
  color: #666;
  margin: 0;
  line-height: 1.5;
}

.twicely-search-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  transition: opacity 0.2s;
}

.twicely-search-close:hover {
  opacity: 0.7;
}

/* Search Input */
.twicely-search-input-wrapper {
  position: relative;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e0e0e0;
}

.twicely-search-input-icon {
  position: absolute;
  left: 3rem;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  pointer-events: none;
}

.twicely-search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 2px solid black;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.twicely-search-input:focus {
  border-color: #083FB9;
}

/* Filters */
.twicely-search-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e0e0e0;
  background-color: #f9f9f9;
}

.twicely-search-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.twicely-search-filter-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
}

.twicely-search-filter-input,
.twicely-search-filter-select {
  padding: 0.625rem 0.875rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.twicely-search-filter-input:focus,
.twicely-search-filter-select:focus {
  border-color: #083FB9;
}

/* Results */
.twicely-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  padding-bottom: 5rem; /* Space for fixed footer */
  font-family: 'Recoleta', 'Recoleta Alt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Results Summary */
.twicely-search-results-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.twicely-search-results-summary-text {
  font-size: 0.875rem;
  color: #666;
  font-weight: 500;
}

.twicely-search-results-summary-count {
  font-size: 0.875rem;
  color: #000;
  font-weight: 600;
}

.twicely-search-loading,
.twicely-search-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
  font-size: 1rem;
}

.twicely-search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .twicely-search-results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .twicely-search-results-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Result Card - Match package grid exactly */
.twicely-search-result-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border-radius: 25px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.twicely-search-result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid black;
  border-radius: 25px;
  pointer-events: none;
  z-index: 1;
  box-sizing: border-box;
}

.twicely-search-result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.twicely-search-result-card:hover::before {
  border: 2px solid black;
}

.twicely-search-result-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 aspect ratio */
  overflow: hidden;
  background-color: #f0f0f0;
  border-bottom: 1.5px solid black;
}

.twicely-search-result-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: center;
}

.twicely-search-result-image-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e0e0e0;
  color: #999;
  font-size: 0.875rem;
}

.twicely-search-result-discount {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #a0dbff;
  color: #000000;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  z-index: 2;
  border: 1px solid black;
  font-family: 'Recoleta', 'Recoleta Alt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.twicely-search-result-content {
  padding: 1rem 1.25rem 1.25rem;
}

/* Category and Like Row - Match package grid */
.twicely-search-result-category-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.twicely-search-result-categories {
  flex: 1;
}

.twicely-search-result-category-text {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Main category colors - Match package grid */
.twicely-category-main.twicely-category-for-him {
  color: #0691d7 !important;
}

.twicely-category-main.twicely-category-for-her {
  color: #ff014e !important;
}

.twicely-category-main.twicely-category-biz {
  color: #325d24 !important;
}

.twicely-category-main.twicely-category-general {
  color: #0691d7 !important;
}

/* Secondary category - black */
.twicely-category-secondary {
  color: #000000;
}

/* Separator - black */
.twicely-category-separator {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.twicely-category-separator-icon {
  width: 12px;
  height: 12px;
  color: #000000;
  stroke: currentColor;
  fill: none;
  display: inline-block;
}

/* Like button - Match package grid */
.twicely-package-like-btn-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
}

.twicely-package-like-btn-inline:hover {
  color: #fbbd03;
}

.twicely-package-like-btn-inline:hover .twicely-heart-icon {
  fill: #fbbd03;
  stroke: #fbbd03;
}

.twicely-package-like-btn-inline.is-liked {
  color: #fbbd03;
}

.twicely-package-like-btn-inline.is-liked .twicely-heart-icon {
  fill: #fbbd03 !important;
  stroke: #000000 !important;
  stroke-width: 1.5;
}

.twicely-package-like-btn-inline.is-liked .twicely-heart-icon path {
  fill: #fbbd03 !important;
  stroke: #000000 !important;
  stroke-width: 1.5;
}

.twicely-heart-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  transition: all 0.2s ease;
}

.twicely-like-count-number {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  color: black;
}

.twicely-search-result-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'Recoleta', 'Recoleta Alt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.twicely-search-result-pricing {
  display: flex;
  align-items: baseline;
  margin-bottom: 0.75rem;
  flex-direction: column;
}

.twicely-search-result-original-price {
  font-size: 0.875rem;
  color: #999;
  text-decoration: line-through;
}

.twicely-search-result-discounted-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: #273db7;
  font-family: 'Recoleta', 'Recoleta Alt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.twicely-search-result-owner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.twicely-search-result-owner-avatar {
  width: 34px;
  height: 34px !important;
  border-radius: 50%;
  object-fit: cover;
  border-radius: 50% !important;
}

.twicely-search-result-owner-name {
  font-size: 0.8125rem;
  color: #000000;
}

/* Pagination Footer - Fixed at bottom */
.twicely-search-pagination-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: #ffffff;
  border-top: 2px solid black;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.twicely-search-pagination-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: 2px solid black;
  border-radius: 8px;
  background: white;
  color: #000;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.twicely-search-pagination-btn:hover:not(:disabled) {
  background: #000;
  color: white;
}

.twicely-search-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.twicely-search-pagination-info {
  font-size: 0.875rem;
  color: #666;
}

/* Responsive */
@media (max-width: 768px) {
  .twicely-search-overlay {
    padding: 0;
  }

  .twicely-search-popup {
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
  }

  .twicely-search-header {
    padding: 1rem 1.5rem;
  }

  .twicely-search-title {
    font-size: 1.25rem;
  }

  .twicely-search-input-wrapper {
    padding: 1rem 1.5rem;
  }

  .twicely-search-filters {
    grid-template-columns: 1fr;
    padding: 1rem 1.5rem;
  }

  .twicely-search-results {
    padding: 1.5rem;
  }

  .twicely-search-results-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .twicely-search-pagination {
    flex-direction: column;
    gap: 0.75rem;
  }
}
