/* --- CATEGORY HEADER & TOP UI --- */

.category-header-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column; /* Stack date above carousel */
    justify-content: center;
    align-items: center;
    margin-bottom: 2vh;
    min-height: 100px; /* Increased to accommodate date + icons */
}

.top-category-header {
  font-family: 'Cinzel Decorative', 'Abril Fatface', cursive;
  font-size: calc(1.2rem + 6pt);
  word-spacing: 4px;
  letter-spacing: -0.01em;
  padding: 8px 16px;
  margin: 0;
  background: none;
  color: var(--text-color) !important;
  border-radius: 5px;
  text-transform: uppercase;
  display: none;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 1;
  font-weight: bold;
}

@keyframes categoryCenterIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.top-category-header.category-animate-in,
.category-display.category-animate-in {
  animation: categoryCenterIn 0.65s ease-out;
}

.category-header-icon {
    width: 48px; /* Increased size by 8px (approx 6pt) */
    height: 48px;
    background-color: currentColor;
    -webkit-mask-image: var(--cat-header-icon);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: var(--cat-header-icon);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    display: inline-block;
    margin-right: 12px; /* Decreased margin to keep overall horizontal spacing unchanged (20px - 8px) */
    flex-shrink: 0;
}

.category-idle-carousel {
  font-family: 'Cinzel Decorative', 'Abril Fatface', cursive;
  font-size: calc(1.2rem + 6pt);
  word-spacing: 4px;
  padding: 8px 16px;
  margin: 0;
  background: none;
  color: var(--text-color) !important;
  border-radius: 5px;
  text-transform: uppercase;
  display: none;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
  font-weight: bold;
  letter-spacing: 0.08em;
}

@media (min-width: 769px) {
  [data-bg-desktop-hidden="false"] .category-idle-carousel,
  [data-bg-desktop-hidden="false"] .category-display,
  [data-bg-desktop-hidden="false"] .top-category-header {
    color: #ffffff !important;
  }
  
  /* Ensure date icons remain neat and legible against background */
  [data-bg-desktop-hidden="false"] .idle-date-icon {
     box-shadow: 0 4px 12px rgba(0,0,0,0.6);
     border: 1px solid rgba(255,255,255,0.4);
  }
}

.sort-rating-ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 500;
    transition: transform 0.2s, opacity 0.3s;
    user-select: none;
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
}

.sort-rating-ball.visible { opacity: 1; pointer-events: auto; }
.sort-rating-ball:hover { transform: translateY(-50%) scale(1.1); }
[data-theme^="light"] .sort-rating-ball { color: #000000 !important; }
.sort-rating-ball::after { content: '▼'; font-size: 0.8em; }
.sort-rating-ball.asc::after { content: '▲'; }

.top-category-header .category-prefix,
.category-display .category-prefix {
  font-size: 0.6875em;
  opacity: 0.8;
  margin-right: 0.5em;
  white-space: nowrap;
}

.category-prefix .result-count { font-size: 1.6em; font-weight: bold; opacity: 1; cursor: pointer; text-decoration: underline; }

.top-category-header .category-main-term,
.category-display .category-main-term {
    font-size: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-display {
  font-family: 'Cinzel Decorative', 'Abril Fatface', cursive;
  font-size: calc(1.2rem + 6pt);
  word-spacing: 4px;
  letter-spacing: -0.01em;
  padding: 8px 16px;
  margin: 20px;
  background: none;
  color: var(--text-color);
  border-radius: 5px;
  text-transform: uppercase;
  display: none;
  align-items: center;
  position: sticky;
  top: 2vh;
  z-index: 999;
  opacity: 1;
  transition: opacity 0.5s;
  font-weight: bold;
}

.category-display.visible { display: flex; opacity: 0.85; }
.category-display.fade { opacity: 0; }

.search-container {
  width: 90%;
  max-width: 800px;
  margin: 0 auto 4vh;
  display: flex;
  gap: 1vw;
  justify-content: center;
  padding: 0 2vw;
  box-sizing: border-box;
}

#searchInput {
  padding: 1.5vh 2vw;
  font-size: 1rem;
  border-radius: 5px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  flex-grow: 1;
}

#searchInput::placeholder { color: #ffffff !important; }
#searchInput:focus { background-color: rgba(0, 0, 0, 0.9); border-color: var(--primary-color); outline: none; }

@media (min-width: 769px) {
    #searchInput { flex-grow: 0; width: 70%; text-align: center; }
    #searchInput::placeholder { text-align: center; }
}

[data-theme^="light"] #searchInput {
  background-color: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0,0,0,0.12) !important;
}
[data-theme^="light"] #searchInput::placeholder { color: #666666 !important; }

/* Statistics Update Icons */
.persistent-date-display {
    position: fixed;
    top: 2vh;
    left: 2vw;
    z-index: 1000;
    display: flex;
    justify-content: flex-start;
    pointer-events: none; /* Let clicks pass through to whatever is underneath */
}

.idle-update-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    vertical-align: middle;
}

.idle-date-icon {
    font-family: 'Roboto', sans-serif;
    font-size: 0.75rem; /* Slightly larger */
    font-weight: 900;
    color: #000;
    background: var(--primary-color);
    padding: 4px 7px;
    border-radius: 4px;
    min-width: 32px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Middle icon has inverted colors for visual distinction (Month Day) */
.idle-date-icon.day-num {
    background: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* Year icon: dark background with light text */
.idle-date-icon.year-num {
    background: #000;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.6);
}

/* Light theme overrides */
[data-theme^="light"] .idle-date-icon {
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
[data-theme^="light"] .idle-date-icon:not(.day-num) {
    color: #fff;
}