/* Unified Search Page Styles - Using Homepage Styles */

/* Game tabs below search */
.game-tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 0;
}

.game-tabs {
  display: flex;
  flex-direction: row;
  gap: 0;
  flex: 1;
  width: 100%;
  background: rgb(22 18 16);
  border-radius: 8px 8px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
}

.game-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  color: rgba(245, 236, 221, 0.6);
  font-size: 16px;
  font-weight: 500;
  position: relative;
  margin-bottom: -1px;
  flex: 1;
}

.game-tab-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.game-tabs-results {
  font-size: 14px;
  color: rgba(245, 236, 221, 0.7);
  padding: 16px 0;
  margin-left: 24px;
  white-space: nowrap;
}

.game-tab-text {
  display: inline;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.game-tab-count {
  margin-left: 8px;
  font-size: 14px;
  color: rgba(245, 236, 221, 0.5);
  font-weight: 400;
  pointer-events: none;
}

.game-tab.active .game-tab-count {
  color: rgba(245, 236, 221, 0.8);
}

.game-tab:hover {
  color: rgba(245, 236, 221, 0.9);
  /* background: rgba(255, 255, 255, 0.03); */
}

.game-tab.active {
  color: #f5ecdd;
  border-bottom-color: rgba(245, 158, 11, 0.8);
  /* background: rgba(255, 255, 255, 0.05); */
}

.game-tab.active .game-tab-icon {
  opacity: 1;
}

/* Container and layout */
.unified-search-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 80px;
  overflow-x: visible;
}

.unified-search-content {
  display: flex;
  flex-direction: column;
}

.unified-search-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.unified-search-content .panel-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  border-radius: 0 0 8px 8px;
  padding: 20px 24px;
  background: rgb(22 18 16 / 92%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  color: #f5ecdd;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  margin-top: 0;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.unified-search-header {
  margin: 0 auto 44px;
  width: 80%;
}

.unified-search-header .search-form {
  border-radius: 4px;
  position: relative;
  overflow: visible !important; /* Allow dropdown to be visible */
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.unified-search-header .search-input {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.unified-search-header .search-field {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

/* Recent searches dropdown */

.recent-searches {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: rgb(22, 18, 16);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 50; /* Lower than clear button */
  display: none !important; /* Ensure hidden by default */
  padding: 12px 0;
  max-height: 400px;
  overflow-y: auto;
  box-sizing: border-box;
}

.recent-searches.show {
  display: block !important;
}

.recent-searches-label {
  font-size: 12px;
  color: rgba(245, 236, 221, 0.6);
  margin: 0 16px 8px 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-searches-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.recent-search-item-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0;
}

.recent-search-item {
  display: flex;
  align-items: center;
  flex-wrap: nowrap; /* Prevent wrapping */
  padding: 10px 0 10px 16px; /* Keep left padding, remove right */
  background: transparent;
  border: none;
  color: rgba(245, 236, 221, 0.8);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-align: left;
  width: fit-content; /* Fit content width, not flex */
  min-width: 0; /* Allow flex item to shrink */
  gap: 8px;
  box-sizing: border-box;
}

.recent-search-item:hover {
  color: #f5ecdd;
}

.recent-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: rgba(245, 236, 221, 0.5);
  stroke: rgba(245, 236, 221, 0.5);
}

.recent-search-text {
  flex: 1;
  min-width: 0; /* Allow text to shrink */
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-search-remove {
  display: none; /* Hidden for now */
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: none;
  color: rgba(245, 236, 221, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0; /* Never shrink */
  flex-grow: 0; /* Never grow */
  border-radius: 4px;
  margin-right: 8px; /* Add margin on the right */
}

.recent-search-remove:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 236, 221, 0.8);
}

.recent-search-remove svg {
  width: 12px;
  height: 12px;
}

.unified-search-header .search-btn {
  border-radius: 0 4px 4px 0;
}

/* Game-specific card backgrounds */
.unified-search-content .panel-layout.game-cs .card {
  background: rgb(44, 50, 51);
}

.unified-search-content .panel-layout.game-soc .card {
  background: rgb(32, 32, 32);
}

.unified-search-content .panel-layout.game-cop .card {
  background: rgb(30, 24, 20);
}

/* Game pill with icon */
.unified-search-content .game-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
}

.unified-search-content .game-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Results panel uses homepage styles - ensure it takes remaining space */
.unified-search-content .results-panel {
  flex: 1;
  min-width: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  color: #f5ecdd;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Filters sidebar - keep custom styling */
.unified-search-content .filters-card {
  position: sticky;
  top: 24px;
  align-self: flex-start;
  flex-shrink: 0;
  z-index: 10;
  width: 260px;
}

.doc-source {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  color: rgba(207, 199, 186, 0.8);
  word-break: break-all;
  overflow-wrap: anywhere;
}

.filters-card-head {
  margin-bottom: 12px;
}

.filters-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #f5ecdd;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.zero-text {
  width: 100%;
}
.filters-card-sub {
  font-size: 13px;
  color: rgba(245, 236, 221, 0.6);
  margin-top: 4px;
}

/* Override filters styling to match homepage checkbox style */
.unified-search-content .filters {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 14px;
  margin-top: 14px;
}

.unified-search-content .filters label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 4px 0;
  cursor: pointer;
  transition: opacity 0.2s;
  background: none;
  border: none;
  box-shadow: none;
  transform: none;
}

