/* ==========================================================
   TFK Cart Disclosure
   ========================================================== */

.tfk-cart {
  position: relative;
  display: flex;
  justify-content: center;
}

.tfk-cart__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.tfk-cart__toggle[aria-expanded="true"] {
  color: var(--tfk-color-text);
  background: var(--tfk-color-surface-muted);
}

.tfk-cart__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/*
 * Preserve the proven visual appearance of the original
 * TheMAG Commerce cart counter without reusing the legacy
 * cart toggle selector.
 */
.tfk-cart__count {
  position: absolute;
  top: 0;
  right: -8px;
  display: block;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  color: #fff;
  background: #f44336;
  border: 0;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
}

.tfk-cart__panel {
  position: absolute;
  z-index: 1100;
  top: calc(100% + 0.5rem);
  inset-inline-end: 0;
  width: min(26rem, calc(100vw - 2rem));
  max-height: calc(100vh - 7rem);
  overflow: auto;
  color: var(--tfk-color-text);
  background: var(--tfk-color-surface-raised);
  border: 1px solid var(--tfk-color-border);
  border-radius: var(--tfk-radius-sm);
  box-shadow: var(--tfk-shadow-overlay);
}

.tfk-cart__panel[hidden] {
  display: none;
}

.tfk-cart__panel-inner {
  min-width: 0;
}

.tfk-cart__items {
  max-height: 50vh;
  padding: 0.75rem 1rem;
  overflow: auto;
}

.tfk-cart__items table {
  width: 100%;
  margin: 0;
  color: var(--tfk-color-text);
  font-size: 0.875rem;
}

.tfk-cart__items td,
.tfk-cart__items th {
  padding: 0.5rem;
  vertical-align: middle;
  border-color: var(--tfk-color-divider);
}

.tfk-cart__items img {
  width: auto;
  max-width: 4.5rem;
  height: auto;
}

.tfk-cart__empty {
  margin: 0;
  padding: 1rem;
  color: var(--tfk-color-text-muted);
  text-align: center;
}

.tfk-cart__links {
  border-top: 1px solid var(--tfk-color-divider);
}

.tfk-cart__links ul,
.tfk-cart__links ol {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tfk-cart__links li {
  display: block;
  margin: 0;
  padding: 0;
}

.tfk-cart__links a {
  display: block;
  padding: 0.8rem 1rem;
  color: var(--tfk-color-text);
  background: var(--tfk-color-surface-muted);
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition:
    color var(--tfk-duration-fast) var(--tfk-ease-standard),
    background-color var(--tfk-duration-fast) var(--tfk-ease-standard);
}

.tfk-cart__links a:hover {
  color: var(--tfk-color-heading);
  background: var(--tfk-color-surface-subtle);
}

.tfk-cart__links a + a,
.tfk-cart__links li + li a {
  border-top: 1px solid var(--tfk-color-divider);
}

@media (max-width: 575.98px) {
  .tfk-cart__panel {
    position: fixed;
    top: auto;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100vh - 2rem);
  }

  .tfk-cart__items {
    max-height: 55vh;
  }
}