/* =========================================================
   ROT Archive — App Header, Search Button, Filter Drawer
   Matches: rot-app-* / rot-drawer-* class structure
   ========================================================= */

/* ===== 1. Theme / Container Overrides ===== */
body.post-type-archive-rot_package .site-content,
body.post-type-archive-rot_package #primary,
body.post-type-archive-rot_package #content,
body.post-type-archive-rot_package .ast-container {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.post-type-archive-rot_package .site-content .ast-container {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Hide old archive UI if it still exists anywhere */
.rot-package-scope .rot-archive-hero,
.rot-package-scope .rot-archive-stat,
.rot-package-scope .rot-archive-results-head,
.rot-package-scope .rot-archive-filters,
.rot-package-scope .rot-filter-drawer,
.rot-package-scope .rot-search-wrapper {
  display: none !important;
}

.rot-package-scope {
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-family: "Jost", sans-serif;
  color: #0f172a;

  --rot-card-bg: #ffffff;
  --rot-card-border: rgba(15, 23, 42, 0.08);
  --rot-card-shadow: 0 16px 38px rgba(15, 23, 42, 0.10);
  --rot-card-shadow-hover: 0 26px 64px rgba(15, 23, 42, 0.18);
  --rot-accent: #e53935;
  --rot-accent-strong: #b71c1c;
  --archive-green: #094222;
  --archive-muted: #64748b;
  --archive-surface: #ffffff;
  --archive-surface-2: #f8fafc;
  --archive-line: rgba(15, 23, 42, 0.10);
  --archive-shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.06);
}

.rot-package-scope *,
.rot-package-scope *::before,
.rot-package-scope *::after {
  box-sizing: border-box;
}

.rot-package-scope a {
  text-decoration: none !important;
}

.rot-package-scope h1,
.rot-package-scope h2,
.rot-package-scope h3,
.rot-package-scope .rot-app-title,
.rot-package-scope .rigel-card-title {
  font-family: "Archivo", sans-serif;
}

/* ===== 2. Main Shell ===== */
.rot-package-scope.rot-archive-shell {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 40px 3% 80px;
}

/* ===== 3. Header ===== */
.rot-app-header {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  margin: 0 0 20px !important;
  padding: 0 0 20px !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  position: relative !important;
  z-index: 9999 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.rot-app-title-group {
  min-width: 0;
  flex: 1 1 auto;
}

.rot-app-title {
  margin: 0 !important;
  font-size: clamp(28px, 3.2vw, 44px) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.04em !important;
  font-weight: 800 !important;
  color: #094222 !important;
}

/* ===== 4. Buttons: Search + Filter ===== */
.rot-app-actions {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex: 0 0 auto !important;
  position: relative !important;
  z-index: 10000 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.rot-app-btn {
  height: 48px !important;
  min-width: 48px !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #094222 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  transition: transform 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease !important;
  visibility: visible !important;
  opacity: 1 !important;
  white-space: nowrap !important;
}

.rot-app-btn:hover {
  background: #f8fafc !important;
  border-color: #0ea5a5 !important;
  color: #0ea5a5 !important;
  transform: translateY(-1px) !important;
}

.rot-app-btn:focus-visible {
  outline: 2px solid rgba(14, 165, 165, 0.35) !important;
  outline-offset: 2px !important;
}

.rot-app-btn.is-filtered-active {
  background: #0ea5a5 !important;
  border-color: #0ea5a5 !important;
  color: #ffffff !important;
}

.rot-app-btn svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  stroke: currentColor !important;
  fill: none !important;
}

.rot-app-btn-text {
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  display: block !important;
}

/* ===== 5. Collapsible Search ===== */
.rot-app-search-wrap {
  display: flex !important;
  align-items: center !important;
  flex-direction: row-reverse !important;
  position: relative !important;
  flex: 0 0 auto !important;
  z-index: 10001 !important;
}

.rot-app-search-form {
  width: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  margin: 0 !important;
  display: block !important;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease !important;
}

.rot-app-search-wrap.is-expanded .rot-app-search-form {
  width: 260px !important;
  opacity: 1 !important;
  margin-right: 8px !important;
}

.rot-app-search-input {
  width: 100% !important;
  height: 48px !important;
  border-radius: 999px !important;
  border: 1px solid #cbd5e1 !important;
  padding: 0 20px !important;
  font-size: 14px !important;
  outline: none !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  box-sizing: border-box !important;
}

.rot-app-search-input:focus {
  border-color: rgba(14, 165, 165, 0.35) !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 165, 0.10) !important;
  background: #ffffff !important;
}

/* -------------------------------------------------------------------------
 * Mobile layout tweaks for archive page
 *
 * Align the search and filter controls horizontally and reduce side padding.
 * The header wraps into two lines with the actions occupying the full width
 * below the title on small screens. Search forms expand to full width when
 * opened.
 * ----------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* Wrap the header so that the actions sit below the title group */
  .rot-app-header {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
  }

  /* Actions bar occupies full width and spaces buttons evenly */
  .rot-app-actions {
    width: 100% !important;
    margin-top: 8px !important;
    display: flex !important;
    justify-content: space-between !important;
  }

  /* Expand search form to 100% width when open on mobile */
  .rot-app-search-wrap.is-expanded .rot-app-search-form {
    width: 100% !important;
    margin-right: 0 !important;
  }

  /* Hide the text label on the filter trigger to reduce its footprint on mobile */
  .rot-filter-trigger .rot-app-btn-text {
    display: none !important;
  }

  /* Set the archive shell to full width with only 10px horizontal padding on mobile.
   * Removing top/bottom padding makes the layout flush while providing the requested
   * side margins. */
  .rot-package-scope.rot-archive-shell {
    width: 100% !important;
    padding: 0 10px !important;
  }

  /* Scale down the search and filter icons for a more balanced appearance on mobile */
  .rot-app-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
}

