/**
 * Cikamo news-feed cards
 * addons/cikamo-recommendation/assets/css/cikamo-feed.css
 *
 * Everything is scoped under .cikamo-feed-card-slot (the <li> that wraps each
 * card in the feed), so the exam page and the library page keep their own look.
 * This file does not replace __feature__exam-card-css.tpl; it sits on top of it
 * (higher specificity) and also works if that file is not loaded in the feed.
 */

/* ---------- space between cards (outside the card, not inside) ---------- */
.cikamo-feed-card-slot {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* the cards' own bottom margins would double the gap, so remove them here */
.cikamo-feed-card-slot .cikamo-exam-card,
.cikamo-feed-card-slot .cikamo-exam-carousel,
.cikamo-feed-card-slot .library-nf-card {
  margin-bottom: 0;
}
.cikamo-feed-card-slot .cikamo-creators {
  margin-bottom: 0 !important; /* beats Bootstrap's mb-3 */
}
.cikamo-feed-card-slot .library-nf-card + .library-nf-card {
  margin-top: 1rem;
}

/* ---------- recommended exams: full-width carousel ---------- */
.cikamo-feed-card-slot .cikamo-exam-carousel {
  position: relative;
  width: 100%;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.25rem 0.65rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__head i {
  color: var(--main-link);
  font-size: 1.15rem;
}

/* sliding mechanics: the carousel JS relies on these, keep them */
.cikamo-feed-card-slot .cikamo-exam-carousel__viewport {
  display: flex;
  align-items: stretch; /* every slide as tall as the tallest one */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__viewport::-webkit-scrollbar {
  display: none;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
}

/* the card itself */
.cikamo-feed-card-slot .cikamo-exam-carousel .cikamo-exam-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
}

/* cover image AND the placeholder: same fixed frame, so no image can stretch a slide */
.cikamo-feed-card-slot .cikamo-exam-card__cover,
.cikamo-feed-card-slot .exam-card-thumb {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--header-search-bg);
}
.cikamo-feed-card-slot .cikamo-exam-card__cover img,
.cikamo-feed-card-slot .exam-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* body: title/meta on top, students + button pinned to the bottom */
.cikamo-feed-card-slot .cikamo-exam-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1rem;
}
.cikamo-feed-card-slot .cikamo-exam-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}
.cikamo-feed-card-slot .cikamo-exam-card__pill {
  background: var(--header-search-bg);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}
.cikamo-feed-card-slot .cikamo-exam-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em; /* two lines, so short titles don't make a shorter card */
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--body-color);
}
.cikamo-feed-card-slot .cikamo-exam-card__note {
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  opacity: 0.75;
}
.cikamo-feed-card-slot .cikamo-exam-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.75rem;
}
.cikamo-feed-card-slot .cikamo-exam-card__joined {
  font-size: 0.85rem;
  opacity: 0.8;
}
.cikamo-feed-card-slot .cikamo-exam-card__btn {
  display: inline-block;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  background: var(--main-link);
  color: var(--main-color);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* "people you know" line above the card */
.cikamo-feed-card-slot .cikamo-exam-card__people--top {
  margin: 0 0 0.6rem;
  padding: 0 0.25rem;
}

/* arrows + dots */
.cikamo-feed-card-slot .cikamo-exam-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-divider);
  background: var(--body-bg);
  color: var(--body-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__nav.is-prev { left: 0.6rem; }
.cikamo-feed-card-slot .cikamo-exam-carousel__nav.is-next { right: 0.6rem; }

.cikamo-feed-card-slot .cikamo-exam-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border-divider);
  cursor: pointer;
}
.cikamo-feed-card-slot .cikamo-exam-carousel__dot.is-active {
  background: var(--main-link);
}

/* ---------- top exams / most difficult exams (swipe tiles) ---------- */
.cikamo-feed-card-slot .cikamo-exam-card--carousel {
  border-radius: 14px;
}
.cikamo-feed-card-slot .cikamo-exam-card__head {
  padding: 0.85rem 1rem 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.cikamo-feed-card-slot .cikamo-exam-card--carousel .cikamo-exam-card__track {
  display: flex;
  gap: 0.75rem;
  padding: 0.25rem 1rem 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cikamo-feed-card-slot .cikamo-exam-card--carousel .cikamo-exam-card__track::-webkit-scrollbar {
  display: none;
}
.cikamo-feed-card-slot .cikamo-exam-card--carousel .cikamo-exam-card__row {
  flex: 0 0 calc(50% - 0.375rem); /* two tiles visible on desktop */
  scroll-snap-align: start;
}
.cikamo-feed-card-slot .cikamo-exam-card__thumb {
  height: 140px;
}
.cikamo-feed-card-slot .cikamo-exam-card__rowmain {
  padding: 0.75rem 0.9rem 0.9rem;
}

/* ---------- top examiners: spacing only ---------- */
.cikamo-feed-card-slot .cikamo-creators .side_widget_title {
  padding: 0.25rem 0.25rem 0.5rem;
  font-size: 1.1rem;
}

/* ---------- library: browse card centered with its button ---------- */
.cikamo-feed-card-slot .library-nf-browse {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.75rem 1rem;
}
.cikamo-feed-card-slot .library-nf-browse .library-nf-head {
  justify-content: center;
  margin-bottom: 0.5rem;
}
.cikamo-feed-card-slot .library-nf-browse .library-nf-text {
  max-width: 34ch;
  margin: 0 0 0.85rem;
}
.cikamo-feed-card-slot .library-nf-browse .btn {
  padding: 0.5rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
}

/* ---------- phones ---------- */
@media (max-width: 767px) {
  .cikamo-feed-card-slot .cikamo-exam-carousel__nav {
    display: none; /* phones swipe; dots stay */
  }
  .cikamo-feed-card-slot .cikamo-exam-card__cover,
  .cikamo-feed-card-slot .exam-card-thumb {
    height: 160px;
  }
  .cikamo-feed-card-slot .cikamo-exam-card--carousel .cikamo-exam-card__row {
    flex: 0 0 78%;
  }
  .cikamo-feed-card-slot .cikamo-exam-card__thumb {
    height: 120px;
  }
}
