/* Premium checkout: FAB, checkout dialog, toast.
   Single source of truth for these components — do not duplicate
   .pc-* rules in other stylesheets.

   Deliberately reuses the app's own design tokens (--bg, --surface, --text,
   --accent, --line, --radius, --shadow, ...) defined in index-*.css, which
   both accrededu.ru and pwa.accrededu.ru already load before this file.
   No separate color system here — that's what caused the mismatch before. */

.pc-fab {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(28px, calc(16px + env(safe-area-inset-bottom)));
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px 0 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #fff;
  background: var(--accent-dark, #0d8b6c);
  box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, .15));
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.pc-fab:hover {
  background: var(--accent, #10a37f);
}

.pc-fab:active {
  transform: scale(.96);
}

.pc-fab[hidden] {
  display: none;
}

.pc-fab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .22);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .01em;
}

.pc-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(13, 13, 13, 0);
  backdrop-filter: blur(0);
  animation: pc-backdrop-in .22s ease forwards;
}

.pc-overlay.is-closing {
  animation: pc-backdrop-out .16s ease forwards;
}

@keyframes pc-backdrop-in {
  from { background: rgba(13, 13, 13, 0); backdrop-filter: blur(0); }
  to   { background: rgba(13, 13, 13, .48); backdrop-filter: blur(6px); }
}

@keyframes pc-backdrop-out {
  from { background: rgba(13, 13, 13, .48); backdrop-filter: blur(6px); }
  to   { background: rgba(13, 13, 13, 0); backdrop-filter: blur(0); }
}

.pc-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(86vh, 780px);
  overflow: hidden;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--radius, 16px);
  background: var(--surface, #fff);
  box-shadow: 0 24px 64px rgba(13, 13, 13, .22);
  transform: translateY(10px) scale(.98);
  opacity: 0;
  animation: pc-sheet-in .22s cubic-bezier(.2, .8, .2, 1) forwards;
}

.pc-overlay.is-closing .pc-sheet {
  animation: pc-sheet-out .16s ease forwards;
}

