/* ==========================================================================
   Pricing Page Specific Styles
   ========================================================================== */

/* ── Hero & Toggle ──────────────────────────────────────────────────────── */

.pricing-hero {
  padding-bottom: var(--space-4);
}

.pricing-hero__title {
  font-family: var(--font-family-body-heading);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: var(--letter-spacing-tight);
}

.pricing-hero__subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  max-width: var(--max-width-prose);
  margin: 0 auto var(--space-3);
  line-height: var(--line-height-relaxed);
}

.pricing-hero__support {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  max-width: var(--max-width-prose);
  margin: 0 auto var(--space-8);
  opacity: var(--opacity-80);
}

.pricing-billing-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.billing-toggle {
  display: inline-flex;
  position: relative;
  background: var(--surface-secondary);
  border: var(--border-width-base) solid var(--border-subtle);
  box-shadow: var(--shadow-inner);
  padding: var(--space-1);
  border-radius: var(--radius-full);
}

/* Sliding pill — positioned absolutely, moves via JS transform */
.billing-toggle__pill {
  position: absolute;
  top: var(--space-1);
  left: 0;
  border-radius: var(--radius-full);
  background: var(--surface-primary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base) var(--ease-spring),
    width var(--transition-base) cubic-bezier(0.34, 1.2, 0.64, 1);
  pointer-events: none;
  z-index: 0;
}

/* billing-toggle__btn styling removed; uses generic btn--toggle from components.css */

.billing-toggle__hint {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  opacity: var(--opacity-80);
}

.billing-toggle__save {
  display: inline-block;
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-normal).05em;
  text-transform: uppercase;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  vertical-align: middle;
  margin-left: var(--space-1);
  position: relative;
  top: -1px;
}

/* ── Price section transition when billing mode changes ─────────────────── */

/* Exit: triggered via JS before re-render */
.plan-col-header__price-wrap.price-exit,
.plan-col-header__price-wrap--enterprise.price-exit {
  animation: price-exit 0.14s ease forwards;
}

/* Enter: always plays on freshly rendered price sections */
.plan-col-header__price-wrap,
.plan-col-header__price-wrap--enterprise {
  animation: price-enter 0.22s ease;
}

@keyframes price-exit {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes price-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ── Pricing Plans Section ──────────────────────────────────────────────── */

.pricing-plans {
  padding-top: var(--space-12);
  padding-bottom: var(--space-16);
  padding-right: 2px; /* prevents overflow container clipping right borders */
  border-bottom: var(--border-width-base) solid var(--shadow-sm);
  overflow-x: auto;
}


/* ── Comparison table grid ──────────────────────────────────────────────── */

#plan-grid {
  width: 100%;
}

.plan-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  min-width: var(--layout-lg);
}

.plan-table th,
.plan-table td {
  padding: 0;
  margin: 0;
  vertical-align: top;
}

.plan-table__corner {
  border-bottom: none;
  background: var(--surface-primary);
  border-right: none;
}

/* ── Plan column headers ────────────────────────────────────────────────── */

.plan-col-header {
  background: var(--surface-primary);
  border: var(--border-width-base) solid var(--border-default);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6) var(--space-5) var(--space-4);
  position: sticky;
  top: 0;
  z-index: var(--z-index-raised);
  transition: box-shadow var(--transition-base);
}

/* Remove internal right borders — but keep them on the highlighted (Professional)
   and last (Enterprise, data-col=3) columns. Enterprise can't use :last-child
   because it's a flat grid where all rows are siblings. */
.plan-col-header:not(.plan-col-header--highlighted):not([data-col="3"]) {
  border-right: none;
}

.plan-col-header--highlighted {
  border: var(--border-width-lg) solid var(--border-default);
  border-bottom: none;
  box-shadow: var(--shadow-raised);
  background: var(--surface-primary);
}

.plan-col-header--capped {
  opacity: var(--opacity-50);
  pointer-events: none;
}

