/* ==========================================================================
   Dine with Junn V2 — Universal Search Stylesheet
   ========================================================================== */

.all-page-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* --- Search Controls Card --- */
.search-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.search-bar-row {
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  pointer-events: none;
}

#searchBox {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-main);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#searchBox:focus {
  border-color: var(--accent-warm);
  box-shadow: 0 0 0 3px var(--accent-warm-subtle);
}

/* Controls & Dropdowns Row */
.filter-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Form Select / Dropdowns */
.form-select,
#sortDropdown,
#insightMetricDropdown {
  padding: 0.55rem 2.25rem 0.55rem 0.95rem;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  font-weight: 500;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: var(--bg-card-muted);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg2+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.form-select:hover,
#sortDropdown:hover,
#insightMetricDropdown:hover {
  border-color: var(--accent-warm);
  background-color: var(--bg-card-hover);
}

.form-select:focus,
#sortDropdown:focus,
#insightMetricDropdown:focus {
  border-color: var(--accent-warm);
  box-shadow: 0 0 0 2px var(--accent-warm-subtle);
}

/* Action Buttons */
.btn-toggle,
#toggleSourceButton {
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card-muted);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-toggle:hover,
#toggleSourceButton:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.btn-insight,
#showInsightButton {
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--accent-warm);
  background: var(--accent-warm);
  color: #ffffff !important;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-insight:hover,
#showInsightButton:hover {
  background: var(--accent-warm-hover);
  border-color: var(--accent-warm-hover);
}

.insights-controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.result-counter,
#resultCount {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Insights Panel */
.insights-panel {
  margin-top: 0.5rem;
  background: var(--bg-card-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
}

.insights-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.insights-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.insights-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 205px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.insights-list::-webkit-scrollbar {
  width: 5px;
}

.insights-list::-webkit-scrollbar-track {
  background: var(--bg-surface);
  border-radius: 4px;
}

.insights-list::-webkit-scrollbar-thumb {
  background: var(--accent-warm);
  border-radius: 4px;
}

.insights-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease;
  flex-shrink: 0;
}

.insights-item:hover {
  border-color: var(--accent-warm);
}

/* Search Results Area */
.search-results-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.view-heading {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-item-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--card-shadow-hover);
}

.search-item-media {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card-muted);
  border: 1px solid var(--border-subtle);
}

.search-item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-item-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.search-dish-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.search-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-green);
}

.search-price s {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 0.25rem;
}

.search-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.search-vendor {
  color: var(--accent-warm);
  font-weight: 600;
}

.search-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.search-date-link {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Monthly Summary Prose Scrollbox (Contained instead of vertical blowout) */
.summary-prose-scrollbox {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.85rem 1.1rem;
  margin: 0.6rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-card-muted);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.summary-prose-scrollbox small,
.search-desc small {
  font-size: 0.84em;
  color: var(--text-muted);
  display: inline;
}

.summary-prose-scrollbox::-webkit-scrollbar {
  width: 6px;
}

.summary-prose-scrollbox::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

@media (max-width: 768px) {
  .search-item-card { flex-direction: column; }
  .search-item-media { width: 100%; height: 200px; }
  .filter-controls-row { flex-direction: column; align-items: stretch; }
  .filter-actions-group { flex-direction: column; align-items: stretch; }
  .form-select, #sortDropdown, #insightMetricDropdown, .btn-toggle, #toggleSourceButton { width: 100%; }
}

/* Floating Key Schedule Popover */
.schedule-popover-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-schedule-badge {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: inherit;
  line-height: 1.3;
}

.btn-schedule-badge:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.6);
  color: #7dd3fc;
}

.schedule-popover-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  min-width: 250px;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  padding: 0.75rem 0.9rem;
}

.schedule-popover-container:hover .schedule-popover-panel,
.schedule-popover-container.is-open .schedule-popover-panel {
  display: block;
}

.schedule-popover-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.schedule-popover-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.schedule-popover-list li {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-secondary);
  position: relative;
  padding-left: 0.85rem;
}

.schedule-popover-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #38bdf8;
  font-weight: bold;
}
