/*
 * RewardVid UX follow-up v4
 * Focused compatibility and interaction fixes layered after rewardvid-v2/v3.
 */

/* --------------------------------------------------------------------------
   Theme-aware frontend logos
   -------------------------------------------------------------------------- */
.rv-theme-logo {
  display: block;
  width: auto;
  max-width: 100%;
}

html[data-theme="dark"] .rv-theme-logo--light,
html[data-theme="light"] .rv-theme-logo--dark {
  display: none !important;
}

html[data-theme="dark"] .rv-theme-logo--dark,
html[data-theme="light"] .rv-theme-logo--light {
  display: block;
}

.rv-brand__desktop.rv-theme-logo {
  max-height: 38px;
}

.rv-footer__brand .rv-theme-logo {
  max-width: 190px;
  max-height: 48px;
}

/* --------------------------------------------------------------------------
   Feed advertisements: preserve the same footprint and motion as video cards
   -------------------------------------------------------------------------- */
body.rv-app .rv-feed-ad,
body.rv-app .rv-feed-ad .video-post-thumbnail,
body.rv-app .rv-feed-ad .rv-feed-ad__media,
body.rv-app .rv-feed-ad .rv-ad-slot {
  min-width: 0;
}

body.rv-app .rv-feed-ad .rv-feed-ad__link {
  display: block;
  width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

body.rv-app .rv-feed-ad .video-post-thumbnail,
body.rv-app .rv-feed-ad .rv-feed-ad__media,
body.rv-app .rv-feed-ad .rv-ad-slot {
  width: 100%;
  aspect-ratio: 16 / 9 !important;
}

body.rv-app .rv-feed-ad .rv-ad-slot {
  position: relative;
  display: block !important;
  overflow: hidden;
  min-height: 0;
  border-radius: inherit;
  background: var(--rv-surface-2) !important;
}

body.rv-app .rv-feed-ad .rv-ad-slot > :not(script),
body.rv-app .rv-feed-ad .rv-ad-slot > a,
body.rv-app .rv-feed-ad .rv-ad-slot > div,
body.rv-app .rv-feed-ad .rv-ad-slot > ins,
body.rv-app .rv-feed-ad .rv-ad-slot a,
body.rv-app .rv-feed-ad .rv-ad-slot ins {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
}

body.rv-app .rv-feed-ad .rv-ad-slot img,
body.rv-app .rv-feed-ad .rv-ad-slot video,
body.rv-app .rv-feed-ad .rv-ad-slot canvas,
body.rv-app .rv-feed-ad .rv-ad-slot iframe,
body.rv-app .rv-feed-ad .rv-ad-slot > svg,
body.rv-app .rv-feed-ad .rv-ad-slot > a > svg,
body.rv-app .rv-feed-ad .rv-ad-slot > div > svg {
  position: absolute !important;
  inset: 0;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
}

body.rv-app .rv-feed-ad .rv-ad-slot img,
body.rv-app .rv-feed-ad .rv-ad-slot video,
body.rv-app .rv-feed-ad .rv-ad-slot canvas,
body.rv-app .rv-feed-ad .rv-ad-slot > svg,
body.rv-app .rv-feed-ad .rv-ad-slot > a > svg,
body.rv-app .rv-feed-ad .rv-ad-slot > div > svg {
  object-fit: cover !important;
  object-position: center !important;
}

body.rv-app .rv-feed-ad .rv-ad-slot iframe {
  object-fit: fill !important;
}

body.rv-app .rv-feed-ad .rv-feed-ad__creative {
  z-index: 1;
  opacity: 1 !important;
  visibility: visible !important;
}

body.rv-app .rv-feed-ad .rv-ad-card__placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  gap: 8px;
  place-content: center;
  color: var(--rv-text-soft);
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 75, 119, .18), transparent 34%),
    linear-gradient(145deg, var(--rv-surface-2), var(--rv-surface));
  text-align: center;
}

body.rv-app .rv-feed-ad .rv-ad-card__placeholder i {
  color: var(--rv-red);
  font-size: 24px;
}

body.rv-app .rv-feed-ad .rv-ad-card__placeholder span {
  font-size: 12px;
  font-weight: 800;
}

body.rv-app .rv-feed-ad .video-post-content {
  min-height: 0;
  padding-inline: 0 !important;
  background: transparent !important;
}

body.rv-app .rv-feed-ad:hover .video-post-thumbnail {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
}

/* --------------------------------------------------------------------------
   Shared selected-card state for payout and deposit choices
   -------------------------------------------------------------------------- */
body.rv-app .payout-option {
  position: relative;
  overflow: visible !important;
  cursor: pointer;
  isolation: isolate;
  border-width: 1px !important;
  outline: 0;
}

body.rv-app .payout-option .card-body {
  min-width: 0;
  padding-inline-end: 52px;
}

body.rv-app .payout-option:focus-visible {
  border-color: rgba(78, 140, 255, .78) !important;
  box-shadow: 0 0 0 3px rgba(78, 140, 255, .16) !important;
}