/* "Most popular" badge */
.plan-card__badge {
  position: absolute;
  top: calc(-1 * var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--font-size-xs);;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-normal).1em;
  padding: 0.3rem var(--space-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.plan-col-header__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.plan-col-header__name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

/* plan-col-header--highlighted name inherits ink — no override needed */

/* ── Band dropdown inside header ────────────────────────────────────────── */

.plan-col-header__users {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  /* Align CTA across columns — matches dropdown trigger height */
  min-height: var(--space-10);
  display: flex;
  align-items: center;
}

/* plan-col-header--highlighted users inherits token — no override needed */

/* full-width outlined dropdown */
.band-dropdown {
  display: block;
  width: 100%;
  position: relative;
  margin-bottom: var(--space-3);
}

.band-dropdown__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-primary);
  border: var(--border-width-md) solid var(--border-subtle);
  border-radius: var(--radius-base);
  font-family: var(--font-family-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  text-align: left;
}

/* band-dropdown on highlighted card now inherits standard styles */

.band-dropdown__trigger:hover,
.band-dropdown.is-open .band-dropdown__trigger {
  border-color: var(--border-focus);
}

.band-dropdown__chevron {
  flex-shrink: 0;
  margin-left: var(--space-1);
  transition: transform var(--transition-fast);
  color: var(--text-secondary);
}

.band-dropdown.is-open .band-dropdown__chevron {
  transform: rotate(180deg);
}

.band-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  background: var(--surface-primary);
  border: var(--border-width-base) solid var(--border-subtle);
  border-radius: var(--radius-base);
  box-shadow: var(--shadow-float);
  list-style: none;
  padding: var(--space-1) 0;
  margin: 0;
  z-index: var(--z-index-raised);
  max-height: 220px;
  overflow-y: auto;
}

.band-dropdown.is-open .band-dropdown__menu {
  display: block;
}

.band-dropdown__option {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.band-dropdown__option:hover {
  background: var(--surface-secondary);
  color: var(--text-link);
}

.band-dropdown__option.is-selected {
  color: var(--text-link);
  font-weight: var(--font-weight-bold);
}

.band-dropdown__option.is-selected::before {
  content: '• ';
}

/* ── Price display in header ────────────────────────────────────────────── */

.plan-col-header__price-wrap {
  margin-bottom: var(--space-3);
  flex: 1;
  /* grow to fill space — pins CTA at same Y across all columns */
}

.plan-col-header__price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.plan-col-header__price {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--line-height-none);
  letter-spacing: var(--letter-spacing-tighter);
}

/* plan-col-header--highlighted price — inherits --color-ink on white bg */

.plan-col-header__price-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  letter-spacing: var(--letter-spacing-normal);
}

/* plan-col-header--highlighted price-label — inherits on white bg */

.plan-col-header__price-annual {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

/* plan-col-header--highlighted price-annual — inherits on white bg */

.plan-col-header__price-period {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* plan-col-header--highlighted price-period — inherits on white bg */

/* "Custom pricing" prose for Enterprise */
.plan-col-header__price-wrap--enterprise {
  margin-bottom: var(--space-3);
  flex: 1;
}

.plan-col-header__price-enterprise {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--text-secondary);
}

/* plan-col-header--highlighted price-enterprise — inherits on white bg */

/* ── "Billed annually" green pill ───────────────────────────────────────── */

.billed-pill {
  display: inline-block;
  background: var(--color-badge-bg);
  border: var(--border-width-base) solid var(--border-default);
  color: var(--text-primary); /* Changed from mutated grey for better contrast */
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-normal).03em;
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  margin-right: 3px;
  vertical-align: middle;
}

/* plan-col-header--highlighted billed-pill — inherits neutral token on white bg */

/* ── Plan header CTA ────────────────────────────────────────────────────── */

.plan-col-header__cta {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: var(--space-3);
  /* Give the 3D box-shadow room — btn--primary has 0 var(--space-1) 0 0 bottom shadow */
  padding-bottom: var(--space-2);
}

/* ── Tagline below CTA in header ────────────────────────────────────────── */

.plan-col-header__tagline {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: var(--line-height-snug);
  margin: 0;
}

/* plan-col-header--highlighted tagline — inherits on white bg */

/* ── Comparison table cells ─────────────────────────────────────────────── */

.ptable__group-header {
  background: var(--surface-secondary);
  border-left: var(--border-width-base) solid var(--border-default);
  border-top: var(--border-width-base) solid var(--border-default);
  border-right: var(--border-width-base) solid var(--border-default);
  padding: var(--space-5) var(--space-5) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-normal).06em;
  text-align: left;
}

