/* =========================================================
   Base page layout
   ========================================================= */

body.subjects-search-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.subjects-search-body .site-footer {
  width: 100%;
  margin-top: auto;
  margin-bottom: 0;
}

body.subjects-search-body .tiles-container {
  display: block !important;

  width: 100% !important;
  max-width: none !important;

  margin: 0 !important;
  padding: 0 !important;

  background: #ffffff;
  border-radius: 0 !important;
  box-sizing: border-box;
}

/* =========================================================
   Search page
   ========================================================= */

.subjects-search-page {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 48px;

  font-family: Arial, sans-serif;
  box-sizing: border-box;
}

/* =========================================================
   Search form
   ========================================================= */

.subjects-search-form {
  width: min(700px, 100%);
  margin: 0 auto 26px;
}

.subjects-search-box {
  display: flex;
  align-items: center;
  gap: 12px;

  width: 100%;
  min-height: 58px;

  padding: 6px 12px 6px 18px;

  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  box-sizing: border-box;

  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.subjects-search-box:focus-within {
  border-color: #0e460e;
  box-shadow: 0 0 0 4px rgba(14, 70, 14, 0.12);
}

.subjects-search-box__icon {
  flex: 0 0 auto;

  color: #667085;
  font-size: 1rem;
}

.subjects-search-box__input {
  flex: 1;
  min-width: 0;

  padding: 10px 0;

  color: #101828;
  background: transparent;
  border: 0;
  outline: 0;

  font: inherit;
  font-size: 1rem;
}

.subjects-search-box__input::placeholder {
  color: #667085;
}

.subjects-search-box__clear {
  display: grid;
  flex: 0 0 auto;

  width: 36px;
  height: 36px;
  place-items: center;

  padding: 0;

  color: #667085;
  background: #f2f4f7;
  border: 0;
  border-radius: 50%;

  cursor: pointer;
}

.subjects-search-box__clear[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .subjects-search-box__clear:hover {
    color: #101828;
    background: #e4e7ec;
  }
}

/* =========================================================
   Search result count
   ========================================================= */

.subjects-search-status {
  width: 100%;
  max-width: 1500px;
  min-height: 24px;

  margin: 0 auto 14px;

  color: black;
  font-size: 1.15rem;
}

.subjects-search-status:empty {
  display: none;
}

/* =========================================================
   Loading state
   ========================================================= */

.subjects-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  min-height: 160px;

  color: #0e460e;
  font-size: 1rem;
  font-weight: 600;
}

.subjects-search-loading[hidden] {
  display: none;
}

/* =========================================================
   Thumbnail-only results grid
   ========================================================= */

.search-video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;

  width: 100%;
  max-width: 1500px;

  margin: 0 auto;
}

/*
  Overrides the global ".tiles-container a" rule from main.css.
*/
.tiles-container .search-video-link,
.search-video-link {
  display: block !important;
  flex: none !important;

  width: 100% !important;
  height: auto !important;
  min-width: 0;

  color: inherit;
  text-decoration: none;
}



/* Hide all title, topic and menu information. */
.search-video-info {
  display: none;
}

/* =========================================================
   Video thumbnails
   ========================================================= */

.search-video-thumbnail {
  position: relative;
  overflow: hidden;

  width: 100%;
  aspect-ratio: 16 / 9;

  background: #e5e7eb;
  border: 0;
  border-radius: 12px;
}

.search-video-thumbnail img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
}

/*
  Hide the play button and duration to create a clean,
  Netflix-style thumbnail grid.
*/
.search-video-play,
.search-video-duration {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .search-video-link:hover .search-video-card {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
    transform: translateY(-4px);
  }
}

/* Keyboard focus */
.search-video-link:focus-visible {
  border-radius: 12px;
  outline: 3px solid #0e460e;
  outline-offset: 3px;
}

/* =========================================================
   Empty state
   ========================================================= */

.subjects-search-empty {
  width: min(700px, 100%);

  margin: 30px auto 0;
  padding: 44px 20px;

  text-align: center;

  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  box-sizing: border-box;
}

.subjects-search-empty[hidden] {
  display: none;
}

.subjects-search-empty > i {
  margin-bottom: 16px;

  color: #0e460e;
  font-size: 2.25rem;
}

.subjects-search-empty h2 {
  margin: 0 0 8px;
}

