.azkinews-gift {
  --gift-banner: 0px;
  --gift-scroll: 0px;
  --gift-safe-edge: env(safe-area-inset-left, 0px);
  --gift-inset: max(var(--gift-edge), var(--gift-safe-edge));
  --gift-offset: calc(max(var(--gift-bottom), env(safe-area-inset-bottom, 0px)) + var(--gift-banner) + var(--gift-scroll));
  position: fixed;
  bottom: var(--gift-offset);
  z-index: 150;
  color: var(--color-text, #1e293b);
  font-family: IRANSans, sans-serif;
  font-size: .875rem;
  line-height: 1.7;
}

.azkinews-gift--left { left: var(--gift-inset); }
.azkinews-gift--right {
  --gift-safe-edge: env(safe-area-inset-right, 0px);
  right: var(--gift-inset);
}

body.has-bottom-banner .azkinews-gift { --gift-banner: 55px; }
body:has(.scroll-to-top.is-visible) .azkinews-gift--left { --gift-scroll: 62px; }
body:not(.rtl):has(.scroll-to-top.is-visible) .azkinews-gift--left { --gift-scroll: 0px; }
body:not(.rtl):has(.scroll-to-top.is-visible) .azkinews-gift--right { --gift-scroll: 62px; }

.azkinews-gift [hidden],
.azkinews-gift[hidden] { display: none; }

.azkinews-gift button,
.azkinews-gift a { font: inherit; cursor: pointer; }

.azkinews-gift button:focus-visible,
.azkinews-gift a:focus-visible {
  outline: 3px solid #005d96;
  outline-offset: 3px;
}

.azkinews-gift__launcher,
.azkinews-gift__action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: .75rem;
  background: #075b96;
  color: white;
  text-align: center;
  text-decoration: none;
}

.azkinews-gift .azkinews-gift__launcher {
  gap: .55rem;
  min-width: 52px;
  min-height: 52px;
  padding: 5px 5px 5px 15px;
  border-color: #dbe8f3;
  border-radius: 1rem;
  background: #fff;
  color: #153652;
  font-weight: 700;
  max-width: calc(100vw - var(--gift-inset) - 16px);
  box-shadow: 0 3px 6px #15365212, 0 8px 24px #15365220;
}

.azkinews-gift .azkinews-gift__launcher:has([data-gift-invite][hidden]) {
  padding: 5px;
}