body.rv-mode-earn .payout-option:focus-visible {
  border-color: rgba(255, 75, 119, .78) !important;
  box-shadow: 0 0 0 3px rgba(255, 75, 119, .14) !important;
}

body.rv-app .payout-option.is-selected,
body.rv-app .payout-option.border-success,
body.rv-app .visually-hidden-radio:checked + .payout-option,
body.rv-app input[type="radio"]:checked + .payout-option {
  border-color: rgba(98, 133, 255, .88) !important;
  background:
    linear-gradient(145deg, rgba(78, 111, 255, .10), transparent 56%),
    var(--rv-surface) !important;
  box-shadow: 0 0 0 3px rgba(78, 111, 255, .11) !important;
}

body.rv-mode-earn .payout-option.is-selected,
body.rv-mode-earn .payout-option.border-success,
body.rv-mode-earn .visually-hidden-radio:checked + .payout-option,
body.rv-mode-earn input[type="radio"]:checked + .payout-option {
  border-color: rgba(255, 75, 119, .88) !important;
  background:
    linear-gradient(145deg, rgba(255, 75, 119, .10), transparent 56%),
    var(--rv-surface) !important;
  box-shadow: 0 0 0 3px rgba(255, 75, 119, .10) !important;
}

.rv-option-check {
  position: absolute;
  inset-inline-end: 12px;
  bottom: 12px;
  z-index: 2;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--rv-border-strong);
  border-radius: 50%;
  color: transparent;
  background: var(--rv-surface-3);
  opacity: .7;
  transform: scale(.92);
  transition: color .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease, transform .18s ease;
}

.payout-option.is-selected .rv-option-check,
.payout-option.border-success .rv-option-check {
  color: #fff;
  border-color: transparent;
  background: var(--rv-blue);
  opacity: 1;
  transform: scale(1);
}

body.rv-mode-earn .payout-option.is-selected .rv-option-check,
body.rv-mode-earn .payout-option.border-success .rv-option-check {
  background: var(--rv-red);
}

.rv-option-recommended {
  position: absolute;
  top: 10px;
  inset-inline-end: 12px;
  z-index: 3;
  padding: 5px 8px;
  border: 1px solid rgba(255, 209, 91, .34);
  border-radius: 5px;
  color: #221806;
  background: #ffd15b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.payout-option.has-recommendation .card-body {
  padding-top: 38px;
}

/* --------------------------------------------------------------------------
   Shared polished money field
   -------------------------------------------------------------------------- */
.rv-money-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  width: 100%;
  min-height: 46px;
  overflow: hidden;
  border: 1px solid var(--rv-border);
  border-radius: 8px;
  background: var(--rv-surface-2);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.rv-money-input:focus-within {
  border-color: rgba(78, 140, 255, .62);
  box-shadow: 0 0 0 3px rgba(78, 140, 255, .10);
}

body.rv-mode-earn .rv-money-input:focus-within {
  border-color: rgba(255, 75, 119, .58);
  box-shadow: 0 0 0 3px rgba(255, 75, 119, .09);
}

.rv-money-input.is-invalid,
.rv-money-input:has(.is-invalid) {
  border-color: var(--bs-danger, #dc3545);
}

body.rv-app .rv-money-input input[type=number] {
  appearance: textfield;
}

body.rv-app .rv-money-input input[type=number]::-webkit-inner-spin-button,
body.rv-app .rv-money-input input[type=number]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.rv-money-input__prefix,
.rv-money-input__suffix {
  display: grid;
  min-width: 46px;
  padding: 0 13px;
  place-items: center;
  color: var(--rv-text-soft);
  background: var(--rv-surface-3);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.rv-money-input__prefix {
  border-inline-end: 1px solid var(--rv-border);
}

.rv-money-input__suffix {
  border-inline-start: 1px solid var(--rv-border);
}

body.rv-app .rv-money-input > input,
body.rv-app .rv-money-input > .form-control {
  min-width: 0;
  min-height: 44px;
  width: 100%;
  padding: 9px 13px;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--rv-text) !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.rv-app .rv-money-input > input:focus,
body.rv-app .rv-money-input > .form-control:focus {
  border: 0 !important;
  box-shadow: none !important;
}

.rv-money-input--readonly {
  background: var(--rv-surface-3);
}

.rv-money-input--readonly .rv-money-input__prefix,
.rv-money-input--readonly .rv-money-input__suffix {
  background: rgba(255, 255, 255, .025);
}

/* Protect remaining legacy Bootstrap input groups from the global form rules. */
body.rv-app .input-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
}

body.rv-app .input-group > .form-control,
body.rv-app .input-group > .form-select,
body.rv-app .input-group > input,
body.rv-app .input-group > select {
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  border-radius: 0 !important;
}

body.rv-app .input-group > .input-group-text,
body.rv-app .input-group > .btn {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

body.rv-app .input-group > :first-child {
  border-start-start-radius: 8px !important;
  border-end-start-radius: 8px !important;
}

body.rv-app .input-group > :last-child {
  border-start-end-radius: 8px !important;
  border-end-end-radius: 8px !important;
}

/* --------------------------------------------------------------------------
   Earnings action modals: keep artwork fully visible
   -------------------------------------------------------------------------- */
body.rv-app .white-popup.rv-action-modal {
  overflow: visible !important;
  width: min(720px, calc(100vw - 32px));
  max-width: 720px;
  border: 1px solid var(--rv-border);
  border-radius: 10px;
  background: var(--rv-surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .46);
}

body.rv-app .rv-action-modal .mfp-modal-header {
  display: grid;
  margin: 0 !important;
  padding: 28px 28px 8px;
  place-items: center;
  text-align: center;
  transform: none !important;
}

body.rv-app .rv-action-modal .mfp-modal-header > span {
  display: grid;
  width: 94px;
  height: 94px;
  margin: 0 0 12px !important;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--rv-border);
  border-radius: 18px;
  background: var(--rv-surface-3);
}

body.rv-app .rv-action-modal .mfp-modal-header img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
}