.subjects-search-empty p {
  margin: 0;
  color: #667085;
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {
  .subjects-search-page {
    padding-right: 16px;
    padding-left: 16px;
  }

  .search-video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 480px) {
  .subjects-search-page {
    padding: 0 10px 34px;
  }

  .subjects-search-form {
    margin-bottom: 20px;
  }

  .subjects-search-box {
    min-height: 50px;
    padding: 4px 10px 4px 14px;
    border-radius: 999px;
  }

  .subjects-search-box__input {
    font-size: 16px;
  }

  .subjects-search-box__clear {
    width: 32px;
    height: 32px;
  }

  .subjects-search-status {
    margin-bottom: 10px;
    font-size: 1rem;
  }

  /*
    Keep two compact thumbnails per row on phones,
    similar to a streaming-service grid.
  */
  .search-video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .search-video-card,
  .search-video-thumbnail {
    border-radius: 8px;
  }
}

/* Remove browser's built-in clear button */

.subjects-search-box__input::-webkit-search-cancel-button,
.subjects-search-box__input::-webkit-search-decoration,
.subjects-search-box__input::-webkit-search-results-button,
.subjects-search-box__input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.subjects-search-box__input::-ms-clear,
.subjects-search-box__input::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}

/* =========================================================
   Premium search videos - guests only
   ========================================================= */

.search-video-card {
  width: 100%;
  margin: 0;
  padding: 0;

  background: transparent;

  /* Always reserve border space */
  border: 3px solid transparent;
  border-radius: 12px;
  box-sizing: border-box;

  box-shadow: none;
  overflow: hidden;

  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.search-video-link--premium .search-video-card {
  border-color: #ebbf2d;
}

@media (max-width: 480px) {
  .search-video-link--premium .search-video-card {
    border: 2px solid #ebbf2d;
  }
}

.search-video-link--premium .search-video-thumbnail {
  border: 0;
  border-radius: 9px;
}


/* =========================================================
   Nerd+ signup modal
   Matches topics.css styling
   ========================================================= */

body.search-modal-open {
  overflow: hidden;
}

.search-signup-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;

  display: none;
  align-items: center;
  justify-content: center;

  width: 100vw;
  height: 100vh;

  padding: 1rem;

  background-color: rgba(0, 0, 0, 0.5);

  box-sizing: border-box;
}

.search-signup-modal.is-open {
  display: flex;
}

.search-signup-modal__content {
  position: relative;

  width: 100%;
  max-width: 70vw;
  max-height: 90vh;

  padding: 2rem;

  background-color: #ffffff;
  border-radius: 12px;

  overflow-y: auto;

  text-align: center;
  box-sizing: border-box;

  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Nerd+ logo */
.search-signup-modal__logo {
  display: block;

  width: 250px;
  height: 80px;

  margin: 0 auto 1.5rem;

  object-fit: contain;
}

/* Heading */
.search-signup-modal__content h2 {
  margin: 0 0 1rem;

  color: #101828;

  font-size: 1.5rem;
  font-weight: 700;
}

/* Paragraph */
.search-signup-modal__content p {
  margin-top: 1rem;
  margin-bottom: 1rem;

  color: #475467;

  font-size: 1.25rem;
  line-height: 1.5;
}

/* Highlight "100% free" */
.search-signup-modal__content .highlight-free {
  color: #ebbf2d;
  text-transform: uppercase;
  font-weight: bold;
}

/* Buttons container */
.search-signup-modal__buttons {
  display: flex;
  flex-direction: column;

  gap: 1rem;
  margin-top: 1.5rem;
}

/* Shared button styling */
.search-signup-modal__signup,
.search-signup-modal__later {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 100%;

  padding: 1rem 1.5rem;

  box-sizing: border-box;
  border-radius: 0.5rem;

  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: bold;

  text-decoration: none;
}

.search-signup-modal__signup {
  color: #fff !important;
  background-color: #DAA520;

  border: none;

  font-size: 1.25rem;

  cursor: pointer;

  transition: background-color 0.3s ease;

  text-decoration: none;
}

.search-signup-modal__signup:visited,
.search-signup-modal__signup:hover,
.search-signup-modal__signup:active {
  color: #fff !important;
}

@media (hover: hover) and (pointer: fine) {
  .search-signup-modal__signup:hover {
    background-color: #B8860B;
  }
}

/* Maybe Later button */
.search-signup-modal__later {
  color: #000000;
  background-color: #ffffff;

  border: 1px solid grey;

  font-size: 1rem;

  cursor: pointer;

  transition: border-color 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .search-signup-modal__later:hover {
    color: #000000;
    background-color: #ffffff;
    border-color: #DAA520;
  }
}

.search-signup-modal__later:focus {
  color: #000000;
  background-color: #ffffff;
  border-color: #DAA520;
}

/* Tablet / smaller screens */
@media (max-width: 1024px) {
  .search-signup-modal__content {
    max-width: 90vw;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .search-signup-modal {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .search-signup-modal__logo {
    width: 170px;
    height: 50px;
  }

  .search-signup-modal__content p {
    font-size: 1rem;
  }

  .search-signup-modal__content h2 {
    font-size: 1.3rem;
  }
}


.subjects-search-status strong {
  font-weight: 700;
}