/**
 * ConceptRecall Bookmarks — bookmark button.
 */

.cr-bookmark {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cr-accent, #2d7d6e);
  background: var(--cr-bg-card, #ffffff);
  border: 1px solid var(--cr-accent-soft, #e8f1ef);
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.cr-bookmark:hover {
  background: var(--cr-accent-soft, #e8f1ef);
}

.cr-bookmark:active {
  transform: scale(0.96);
}

.cr-bookmark.is-saved {
  color: var(--cr-bg-card, #ffffff);
  background: var(--cr-accent, #2d7d6e);
  border-color: var(--cr-accent, #2d7d6e);
}

.cr-bookmark.is-saved:hover {
  background: var(--cr-accent-hover, #246159);
}

.cr-bookmark__icon {
  font-size: 1.05rem;
  line-height: 1;
}

.cr-bookmark.is-busy,
.cr-bookmark:disabled {
  cursor: wait;
  opacity: 0.78;
}

.cr-bookmark--confirmed {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--cr-accent, #004b3f) 12%, transparent), 0 14px 34px rgba(0, 75, 63, 0.18) !important;
}

.cr-bookmark--error {
  background: #fff !important;
  border-color: var(--cr-warm-hover, #b1542f) !important;
  color: var(--cr-warm-hover, #b1542f) !important;
}


@media (max-width: 640px) {
  /* Thumb-reachable: anchor to the bottom-right on mobile. */
  .cr-bookmark {
    position: fixed;
    top: auto;
    bottom: 1.1rem;
    right: 1.1rem;
    padding: 0.7rem 1.1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  }
}


/* v56 final mobile card audit polish.
   Fixes missed real bookmark class (.cr-bookmark) and makes the mobile card
   cleaner after hiding the study-action copy. */
@media (max-width: 700px) {
  /* Actual bookmark button generated by conceptrecall_bookmarks/js/bookmark-button.js. */
  .cr-card > .cr-bookmark,
  .cr-card:not(.is-flipped) > .cr-bookmark,
  .cr-card.is-flipped > .cr-bookmark,
  .cr-bookmark {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    gap: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    font-size: 0 !important;
    line-height: 0 !important;
  }

  .cr-bookmark__text,
  .cr-card > .cr-bookmark .cr-bookmark__text,
  .cr-card:not(.is-flipped) > .cr-bookmark .cr-bookmark__text,
  .cr-card.is-flipped > .cr-bookmark .cr-bookmark__text {
    display: none !important;
  }

  .cr-bookmark__icon,
  .cr-card > .cr-bookmark .cr-bookmark__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    font-size: 1.18rem !important;
    line-height: 1 !important;
    margin: 0 !important;
  }

  /* The save button is now icon-only, so the kicker row no longer needs a large right guard area. */
  .cr-card__kicker-row {
    padding-right: 3.45rem !important;
    min-height: 2.25rem !important;
  }

  /* CTA-only study panel on mobile. */
  .cr-card__study-panel {
    margin-top: 0.25rem !important;
    padding: 0.35rem 0 0 !important;
    min-height: auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }

  .cr-card__panel-topline,
  .cr-card__panel-title,
  .cr-card__panel-copy {
    display: none !important;
  }

  .cr-card__primary-flip {
    width: auto !important;
    max-width: 100% !important;
    min-height: 52px !important;
    padding: 0.92rem 1.2rem !important;
    border-radius: 999px !important;
    font-size: 0.98rem !important;
    font-weight: 850 !important;
    box-shadow: 0 14px 30px rgba(0, 83, 70, 0.18) !important;
  }

  .cr-card__front-grid {
    gap: 0.85rem !important;
  }

  .cr-card__front-main {
    min-width: 0 !important;
  }

  .cr-card__meta-strip {
    font-size: 0.88rem !important;
  }
}

@media (max-width: 380px) {
  .cr-card > .cr-bookmark,
  .cr-card:not(.is-flipped) > .cr-bookmark,
  .cr-card.is-flipped > .cr-bookmark,
  .cr-bookmark {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  .cr-card__kicker-row {
    padding-right: 3.1rem !important;
  }

  .cr-card__primary-flip {
    min-height: 50px !important;
    font-size: 0.92rem !important;
    padding-inline: 1.05rem !important;
  }
}

/* v73: saved-state visibility fix.
   Earlier UI overrides could keep the saved button surface white while the
   saved text/icon became white, making the button look empty. These selectors
   intentionally target both the class and aria state, so stale/async states
   are still visibly correct. */
.cr-card > .cr-bookmark.is-saved,
.cr-card > .cr-bookmark[aria-pressed="true"],
.cr-card:not(.is-flipped) > .cr-bookmark.is-saved,
.cr-card:not(.is-flipped) > .cr-bookmark[aria-pressed="true"],
.cr-card.is-flipped > .cr-bookmark.is-saved,
.cr-card.is-flipped > .cr-bookmark[aria-pressed="true"],
.cr-bookmark.is-saved,
.cr-bookmark[aria-pressed="true"] {
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--cr-accent, #004b3f), #006454) !important;
  border-color: color-mix(in srgb, var(--cr-accent, #004b3f) 86%, #ffffff) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 12px 30px rgba(0, 75, 63, 0.18) !important;
}

.cr-card > .cr-bookmark.is-saved:hover,
.cr-card > .cr-bookmark[aria-pressed="true"]:hover,
.cr-bookmark.is-saved:hover,
.cr-bookmark[aria-pressed="true"]:hover {
  background: linear-gradient(135deg, #003f34, var(--cr-accent, #004b3f)) !important;
  color: #ffffff !important;
}

.cr-bookmark.is-saved .cr-bookmark__icon,
.cr-bookmark[aria-pressed="true"] .cr-bookmark__icon,
.cr-bookmark.is-saved .cr-bookmark__text,
.cr-bookmark[aria-pressed="true"] .cr-bookmark__text {
  color: #ffffff !important;
}

.cr-bookmark .cr-bookmark__icon,
.cr-bookmark .cr-bookmark__text {
  position: relative;
  z-index: 1;
}