/* group header icons removed — text alone signals the category */

.ptable__group-header--highlighted {
  background: var(--surface-secondary);
  border-left: var(--border-width-lg) solid var(--border-default);
  border-right: var(--border-width-lg) solid var(--border-default);
}

.ptable__group-header--capped {
  opacity: var(--opacity-40);
}

.ptable__row-header {
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  background: var(--surface-primary);
  border-left: var(--border-width-base) solid var(--border-default);
  border-top: var(--border-width-base) solid var(--border-subtle);
  transition: background var(--transition-fast);
  text-align: left;
}

/* Feature rows */
.ptable__cell {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-left: var(--border-width-base) solid var(--border-default);
  border-top: var(--border-width-base) solid var(--border-subtle);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-snug);
  color: var(--text-secondary);
  background: var(--surface-primary);
  transition: background var(--transition-fast);
}

/* right edge on 4th column */
.ptable__cell[data-col="3"],
.ptable__group-header[data-col="3"] {
  border-right: var(--border-width-base) solid var(--border-default);
}

/* Bottom border on last row of last group — close the table */
/* But .ptable__cell handled its own left/top border */
.ptable__feature-row:last-child .ptable__cell,
.ptable__feature-row:last-child .ptable__row-header {
  border-bottom: var(--border-width-base) solid var(--border-default);
}

/* Alternate row shading every other set of 4 */
.ptable__cell:nth-child(8n+5),
.ptable__cell:nth-child(8n+6),
.ptable__cell:nth-child(8n+7),
.ptable__cell:nth-child(8n+8) {
  /* ptable__cell--unavailable check */
  background: var(--surface-secondary);
}

.ptable__cell--highlighted {
  background: var(--surface-primary);
  border-left: var(--border-width-lg) solid var(--border-default);
  border-right: var(--border-width-lg) solid var(--border-default);
}

.ptable__cell--unavailable .plan-col-header__check,
.ptable__cell--unavailable .feature-name {
  opacity: var(--opacity-40);
}

.ptable__cell--capped {
  opacity: var(--opacity-30);
  pointer-events: none;
}

/* Bottom CTA row */
.ptable__th-empty {
  border-top: none !important;
  border-left: none !important;
  background: transparent !important;
}

.ptable__cell--cta-footer {
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + var(--space-2));
  border-bottom: var(--border-width-base) solid var(--border-default);
  border-right: var(--border-width-base) solid var(--border-default);
  background: var(--surface-primary);
  /* Round ALL column bottom corners so each column reads as its own card */
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background-image: none !important;
}

.ptable__cell--cta-footer .plan-col-header__cta {
  margin-bottom: 0;
}

.ptable__cell--cta-footer--highlighted {
  background: var(--surface-primary) !important;
  border-left: var(--border-width-lg) solid var(--border-default) !important;
  border-right: var(--border-width-lg) solid var(--border-default) !important;
  border-bottom: var(--border-width-lg) solid var(--border-default) !important;
}

/* Left border on first column */
.ptable__cell--cta-footer[data-col="0"] {
  border-left: var(--border-width-base) solid var(--border-default);
}


/* ── Check icons ────────────────────────────────────────────────────────── */

.plan-col-header__check {
  color: var(--text-secondary); /* grey — status indicator, not interactive */
  flex-shrink: 0;
  margin-top: 2px;
}

/* Excluded feature cells — hidden checkmark + greyed label */
.ptable__cell--unavailable .plan-col-header__check {
  visibility: hidden;
}

.ptable__cell--unavailable .feature-name {
  color: var(--text-muted);
  opacity: var(--opacity-50);
}

/* Ensure unavailable features have enough contrast in dark mode and clear visual affordance */

/* ── Feature name + badge ───────────────────────────────────────────────── */

.feature-name {
  flex: 1;
  min-width: 0;
}

.feature-name--mobile-only {
  display: none;
}

.feature-badge {
  display: inline-block;
  margin-left: var(--space-1);
  padding: 1px var(--space-2);
  background: var(--color-badge-bg);
  border: var(--border-width-base) solid var(--border-default);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-normal).06em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── ⓘ Tooltip button ───────────────────────────────────────────────────── */