@keyframes pc-sheet-in {
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes pc-sheet-out {
  to { transform: translateY(10px) scale(.98); opacity: 0; }
}

.pc-grip {
  display: none;
}

.pc-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: 999px;
  color: var(--text, #0d0d0d);
  background: var(--surface, #fff);
  cursor: pointer;
}

.pc-close:hover {
  background: var(--surface-hover, #f3f3f3);
}

.pc-close svg {
  width: 14px;
  height: 14px;
}

.pc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 26px 26px 18px;
}

.pc-hero {
  position: relative;
  padding: 0 34px 0 0;
}

.pc-kicker {
  display: inline-block;
  color: var(--accent-dark, #0d8b6c);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.pc-hero h2 {
  margin: 6px 0 0;
  color: var(--text, #0d0d0d);
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -.01em;
}

.pc-hero p {
  margin: 8px 0 0;
  color: var(--muted, #707070);
  font-size: 13.5px;
  line-height: 1.5;
}

.pc-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.pc-benefit {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 104px;
  padding: 11px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--radius-sm, 10px);
  background: var(--surface-soft, #f9f9f9);
}

.pc-benefit-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--accent-dark, #0d8b6c);
  background: var(--accent-soft, #e6f7f1);
}

.pc-benefit-icon svg {
  width: 14px;
  height: 14px;
}

.pc-benefit strong {
  display: block;
  color: var(--text, #0d0d0d);
  font-size: 12.5px;
  line-height: 1.2;
}

.pc-benefit span {
  display: block;
  color: var(--muted, #707070);
  font-size: 11px;
  line-height: 1.3;
}

.pc-plans-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 8px;
}

.pc-plans-head strong {
  color: var(--text, #0d0d0d);
  font-size: 15px;
}

.pc-refresh {
  border: 0;
  padding: 4px;
  color: var(--accent-dark, #0d8b6c);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pc-plans {
  display: grid;
  gap: 8px;
}

.pc-plan {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px 12px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--radius-sm, 10px);
  background: var(--surface, #fff);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.pc-plan:hover {
  border-color: var(--line-strong, #d1d5db);
}

.pc-plan.is-selected {
  border-color: var(--accent, #10a37f);
  background: var(--accent-soft, #e6f7f1);
  box-shadow: inset 0 0 0 1px var(--accent, #10a37f);
}

.pc-plan-check {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong, #d1d5db);
  border-radius: 999px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}

.pc-plan.is-selected .pc-plan-check {
  border-color: var(--accent, #10a37f);
  background: var(--accent, #10a37f);
}

.pc-plan-check svg {
  width: 11px;
  height: 11px;
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .12s ease, transform .12s ease;
}

.pc-plan.is-selected .pc-plan-check svg {
  opacity: 1;
  transform: scale(1);
}

.pc-plan-top {
  grid-column: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pc-plan-title {
  display: grid;
  gap: 2px;
}

.pc-plan-title strong {
  color: var(--text, #0d0d0d);
  font-size: 14.5px;
}

.pc-plan-title span {
  color: var(--muted, #707070);
  font-size: 12.5px;
}

.pc-plan-price {
  text-align: right;
  white-space: nowrap;
}

.pc-plan-price strong {
  display: block;
  color: var(--text, #0d0d0d);
  font-size: 18px;
  line-height: 1.1;
}

.pc-badge {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--amber, #b45309);
  background: var(--amber-soft, #fffbeb);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.pc-plan-note {
  grid-column: 2;
  color: var(--muted, #707070);
  font-size: 12px;
  line-height: 1.3;
}

.pc-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid var(--red-soft, #fef2f2);
  border-radius: var(--radius-sm, 10px);
  color: var(--red, #dc2626);
  background: var(--red-soft, #fef2f2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.pc-error[hidden] {
  display: none;
}

.pc-loading,
.pc-empty {
  display: grid;
  place-items: center;
  min-height: 116px;
  padding: 20px;
  border: 1px dashed var(--line, #e5e5e5);
  border-radius: var(--radius-sm, 10px);
  color: var(--muted, #707070);
  font-size: 13.5px;
  text-align: center;
}

.pc-skeleton {
  display: grid;
  gap: 8px;
}

.pc-skeleton-row {
  height: 64px;
  border-radius: var(--radius-sm, 10px);
  background: linear-gradient(100deg, var(--surface-soft, #f9f9f9) 30%, var(--surface-hover, #f3f3f3) 50%, var(--surface-soft, #f9f9f9) 70%);
  background-size: 220% 100%;
  animation: pc-shimmer 1.3s ease-in-out infinite;
}

@keyframes pc-shimmer {
  0% { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}

.pc-method {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--radius-sm, 10px);
  background: var(--surface-soft, #f9f9f9);
}

.pc-method-mark {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 30px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent-dark, #0d8b6c);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}

.pc-method strong {
  display: block;
  color: var(--text, #0d0d0d);
  font-size: 13.5px;
}

.pc-method small {
  display: block;
  margin-top: 2px;
  color: var(--muted, #707070);
  font-size: 11.5px;
  line-height: 1.35;
}

.pc-foot {
  flex: none;
  display: grid;
  gap: 8px;
  padding: 16px 26px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #e5e5e5);
  background: var(--surface, #fff);
}

.pc-pay,
.pc-secondary {
  min-height: 46px;
  border-radius: var(--radius-sm, 10px);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
}

.pc-pay {
  border: 1px solid var(--accent-dark, #0d8b6c);
  color: #fff;
  background: var(--accent-dark, #0d8b6c);
  transition: background .12s ease, transform .12s ease;
}

.pc-pay:hover:not(:disabled) {
  background: var(--accent, #10a37f);
}

.pc-pay:active:not(:disabled) {
  transform: scale(.98);
}

.pc-pay:disabled {
  opacity: .5;
  cursor: default;
}

.pc-secondary {
  border: 1px solid var(--line, #e5e5e5);
  color: var(--text, #0d0d0d);
  background: var(--surface, #fff);
}

.pc-secondary:hover {
  background: var(--surface-hover, #f3f3f3);
}

.pc-toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, calc(16px + env(safe-area-inset-bottom)));
  z-index: 11000;
  transform: translateX(-50%) translateY(10px);
  width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--radius-sm, 10px);
  color: var(--text, #0d0d0d);
  background: var(--surface, #fff);
  box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, .12));
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  animation: pc-toast-in .2s ease forwards;
}

.pc-toast.is-leaving {
  animation: pc-toast-out .2s ease forwards;
}

@keyframes pc-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes pc-toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* Mobile: full-width bottom sheet instead of a centered dialog */
@media (max-width: 640px) {
  .pc-fab {
    bottom: max(158px, calc(146px + env(safe-area-inset-bottom)));
  }

  .pc-overlay {
    align-items: end;
    padding: 0;
  }

  .pc-sheet {
    width: 100%;
    max-height: 92dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    opacity: 1;
    animation: pc-sheet-in-mobile .28s cubic-bezier(.2, .8, .2, 1) forwards;
  }

  .pc-overlay.is-closing .pc-sheet {
    animation: pc-sheet-out-mobile .18s ease forwards;
  }

  @keyframes pc-sheet-in-mobile {
    to { transform: translateY(0); }
  }

  @keyframes pc-sheet-out-mobile {
    to { transform: translateY(100%); }
  }

  .pc-grip {
    display: block;
    width: 38px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 999px;
    background: var(--line-strong, #d1d5db);
    flex: none;
  }

  .pc-hero {
    padding: 10px 34px 0 0;
  }

  .pc-benefit span {
    display: none;
  }

  .pc-benefit {
    min-height: 78px;
  }
}

@media (max-width: 380px) {
  .pc-hero h2 {
    font-size: 22px;
  }

  .pc-plan-top {
    display: grid;
  }

  .pc-plan-price {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pc-overlay,
  .pc-sheet,
  .pc-toast,
  .pc-skeleton-row {
    animation: none !important;
    transition: none !important;
  }

  .pc-sheet {
    opacity: 1;
    transform: none;
  }
}