/* ===== 6. Filter Drawer ===== */
.rot-app-drawer {
  width: 100% !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  display: block !important;
  position: relative !important;
  z-index: 9998 !important;
  transition: max-height 0.4s ease, margin 0.3s ease, opacity 0.3s ease !important;
}

.rot-app-drawer.is-open {
  max-height: 220px !important;
  margin-bottom: 30px !important;
  opacity: 1 !important;
}

.rot-app-drawer-form {
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
  padding: 15px !important;
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
}

.rot-drawer-fields {
  display: flex !important;
  flex: 1 1 auto !important;
  gap: 15px !important;
  min-width: 0 !important;
}

.rot-drawer-actions {
  display: flex !important;
  gap: 15px !important;
  flex: 0 0 auto !important;
}

.rot-app-select {
  width: 100% !important;
  height: 48px !important;
  padding: 0 16px !important;
  border-radius: 10px !important;
  border: 1px solid #cbd5e1 !important;
  background-color: #f8fafc !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  outline: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
}

.rot-app-select:focus {
  border-color: rgba(14, 165, 165, 0.35) !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 165, 0.10) !important;
  background-color: #ffffff !important;
}

.rot-app-submit,
.rot-app-reset {
  height: 48px !important;
  padding: 0 24px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  cursor: pointer !important;
  border: none !important;
  white-space: nowrap !important;
  transition: transform 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease !important;
}

.rot-app-submit {
  background-color: #0ea5a5 !important;
  color: #ffffff !important;
}

.rot-app-reset {
  background-color: transparent !important;
  color: #64748b !important;
  border: 1px solid #cbd5e1 !important;
}

.rot-app-submit:hover,
.rot-app-reset:hover {
  transform: translateY(-1px) !important;
}

.rot-app-submit:hover {
  filter: brightness(1.03) !important;
}

.rot-app-reset:hover {
  background: #ffffff !important;
  border-color: rgba(14, 165, 165, 0.25) !important;
  color: #094222 !important;
}