body.rv-app .rv-action-modal .mfp-modal-header h4 {
  margin: 0;
  color: var(--rv-text);
  font-size: clamp(21px, 3vw, 27px);
  font-weight: 800;
}

body.rv-app .rv-action-modal .mfp-modal-body {
  padding-top: 6px !important;
}

body.rv-app .rv-action-modal .mfp-close {
  top: 8px;
  right: 8px;
  color: var(--rv-text);
}

/* --------------------------------------------------------------------------
   Campaign preview and watch-time estimate
   -------------------------------------------------------------------------- */
.rv-youtube-inspection {
  display: none;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid var(--rv-border);
  border-radius: 8px;
  color: var(--rv-muted);
  background: var(--rv-surface-2);
  font-size: 12px;
  line-height: 1.45;
}

.rv-youtube-inspection.is-visible {
  display: flex;
}

.rv-youtube-inspection.is-loading i {
  animation: rv-spin .8s linear infinite;
}

.rv-youtube-inspection.is-success {
  border-color: rgba(65, 190, 129, .28);
  color: var(--rv-text-soft);
  background: rgba(65, 190, 129, .07);
}

.rv-youtube-inspection.is-error {
  border-color: rgba(255, 75, 119, .28);
  color: #ff8da8;
  background: rgba(255, 75, 119, .07);
}

.rv-youtube-inspection > i {
  flex: 0 0 auto;
}

.rv-youtube-inspection > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rv-youtube-inspection strong {
  color: var(--rv-text);
}

@keyframes rv-spin {
  to { transform: rotate(360deg); }
}

.rv-campaign-estimate {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* --------------------------------------------------------------------------
   Profile dropdown theme switch
   -------------------------------------------------------------------------- */
.rv-dropdown-theme {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  text-align: start;
}

.rv-theme-switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  margin-inline-start: auto;
  border: 1px solid var(--rv-border-strong);
  border-radius: 999px;
  background: var(--rv-surface-3);
  transition: background .18s ease, border-color .18s ease;
}

.rv-theme-switch::after {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rv-text-soft);
  content: "";
  transition: transform .2s ease, background .2s ease;
}

html[data-theme="light"] .rv-theme-switch {
  border-color: rgba(255, 75, 119, .34);
  background: rgba(255, 75, 119, .12);
}

html[data-theme="light"] .rv-theme-switch::after {
  background: var(--rv-red);
  transform: translateX(16px);
}

[dir="rtl"] html[data-theme="light"] .rv-theme-switch::after,
html[dir="rtl"][data-theme="light"] .rv-theme-switch::after {
  transform: translateX(-16px);
}

body.rv-app .rv-auth-modal__brand.rv-theme-logo {
  width: auto;
  max-width: min(190px, 70%);
  max-height: 52px;
  margin: 0 auto 14px;
  object-fit: contain;
}

/* --------------------------------------------------------------------------
   Small responsive refinements
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .rv-campaign-estimate {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  body.rv-app .rv-feed-ad .video-post-thumbnail,
  body.rv-app .rv-feed-ad .rv-feed-ad__media,
  body.rv-app .rv-feed-ad .rv-ad-slot {
    min-height: 0 !important;
    aspect-ratio: 16 / 9 !important;
  }

  .rv-option-recommended {
    top: 8px;
    inset-inline-end: 10px;
  }

  .payout-option.has-recommendation .card-body {
    padding-top: 36px;
  }

  .rv-money-input__prefix,
  .rv-money-input__suffix {
    min-width: 42px;
    padding-inline: 10px;
  }

  .rv-campaign-estimate {
    grid-template-columns: 1fr;
  }

  body.rv-app .white-popup.rv-action-modal {
    width: calc(100vw - 20px);
  }

  body.rv-app .rv-action-modal .mfp-modal-header {
    padding: 24px 18px 6px;
  }
}
