/**
 * ConceptRecall Share — the flashcard share bar.
 *
 * Uses the conceptrecall_theme design tokens, with graceful fallbacks so the
 * bar still looks right if the theme is not active.
 */

.cr-share {
  max-width: 720px;
  margin: var(--cr-space-6, 2rem) auto 0;
  padding-top: var(--cr-space-5, 1.5rem);
  border-top: 1px solid var(--cr-border, #e6e1d6);
}

.cr-share__label {
  display: block;
  margin-bottom: var(--cr-space-3, 0.75rem);
  font-family: var(--cr-font-sans, sans-serif);
  font-size: var(--cr-text-xs, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cr-text-faint, #908a80);
}

.cr-share__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cr-space-2, 0.5rem);
}

.cr-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  font-family: var(--cr-font-sans, sans-serif);
  font-size: var(--cr-text-sm, 0.88rem);
  font-weight: 600;
  color: var(--cr-text, #211f1b);
  background: var(--cr-bg-card, #fff);
  border: 1px solid var(--cr-border, #e6e1d6);
  border-radius: var(--cr-radius-full, 9999px);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease,
              border-color 0.16s ease, background 0.16s ease;
}

.cr-share__btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--cr-shadow-md, 0 2px 6px rgba(0, 0, 0, 0.08));
}

.cr-share__icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 0.95rem;
  border-radius: 50%;
  color: #fff;
}

/* Each target gets its own brand-tinted icon chip; the button itself stays
   on the calm paper surface so the bar reads as one set, not a rainbow. */