.azkinews-gift__launcher-icon {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: .7rem;
  background: linear-gradient(150deg, #f4fbff, #dff2ff);
}

.azkinews-gift__launcher-icon img {
  display: block;
  width: 36px;
  height: 36px;
}

.azkinews-gift__action:hover { background: #064a7a; color: white; }
.azkinews-gift .azkinews-gift__launcher:hover {
  border-color: #8fc6eb;
  background: #f9fcff;
  color: #075b96;
}
.azkinews-gift__action:disabled { cursor: wait; opacity: .75; }

.azkinews-gift__panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(23rem, calc(100vw - var(--gift-inset) - max(12px, env(safe-area-inset-right, 0px))));
  max-height: calc(100vh - var(--gift-offset) - 82px);
  max-height: calc(100dvh - var(--gift-offset) - 82px - env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 1.25rem;
  background: white;
  box-shadow: 0 12px 36px #0f172a30;
}

.azkinews-gift--right .azkinews-gift__panel {
  left: auto;
  right: 0;
  width: min(23rem, calc(100vw - var(--gift-inset) - max(12px, env(safe-area-inset-left, 0px))));
}

.azkinews-gift__header {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 1rem;
  border-bottom: 1px solid #e5edf5;
  background: #fff;
}

.azkinews-gift__header h2,
.azkinews-gift__result h3 { margin: 0; font-size: 1rem; font-weight: 700; }

.azkinews-gift .azkinews-gift__close {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.5rem;
}

.azkinews-gift__body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1rem;
}

.azkinews-gift__body p { margin: 0 0 .65rem; white-space: pre-line; overflow-wrap: anywhere; }
.azkinews-gift__welcome {
  color: #153652;
  font-size: 1rem;
  font-weight: 700;
}

.azkinews-gift__sources {
  margin-top: 1rem;
  padding: .75rem;
  border: 1px solid #dce8f2;
  border-radius: .85rem;
  background: #f6faff;
}

.azkinews-gift__sources h3 {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .4rem;
  font-weight: 700;
}

.azkinews-gift__sources h3 span {
  padding: 0 .4rem;
  border-radius: 1rem;
  background: #e6f1fb;
  color: #334e68;
  font-size: .75rem;
  font-weight: 400;
}

.azkinews-gift__note,
.azkinews-gift__terms { color: var(--color-text-muted, #475569); }
.azkinews-gift__source-link {
  gap: .4rem;
  width: 100%;
  margin: .2rem 0 .7rem;
  font-weight: 700;
}

.azkinews-gift [data-gift-claim] {
  width: 100%;
  margin-top: .85rem;
  border-color: #c6d9e8;
  background: #fff;
  color: #075b96;
}

.azkinews-gift [data-gift-claim]:hover {
  border-color: #075b96;
  background: #f2faff;
}

.azkinews-gift__coupon {
  display: grid;
  gap: .5rem;
  margin: .85rem 0;
  padding: .75rem;
  border: 1px dashed #075b96;
  border-radius: .75rem;
  background: #f0f9ff;
  text-align: center;
}

.azkinews-gift__coupon code { font-size: 1.15rem; overflow-wrap: anywhere; user-select: all; }
.azkinews-gift__body .azkinews-gift__feedback { margin: .65rem 0 0; }
.azkinews-gift__body .azkinews-gift__feedback:empty { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .azkinews-gift[data-motion="1"],
  .azkinews-gift[data-motion="1"] :is(.azkinews-gift__panel, .azkinews-gift__result) {
    animation: azkinews-gift-enter .22s ease-out both;
  }

  .azkinews-gift[data-motion="1"] .azkinews-gift__panel.is-closing {
    animation: azkinews-gift-enter .14s ease-in reverse both;
    pointer-events: none;
  }
}

@keyframes azkinews-gift-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.azkinews-gift__reminder {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: max-content;
  max-width: min(240px, calc(100vw - var(--gift-inset) - 16px));
  padding: .65rem .85rem;
  border: 1px solid #cce6fa;
  border-radius: .9rem;
  background: #fff;
  color: #153652;
  box-shadow: 0 6px 24px #15365218;
  font-size: .8125rem;
  font-weight: 700;
  pointer-events: none;
}
.azkinews-gift--right .azkinews-gift__reminder { left: auto; right: 0; }
.azkinews-gift__reminder::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 20px;
  width: 8px;
  height: 8px;
  background: #fff;
  border-right: 1px solid #cce6fa;
  border-bottom: 1px solid #cce6fa;
  transform: rotate(45deg);
}
.azkinews-gift--right .azkinews-gift__reminder::after { left: auto; right: 20px; }
/* A quiet notification dot and smooth floating motion while unclaimed. */
.azkinews-gift__launcher { position: relative; }
.azkinews-gift.has-pending-gift .azkinews-gift__launcher::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px #ef44441a;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .azkinews-gift[data-motion="1"].has-pending-gift .azkinews-gift__launcher {
    animation: azkinews-gift-float 5.5s ease-in-out infinite;
  }
  .azkinews-gift.has-pending-gift .azkinews-gift__launcher::after {
    animation: azkinews-gift-dot 3s ease-in-out infinite;
  }
}
@keyframes azkinews-gift-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes azkinews-gift-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 2px #ef44441a; }
  50% { opacity: .4; box-shadow: 0 0 0 5px #ef444400; }
}
