/**
 * Shared Medication Success player + card primitives.
 * Linked from the patient wizard (no admin.css) and available to admin pages.
 */

.ms-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #10243f;
  overflow: hidden;
}

.ms-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ms-thumb-fallback {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 4rem;
  background: linear-gradient(135deg, #042e58, #de1c60);
}

.ms-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: rgb(222 28 96 / 0.92);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
}

.ms-duration {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.ms-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ms-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #f1f5fa;
  color: #46586f;
  border: 1px solid #ebeff6;
}

.ms-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #5d6c80;
  font-weight: 600;
}

.ms-why {
  margin: 0;
  font-size: 0.8rem;
  color: #042e58;
  font-weight: 600;
}

.ms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ms-guide {
  display: grid;
  gap: 0.75rem;
}

.ms-guide-head {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 0.75rem;
  align-items: start;
}

.ms-guide-head h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}

.ms-summary {
  margin: 0;
  color: #5d6c80;
  font-size: 0.88rem;
  line-height: 1.45;
}

.ms-block h4 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: #042e58;
}

.ms-steps,
.ms-bullets {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.3rem;
  color: #46586f;
  font-size: 0.88rem;
  line-height: 1.4;
}

.ms-block.is-warn .ms-bullets {
  color: #8a5d0b;
}

.ms-related {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}

.ms-related .linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #b0154c;
  cursor: pointer;
  text-align: left;
}

.ms-disclaimer {
  margin: 0;
  font-size: 0.76rem;
  color: #5d6c80;
  line-height: 1.45;
}

.ms-card--compact {
  display: grid;
  grid-template-columns: 88px 1fr;
  background: #fff;
}

.ms-card--compact .ms-thumb {
  aspect-ratio: auto;
  min-height: 100%;
}

.ms-card-body {
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ms-card-body strong {
  font-size: 0.88rem;
  line-height: 1.25;
  color: #10243f;
}

.ms-card-body p {
  margin: 0;
  font-size: 0.8rem;
  color: #5d6c80;
  line-height: 1.35;
}

/* Standalone buttons for the patient wizard (no admin.css). */
.wz-ms .btn,
#ms-player-root .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

.wz-ms .btn-primary,
#ms-player-root .btn-primary {
  background: #de1c60;
  color: #fff;
}

.wz-ms .btn-sm,
#ms-player-root .btn-sm {
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
}

.wz-ms .btn-ghost,
#ms-player-root .btn-ghost {
  background: transparent;
  color: #042e58;
}

body.ms-player-open {
  overflow: hidden;
}

#ms-player-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

#ms-player-root[hidden] {
  display: none !important;
}

.ms-player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 36, 63, 0.55);
}

.ms-player-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #dde4ee;
  box-shadow: 0 24px 60px rgba(16, 36, 63, 0.28);
}

.ms-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #ebeff6;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

.ms-player-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0;
}

.ms-player-frame {
  aspect-ratio: 16 / 9;
  background: #000;
}

.ms-player-media {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.ms-player-aside {
  padding: 1rem 1.15rem 1.25rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.ms-player-aside--full {
  grid-column: 1 / -1;
}

#ms-player-root.is-modal .ms-player-body {
  grid-template-columns: 1fr;
}

@media (max-width: 720px) {
  .ms-guide-head,
  .ms-card--compact,
  .ms-player-body {
    grid-template-columns: 1fr;
  }
}