.cr-share__btn--native .cr-share__icon { background: var(--cr-accent, #2d7d6e); }
.cr-share__btn--whatsapp .cr-share__icon { background: #25d366; }
.cr-share__btn--facebook .cr-share__icon { background: #1877f2; }
.cr-share__btn--telegram .cr-share__icon { background: #29a9eb; }
.cr-share__btn--x .cr-share__icon { background: #1a1a1a; }
.cr-share__btn--copy .cr-share__icon { background: var(--cr-warm, #c8633f); }

.cr-share__btn--whatsapp:hover { border-color: #25d366; }
.cr-share__btn--facebook:hover { border-color: #1877f2; }
.cr-share__btn--telegram:hover { border-color: #29a9eb; }
.cr-share__btn--x:hover { border-color: #1a1a1a; }
.cr-share__btn--native:hover,
.cr-share__btn--copy:hover { border-color: var(--cr-accent, #2d7d6e); }

/* Copy confirmation state. */
.cr-share__btn--copy.is-copied {
  color: var(--cr-accent, #2d7d6e);
  border-color: var(--cr-accent, #2d7d6e);
  background: var(--cr-accent-soft, #e8f1ef);
}

.cr-share__btn--copy.is-copied .cr-share__icon {
  background: var(--cr-accent, #2d7d6e);
}

/* On phones, when the native share sheet is available, the per-network
   buttons are still useful — but the bar wraps cleanly. */
@media (max-width: 540px) {
  .cr-share {
    margin-inline: var(--cr-space-4, 1rem);
  }
  .cr-share__text {
    /* Keep labels — they aid recognition — but tighten spacing. */
    font-size: 0.82rem;
  }
  .cr-share__btn {
    padding: 0.5rem 0.8rem;
  }
}


/* v72: make the share module visible and consistent with the polished card page. */
.cr-card + .cr-share,
.cr-card--full + .cr-share {
  width: min(100% - 2rem, var(--cr-container, 1180px));
  max-width: none;
  margin: clamp(0.72rem, 1.35vw, 1.05rem) auto clamp(0.9rem, 1.6vw, 1.2rem);
  padding: clamp(0.72rem, 1.2vw, 0.95rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(213, 250, 242, 0.44), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.72));
  border: 1px solid color-mix(in srgb, var(--cr-accent, #004b3f) 12%, var(--cr-border, #dbe7e4));
  border-radius: 999px;
  box-shadow: 0 16px 38px rgba(0, 46, 40, 0.06);
}

.cr-card + .cr-share .cr-share__label,
.cr-card--full + .cr-share .cr-share__label {
  margin: 0;
  color: var(--cr-warm, #c8633f);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.cr-card + .cr-share .cr-share__buttons,
.cr-card--full + .cr-share .cr-share__buttons {
  justify-content: flex-end;
  gap: 0.42rem;
}

.cr-card + .cr-share .cr-share__btn,
.cr-card--full + .cr-share .cr-share__btn {
  min-height: 34px;
  padding: 0.4rem 0.74rem;
  font-size: 0.8rem;
  font-weight: 820;
  background: rgba(255,255,255,0.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
}

.cr-card + .cr-share .cr-share__icon,
.cr-card--full + .cr-share .cr-share__icon {
  width: 20px;
  height: 20px;
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  .cr-card + .cr-share,
  .cr-card--full + .cr-share {
    width: min(100% - 1rem, var(--cr-container, 1180px));
    align-items: flex-start;
    border-radius: 1.15rem;
    padding: 0.72rem;
    margin-top: 0.7rem;
    overflow: hidden;
  }

  .cr-card + .cr-share .cr-share__label,
  .cr-card--full + .cr-share .cr-share__label {
    padding-top: 0.38rem;
  }

  .cr-card + .cr-share .cr-share__buttons,
  .cr-card--full + .cr-share .cr-share__buttons {
    flex: 1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    -webkit-overflow-scrolling: touch;
  }

  .cr-card + .cr-share .cr-share__btn,
  .cr-card--full + .cr-share .cr-share__btn {
    white-space: nowrap;
  }
}

@media (max-width: 430px) {
  .cr-card + .cr-share,
  .cr-card--full + .cr-share {
    display: block;
  }

  .cr-card + .cr-share .cr-share__label,
  .cr-card--full + .cr-share .cr-share__label {
    display: block;
    margin-bottom: 0.5rem;
  }

  .cr-card + .cr-share .cr-share__buttons,
  .cr-card--full + .cr-share .cr-share__buttons {
    width: 100%;
  }

  .cr-card + .cr-share .cr-share__btn,
  .cr-card--full + .cr-share .cr-share__btn {
    padding: 0.42rem 0.62rem;
    font-size: 0.78rem;
  }
}

/* v73: align share bar with the main flashcard width and make mobile compact. */
.cr-card--full + .cr-share,
.cr-card + .cr-share {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: clamp(0.7rem, 1.2vw, 1rem) 0 clamp(0.92rem, 1.55vw, 1.22rem) !important;
}

.cr-card--full + .cr-share .cr-share__buttons,
.cr-card + .cr-share .cr-share__buttons {
  min-width: 0;
}

@media (max-width: 760px) {
  .cr-card--full + .cr-share,
  .cr-card + .cr-share {
    width: 100% !important;
    margin: 0.72rem 0 0.95rem !important;
    padding: 0.56rem !important;
    border-radius: 1.05rem !important;
  }

  .cr-card--full + .cr-share .cr-share__label,
  .cr-card + .cr-share .cr-share__label {
    display: none !important;
  }

  .cr-card--full + .cr-share .cr-share__buttons,
  .cr-card + .cr-share .cr-share__buttons {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: initial !important;
    width: 100% !important;
    gap: 0.38rem !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .cr-card--full + .cr-share .cr-share__btn,
  .cr-card + .cr-share .cr-share__btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 38px !important;
    justify-content: center !important;
    gap: 0.28rem !important;
    padding: 0.44rem 0.42rem !important;
    border-radius: 999px !important;
    font-size: 0.74rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .cr-card--full + .cr-share .cr-share__icon,
  .cr-card + .cr-share .cr-share__icon {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    font-size: 0.68rem !important;
  }

  .cr-card--full + .cr-share .cr-share__text,
  .cr-card + .cr-share .cr-share__text {
    max-width: 7.5ch;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem !important;
  }
}

@media (max-width: 380px) {
  .cr-card--full + .cr-share .cr-share__btn,
  .cr-card + .cr-share .cr-share__btn {
    padding: 0.4rem 0.34rem !important;
    font-size: 0.68rem !important;
    gap: 0.2rem !important;
  }

  .cr-card--full + .cr-share .cr-share__icon,
  .cr-card + .cr-share .cr-share__icon {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
  }

  .cr-card--full + .cr-share .cr-share__text,
  .cr-card + .cr-share .cr-share__text {
    font-size: 0.66rem !important;
    max-width: 6.8ch;
  }
}

