/* ==========================================================================
   HPI Image Audit — Notes & Reviews page (reviews.html)
   Reuses HPI brand variables/colors defined in css/style.css (loaded first).
   ========================================================================== */

/* ---------------- Type tabs (Images / Documents / Videos / Products) ---------------- */
:root { --type-tabs-h: 48px; }

.reviews-type-tabs {
  background: var(--hpi-charcoal);
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: var(--header-h);
  z-index: 95;
  max-width: none;
  margin: 0;
  padding: 0 20px;
  height: var(--type-tabs-h);
  display: flex;
  align-items: stretch;
}

.reviews-type-tabs-inner {
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.reviews-type-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--hpi-gray-400);
  padding: 0 16px;
  border-radius: 0;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.reviews-type-tab i { color: var(--hpi-gray-400); }

.reviews-type-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--hpi-white);
}

.reviews-type-tab:hover i { color: var(--hpi-gray-200); }

.reviews-type-tab.active {
  background: transparent;
  border-bottom-color: var(--hpi-red);
  color: var(--hpi-white);
}

.reviews-type-tab.active i { color: var(--hpi-red); }

.reviews-type-panel { display: none; }
.reviews-type-panel.active { display: block; }

/* ---------------- Toolbar (reviewer/category/star/notes/search/sort/export) ---------------- */
.reviews-toolbar {
  background: var(--hpi-charcoal);
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: calc(var(--header-h) + var(--type-tabs-h));
  z-index: 90;
  padding: 14px 20px;
}

.reviews-toolbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
}

/* Mobile-only collapsible header for the filter/sort section (see the
   <=768px media query below for the actual collapse behavior). Hidden
   entirely on desktop, where filters are always shown in-flow. */
.reviews-toolbar-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  color: var(--hpi-white);
  padding: 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.reviews-toolbar-toggle span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reviews-toolbar-toggle i { color: var(--hpi-red); }

.reviews-toolbar-toggle-chevron {
  color: var(--hpi-gray-400) !important;
  transition: transform 0.2s ease;
}

.reviews-toolbar-toggle.open .reviews-toolbar-toggle-chevron {
  transform: rotate(180deg);
}

.reviews-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reviews-field label {
  color: var(--hpi-gray-400);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.reviews-field select,
.reviews-field input[type="text"] {
  background: var(--hpi-charcoal-2);
  border: 1px solid #3a3a3a;
  color: var(--hpi-white);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.reviews-field select:focus,
.reviews-field input[type="text"]:focus {
  outline: none;
  border-color: var(--hpi-red);
}

.reviews-field-search { flex: 1 1 200px; min-width: 180px; }
.reviews-field-search input { width: 100%; }

.reviews-field-checkbox {
  justify-content: flex-end;
  padding-bottom: 8px;
}

.reviews-checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--hpi-gray-400);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.reviews-checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--hpi-red);
  cursor: pointer;
}

.reviews-export-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hpi-red);
  border: none;
  color: var(--hpi-white);
  padding: 9px 16px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  margin-left: auto;
  transition: background 0.15s;
}

.reviews-export-btn:hover { background: var(--hpi-red-dark); }
.reviews-export-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Summary cards ---------------- */
.reviews-summary {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 20px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.reviewer-summary-card {
  background: var(--hpi-white);
  border: 1px solid var(--hpi-gray-200);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.reviewer-summary-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--hpi-black);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reviewer-summary-name i { color: var(--hpi-red); }

.reviewer-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.reviewer-summary-stat {
  display: flex;
  flex-direction: column;
}

.reviewer-summary-stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--hpi-black);
  line-height: 1.1;
}

.reviewer-summary-stat-value.stars { color: var(--hpi-red); }
.reviewer-summary-stat-value.notes { color: #1a8f3c; }

.reviewer-summary-stat-label {
  font-size: 0.62rem;
  color: var(--hpi-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-top: 1px;
}

/* ---------------- Result list ----------------
   Cards here intentionally reuse the SAME classes as the main audit page's
   image cards (.image-card, .card-thumb-wrap, .card-body, .card-category,
   .card-product-name, .card-stars, .card-notes-toggle/.card-notes-form,
   .card-notes-list/.card-note-item, .card-vehicle-make/.vehicle-make-btn,
   .card-image-url — all defined in css/style.css, loaded before this file)
   so the two pages look and behave identically, and any rating/note/
   vehicle-make edit made here updates the exact same shared data the main
   page reads. A small custom class below (.review-card-rater-line) adds
   page-specific context the main page doesn't need. */
#reviews-main-content,
#docs-main-content,
#videos-main-content,
#products-rv-main-content {
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 20px 20px;
}

.reviews-products-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.reviews-result-count {
  font-size: 0.8rem;
  color: var(--hpi-gray-600);
  margin: 0 0 12px;
  font-weight: 600;
}

.reviews-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.review-card-rater-line {
  font-size: 0.72rem;
  color: var(--hpi-gray-600);
  margin: -4px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.review-card-rater-line i { color: var(--hpi-gray-400); }

/* ---------------- Responsive ---------------- */
@media (max-width: 768px) {
  /* Filters/Sort collapses behind a tap-to-expand header on mobile so it
     doesn't cover the whole screen by default — previously the full field
     grid always rendered in-flow here, pushing the actual review results
     far below the fold on small screens. Plain display:none/flex toggle
     (same robust pattern used for the category menu on index.html) driven
     by JS toggling the .open class on both the toggle button and the
     fields container. */
  .reviews-toolbar-toggle { display: flex; }

  .reviews-toolbar-inner {
    display: none;
    margin-top: 14px;
    gap: 10px;
  }

  .reviews-toolbar-inner.open { display: flex; }

  .reviews-field { flex: 1 1 45%; }
  .reviews-field-search { flex: 1 1 100%; }
  .reviews-field-checkbox { flex: 1 1 100%; justify-content: flex-start; padding-bottom: 4px; }
  .reviews-export-btn { flex: 1 1 100%; justify-content: center; margin-left: 0; }

  .reviews-summary { grid-template-columns: 1fr; padding: 14px 14px 0; }
  #reviews-main-content,
  #docs-main-content,
  #videos-main-content,
  #products-rv-main-content { padding: 12px 14px 20px; }

  .reviews-list { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

  :root { --type-tabs-h: 42px; }
  .reviews-type-tabs { padding: 0 10px; }
  .reviews-type-tabs-inner { gap: 2px; justify-content: space-between; }
  .reviews-type-tab { flex: 1 1 auto; padding: 0 6px; font-size: 0.65rem; gap: 4px; }

  .reviews-products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
