/* Advertisements, on the public website and inside the system: a window, a top strip or a corner card. */
.afia-ad {
  --ad-teal: #0f766e;
  --ad-ink: #0b1f24;
  font-family: inherit;
}

.afia-ad[hidden] {
  display: none !important;
}

.afia-ad-card {
  position: relative;
  overflow: hidden;
  color: var(--ad-ink);
  background: #fff;
  box-shadow: 0 30px 70px -25px rgba(4, 47, 44, 0.55);
}

.afia-ad-badge {
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  inset-inline-start: 0.75rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: rgba(11, 31, 36, 0.6);
  border-radius: 999px;
}

/* Locked while the skip time runs, showing the seconds left; then a cross. */
.afia-ad-close {
  position: absolute;
  z-index: 3;
  top: 0.6rem;
  inset-inline-end: 0.6rem;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: rgba(11, 31, 36, 0.72);
  border: 0;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  transition: background-color 0.2s ease;
}

.afia-ad-close:not(:disabled):hover {
  background: var(--ad-teal);
}

.afia-ad-close:disabled {
  cursor: default;
  opacity: 0.85;
}

.afia-ad-image {
  display: block;
}

.afia-ad-image img {
  display: block;
  width: 100%;
  height: auto;
}

.afia-ad-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.afia-ad-title {
  margin-bottom: 0.35rem;
  font-size: 1.25rem;
  font-weight: 800;
}

.afia-ad-text {
  color: #4b5b60;
  white-space: pre-line;
}

.afia-ad-button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.55rem 1.5rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #0f9488, #0b5f59);
  border-radius: 999px;
}

.afia-ad-button:hover {
  color: #fff;
  filter: brightness(1.08);
}

/* A bar that empties over the ad's display time. */
.afia-ad-timer {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 4px;
  background: rgba(15, 118, 110, 0.15);
}

.afia-ad-timer span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2dd4bf, #f97316);
  transform-origin: left;
  transition-property: transform;
  transition-timing-function: linear;
}

[dir="rtl"] .afia-ad-timer span {
  transform-origin: right;
}

/* The window. */
.afia-ad-popup {
  position: fixed;
  z-index: 2050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 22, 24, 0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.afia-ad-popup .afia-ad-card {
  width: min(32rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border-radius: 1.4rem;
  transform: translateY(30px) scale(0.94);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1.1);
}

.afia-ad-popup.afia-ad-text .afia-ad-body {
  padding: 3rem 2rem 2rem;
  text-align: center;
  background: radial-gradient(120% 80% at 50% 0%, #effcf9, #fff 60%);
}

.afia-ad-popup.is-open {
  opacity: 1;
}

.afia-ad-popup.is-open .afia-ad-card {
  transform: none;
}

body.afia-ad-lock {
  overflow: hidden;
}

/* The top strip. */
.afia-ad-banner {
  position: fixed;
  z-index: 2040;
  top: 0;
  inset-inline: 0;
  transform: translateY(-110%);
  transition: transform 0.45s ease;
}

.afia-ad-banner.is-open {
  transform: none;
}

.afia-ad-banner .afia-ad-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  padding-inline-end: 7rem;
  color: #fff;
  background: linear-gradient(90deg, #0b5f59, #0f9488);
  border-radius: 0;
}

.afia-ad-banner .afia-ad-badge {
  position: static;
  margin-inline-start: 1rem;
  background: rgba(255, 255, 255, 0.2);
}

.afia-ad-banner .afia-ad-image img {
  width: auto;
  max-height: 3.5rem;
}

.afia-ad-banner .afia-ad-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
}

.afia-ad-banner .afia-ad-title {
  margin: 0;
  font-size: 1rem;
}

.afia-ad-banner .afia-ad-text {
  color: rgba(255, 255, 255, 0.85);
}

.afia-ad-banner .afia-ad-button {
  margin: 0;
  padding: 0.3rem 1rem;
  color: #0b5f59;
  background: #fff;
}

.afia-ad-banner .afia-ad-close {
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
}

/* The corner card. */
.afia-ad-corner {
  position: fixed;
  z-index: 2040;
  bottom: 1.25rem;
  inset-inline-start: 1.25rem;
  width: min(21rem, calc(100vw - 2.5rem));
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1.1);
}

.afia-ad-corner.is-open {
  opacity: 1;
  transform: none;
}

.afia-ad-corner .afia-ad-card {
  border-radius: 1.1rem;
}

.afia-ad-corner .afia-ad-body {
  padding: 1rem 1.25rem 1.25rem;
}

.afia-ad-corner.afia-ad-text .afia-ad-body {
  padding-top: 2.75rem;
}

@media print {
  .afia-ads { display: none !important; }
}