.unified-search-content .filters label:hover {
  opacity: 0.8;
  transform: none;
}

.unified-search-content .filters input {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  background: transparent;
  margin-right: 10px;
  flex-shrink: 0;
}

.unified-search-content .filters input:checked {
  background: #fff;
  border-color: #fff;
}

.unified-search-content .filters input:checked::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 8px;
  border: 2px solid #000;
  border-top: 0;
  border-left: 0;
  top: 0;
  left: 3px;
  transform: rotate(45deg);
}

.unified-search-content .filters .filter-name {
  font-weight: 400;
  text-transform: none;
  text-align: left;
  color: rgba(245, 236, 221, 0.7);
  font-size: 14px;
}

.unified-search-content .filters label.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.filters-clear {
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #f6f3ea;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.filters-clear:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Highlight toggle controls */
.highlight-toggle-controls {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.highlight-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: rgba(245, 236, 221, 0.7);
  cursor: pointer;
  user-select: none;
}

.highlight-toggle {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: rgba(245, 158, 11, 0.8);
}

.highlight-toggle-label:hover {
  color: rgba(245, 236, 221, 0.9);
}

/* Pagination controls */
.pagination-controls {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-label {
  display: block;
  font-size: 13px;
  color: rgba(245, 236, 221, 0.7);
  margin-bottom: 8px;
  font-weight: 400;
}

.items-per-page-select {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #f5ecdd;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.items-per-page-select:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.items-per-page-select:focus {
  outline: none;
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.items-per-page-select option {
  background: rgb(22, 18, 16);
  color: #f5ecdd;
  padding: 8px;
}

.items-per-page-select option:hover,
.items-per-page-select option:checked {
  background: rgba(245, 158, 11, 0.2);
  color: #f5ecdd;
}

/* Pagination buttons */
.pagination {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pagination-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(245, 236, 221, 0.8);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #f5ecdd;
}

.pagination-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #f5ecdd;
  font-weight: 600;
}

.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 0 8px;
  color: rgba(245, 236, 221, 0.5);
  font-size: 14px;
}

/* Results panel uses homepage styles - no overrides needed */
/* Cards, meta, snippets all use styles.css defaults */

/* Mobile responsive */
/* Mobile filters toggle button */
.filters-toggle-mobile {
  display: none;
}

@media (max-width: 968px) {
  .hero {
    min-height: 100px;
  }
  /* Remove horizontal padding/margins for full width */
  .search-panel {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .wrap {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .unified-search-container {
    flex-direction: column;
    gap: 16px;
    padding: 0 0 40px; /* Remove horizontal padding */
    max-width: 100%;
    margin: 0;
  }

  .unified-search-content {
    width: 100%;
  }

  .unified-search-header {
    margin-bottom: 16px; /* Reduced from 24px */
  }

  /* Mobile search button - icon only, 45x45 */
  .unified-search-header .search-form {
    position: relative;
  }

  .unified-search-header .search-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    padding: 0 !important;
    border-radius: 0 4px 4px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important; /* Hide text */
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
  }

  .unified-search-header .search-btn::before {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231c1206' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .unified-search-header .search-field {
    padding-right: 44px; /* Make room for the button */
    position: relative;
  }

  /* Clear button positioning on mobile - to the left of search button */
  .unified-search-header .search-field .clear-btn {
    position: absolute !important;
    right: 44px !important; /* Position to the left of 44px search button */
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fdfbf7 !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100 !important; /* Higher z-index to be above input and dropdown */
    opacity: 0 !important; /* Hidden by default */
    pointer-events: none !important;
    cursor: pointer !important;
  }

  .unified-search-header .search-field .clear-btn:hover {
    background: rgba(255, 255, 255, 0.24) !important;
  }

  .unified-search-header .search-field .clear-btn.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Recent search items full width on mobile */
  .recent-search-item-wrapper {
    width: 100% !important;
  }

  .recent-search-item {
    width: 100% !important;
  }

  .unified-search-content .panel-layout {
    flex-direction: column;
    gap: 0;
    padding: 12px 16px; /* Reduced from 20px 24px */
  }

  /* Show toggle button on mobile */
  .filters-toggle-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(245, 236, 221, 0.9);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    gap: 8px;
  }

  .filters-toggle-mobile:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .filters-toggle-mobile svg {
    transition: transform 0.2s ease;
    flex-shrink: 0;
  }

  .filters-toggle-mobile[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  /* Hide filters card by default on mobile */
  .unified-search-content .filters-card {
    position: relative;
    top: auto;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
      max-height 0.3s ease,
      opacity 0.3s ease,
      margin 0.3s ease;
    margin: 0;
    padding: 0;
    border: none;
  }

  /* Show filters card when expanded */
  .unified-search-content .filters-card.filters-expanded {
    max-height: 2000px;
    opacity: 1;
    margin: 0;
    padding: 12px; /* Reduced from 16px */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(22, 18, 16, 0.8);
  }

  /* Reduce card padding on mobile */
  .unified-search-content .card {
    padding: 12px 16px !important; /* Reduced padding */
  }

  /* Reduce results gap on mobile */
  .unified-search-content .results {
    gap: 12px !important; /* Reduced to 2px for mobile */
    margin-top: 0 !important; /* Remove top margin on mobile */
  }

  /* Reduce card gap on mobile */
  .unified-search-content .card {
    gap: 2px !important;
  }

  /* Reduce meta margin on mobile */
  .unified-search-content .meta {
    margin-top: 0;
    margin-bottom: 12px; /* Reduced spacing */
  }

  /* Ensure filters are visible when card is expanded */
  .unified-search-content .filters-card.filters-expanded .filters {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Ensure filters card head is visible */
  .unified-search-content .filters-card.filters-expanded .filters-card-head {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Ensure all filter labels are visible */
  .unified-search-content .filters-card.filters-expanded .filters label {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Ensure filters clear button is visible */
  .unified-search-content .filters-card.filters-expanded .filters-clear {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .game-tabs {
    position: relative;
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 columns */
    grid-template-rows: auto auto; /* 2 rows */
    order: -1;
  }

  .game-tab {
    width: 100%;
    min-width: 0; /* Allow proper grid sizing */
  }
}