.feature-info {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 1px;
  color: var(--text-muted);
  cursor: help;
  margin-top: 1px;
  transition: color var(--transition-fast);
}

.feature-info:hover,
.feature-info:focus-visible {
  color: var(--text-link);
  outline: none;
}

.feature-info::after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-snug);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-base);
  width: 220px;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-index-sticky);
}

.feature-info::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: var(--border-width-2xl) solid transparent;
  border-top-color: var(--border-default);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-index-sticky);
}

.feature-info:hover::after,
.feature-info:hover::before,
.feature-info:focus-visible::after,
.feature-info:focus-visible::before {
  opacity: 1;
}

/* ── All Plans Include Band ─────────────────────────────────────────────── */

.pricing-includes {
  background: var(--surface-primary);
  border-bottom: var(--border-width-base) solid var(--border-default);
}

.includes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4) var(--space-6);
  list-style: none;
  padding: 0;
  margin: var(--space-8) auto 0;
}

.includes-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  background: var(--surface-secondary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
}

.includes-icon {
  color: var(--text-secondary); /* decorative — not interactive */
  display: flex;
  align-items: center;
}



@media (max-width: 1200px) {
  /* Show only 2 plan headers at a time; comparison rows show 2 cells */
  .ptable__cell[data-col="2"],
  .ptable__cell[data-col="3"],
  .plan-col-header[data-col="2"],
  .plan-col-header[data-col="3"] {
    display: none;
  }
}

@media (max-width: 768px) {
  .plan-table {
    min-width: 0;        /* cancels desktop var(--layout-lg) min — prevents forced horizontal scroll */
  }

  .plan-table__corner,
  .ptable__row-header,
  .ptable__th-empty {
    display: none !important;
  }

  .feature-name--mobile-only {
    display: inline;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
  }

  /* Hide all plan-col-headers at mobile — JS shows only the active one */
  .plan-col-header {
    display: none;
  }

  /* Hide all comparison cells by default — JS toggles visibility */
  .ptable__cell[data-col] {
    display: none;
  }

  /* Default visible column: col 0 (Starter) — JS overrides on tab switch */
  .ptable__cell[data-col="0"] {
    display: flex;
  }

  /* Show col 0 plan header by default */
  .plan-col-header[data-col="0"] {
    display: block;
  }

  .includes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pricing-hero__title {
    font-size: var(--font-size-2xl);
  }

  /* Mobile plan selector strip — shown above the comparison table */
  .pricing-plan-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    border: var(--border-width-base) solid var(--border-default);
    border-radius: var(--radius-full);
    padding: var(--space-1);
    background: var(--surface-secondary);
    margin-bottom: var(--space-6);
  }

  .pricing-plan-tabs::-webkit-scrollbar {
    display: none;
  }

  .pricing-plan-tab {
    flex: 1;
    min-width: 0;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition-base), color var(--transition-base);
    font-family: var(--font-family-body);
  }

  .pricing-plan-tab.is-active {
    background: var(--surface-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
  }

  .pricing-plan-tab:hover:not(.is-active) {
    color: var(--text-primary);
  }
}

@media (max-width: 480px) {
  .includes-grid {
    grid-template-columns: 1fr;
  }
}





/* ==========================================================================
   Dark mode overrides — pricing.css
   ========================================================================== */

/* Featured card — adapt for dark background */

/* MOST POPULAR badge — invert for dark background */

/* SAVE 20% badge — ink bg becomes white in dark mode; flip to white bg + dark text */

/* Featured card cells — adapt borders and backgrounds for dark mode.
   Uses explicit neutral greys because --color-surface and --color-surface-2
   both have a blue cast from the dark palette tokens. */

/* ── UI Consistency Phase 3 Sweep ── */
.pricing-hero__minimal {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pricing-hero__wrapper {
  margin-bottom: var(--space-8);
}

.pricing-trust {
  text-align: center;
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
}

.pricing-trust__text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.billing-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.pricing-audience-list {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-top: var(--space-4);
  padding-left: var(--space-6);
}

.pricing-audience-list li {
  margin-bottom: var(--space-2);
}

.pricing-cta-section {
  text-align: center;
}

.pricing-cta-section__title {
  color: var(--text-inverse);
  margin-bottom: var(--space-8);
}