/* ===== 7. Archive Grid ===== */
.rot-package-scope .rot-archive-grid {
  width: 100%;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

/* ===== 8. Cards ===== */
.rot-package-scope .rigel-pkg-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--rot-card-bg);
  border: 1px solid var(--rot-card-border);
  box-shadow: var(--rot-card-shadow);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.rot-package-scope .rigel-pkg-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--rot-card-shadow-hover);
}

.rot-package-scope .rigel-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 24px;
}

.rot-package-scope .rigel-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.86;
  transition: transform 0.55s ease, opacity 0.55s ease;
}

.rot-package-scope .rigel-pkg-card:hover .rigel-card-img-wrap img {
  transform: scale(1.07);
  opacity: 1;
}

.rot-package-scope .rigel-card-img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.05) 0%, rgba(2, 6, 23, 0.58) 70%, rgba(2, 6, 23, 0.90) 100%);
  z-index: 1;
}

.rot-package-scope .rot-featured-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  pointer-events: none;
}

.rot-package-scope .rigel-card-title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(18px, 1.7vw, 22px);
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.rot-package-scope .rigel-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  pointer-events: auto;
}

.rot-package-scope .rigel-card-price {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rot-package-scope .rigel-price-val {
  font-size: 18px;
  font-weight: 900;
  color: #094222;
}

.rot-package-scope .rigel-card-cta .orion-btn-card {
  background: linear-gradient(135deg, var(--rot-accent-strong), var(--rot-accent));
  color: #ffffff !important;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none !important;
  white-space: nowrap;
}

/* ===== 9. Pagination & Empty State ===== */
.rot-package-scope .rot-pagination {
  margin: 34px 0 0;
  padding: 0 0 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.rot-package-scope .rot-pagination a,
.rot-package-scope .rot-pagination span {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--archive-line);
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  text-decoration: none !important;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.rot-package-scope .rot-pagination a:hover {
  background: var(--archive-surface-2);
  border-color: rgba(9, 66, 34, 0.22);
  transform: translateY(-1px);
}

.rot-package-scope .rot-pagination .current {
  background: #094222;
  color: #ffffff;
  border-color: #094222;
}

.rot-package-scope .rot-archive-empty {
  width: 100%;
  padding: 32px 0 10px;
  text-align: center;
}

.rot-package-scope .rot-archive-empty h3 {
  margin: 0 0 8px;
  color: #094222;
  font-size: 24px;
  line-height: 1.2;
}

.rot-package-scope .rot-archive-empty p {
  margin: 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.6;
}

/* ===== 10. Responsive ===== */
@media (max-width: 1024px) {
  .rot-package-scope .rot-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .rot-archive-shell {
    padding: 24px 16px 30px !important;
  }

  .rot-app-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding-bottom: 16px !important;
  }
  .rot-package-scope .rigel-card-price {
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

  .rot-app-actions {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .rot-app-search-wrap {
    flex: 1 1 auto !important;
  }

  .rot-app-search-wrap.is-expanded .rot-app-search-form {
    width: 100% !important;
  }

  .rot-app-btn {
    flex: 1 1 0 !important;
    justify-content: center !important;
  }

  .rot-app-title {
    font-size: clamp(20px, 8vw, 32px) !important;
  }

  .rot-app-drawer.is-open {
    max-height: 420px !important;
  }

  .rot-app-drawer-form {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 14px !important;
  }

  /* Row 1: Sort + Category */
  .rot-drawer-fields {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
  }

  .rot-drawer-fields .rot-app-select {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  /* Row 2: Apply + Reset */
  .rot-drawer-actions {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
  }

  .rot-drawer-actions .rot-app-submit,
  .rot-drawer-actions .rot-app-reset {
    flex: 1 1 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .rot-package-scope .rot-archive-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .rot-app-btn {
    height: 46px !important;
    padding: 0 12px !important;
    border-radius: 13px !important;
  }

  .rot-app-btn-text {
    font-size: 12px !important;
  }

  .rot-app-search-wrap.is-expanded .rot-app-search-form {
    width: 100% !important;
  }

  .rot-app-search-input,
  .rot-app-select,
  .rot-app-submit,
  .rot-app-reset {
    height: 48px !important;
    border-radius: 13px !important;
  }
}