/* ══════════════════════════════════════════════════════════════════════════════
   MTG CART — Panel, Items, Footer, Budget Bar, Submit Modal
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Cart overlay (disabled — cart pushes content instead) ───────────────── */
.mtg-cart-overlay {
  display: none;
}

/* ── Cart panel ───────────────────────────────────────────────────────────── */
.mtg-cart-panel {
  position: sticky;
  top: 155px;
  width: 0;
  height: calc(100vh - 185px);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition:
    width 0.25s ease,
    opacity 0.25s ease;
  z-index: 50;
  background: #fff;
  display: flex;
  flex-direction: column;
  opacity: 0;
}
.mtg-cart-panel--open {
  width: 360px;
  opacity: 1;
}

/* ── Legacy table styles (kept for compatibility) ─────────────────────────── */
.mtg-cart-table {
  width: 100%;
  border-collapse: collapse;
}
.mtg-cart-table tr {
  border-bottom: 1px solid #f0f0f0;
}
.mtg-cart-table tr:last-child {
  border-bottom: none;
}
.mtg-cart-table td {
  padding: 8px 4px;
  vertical-align: middle;
}
.mtg-cart-img-cell img {
  width: 44px;
  border-radius: 4px;
  display: block;
}
.mtg-cart-info-cell {
  padding-left: 8px !important;
}
.mtg-cart-name {
  font-size: 13px;
  font-weight: 600;
  color: #111;
}
.mtg-cart-meta {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.mtg-cart-foil {
  color: #8a6010;
  margin-left: 4px;
}
.mtg-cart-price-cell {
  text-align: right;
  white-space: nowrap;
}
.mtg-cart-line {
  font-size: 14px;
  font-weight: 700;
  color: #1a7a3a;
}
.mtg-cart-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.mtg-cart-remove:hover {
  color: #c0392b;
  background: #fff0f0;
}

/* ── Cart header ──────────────────────────────────────────────────────────── */
.mtg-cart-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e8e0d8;
  background: #fff;
  color: #111;
  flex-shrink: 0;
  gap: 8px;
}
.mtg-cart-header-left {
  flex: 1;
}
.mtg-cart-title {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  display: block;
}
.mtg-cart-subtitle {
  font-size: 12px;
  color: #999;
}
.mtg-cart-clear {
  background: none;
  border: none;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  padding: 0 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mtg-cart-clear:hover {
  color: #c0392b;
}
.mtg-cart-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0 4px;
}
.mtg-cart-close:hover {
  color: #111;
}

/* ── Cart body ────────────────────────────────────────────────────────────── */
.mtg-cart-body {
  background: #faf7f2;
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.mtg-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 3rem 1rem;
  text-align: center;
}
.mtg-cart-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f0ece6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  color: #aaa;
}
.mtg-cart-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}
.mtg-cart-empty-sub {
  font-size: 13px;
  color: #aaa;
}

/* ── Cart items ───────────────────────────────────────────────────────────── */
.mtg-cart-item {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  background-color: var(--white);
  border-radius: 6px;
  margin-bottom: 10px;
  justify-content: space-between;
  gap: 10px;
}
.mtg-cart-item:last-child {
  border-bottom: none;
}
.mtg-ci-img img {
  min-width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.mtg-ci-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
  max-width: 120px;
  min-width: 0px;
}
.mtg-ci-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
}
.mtg-ci-name {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 200px;
}
.mtg-ci-set {
  text-transform: uppercase;
  font-size: 11px;
  color: #888;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mtg-ci-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.mtg-ci-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f0ece6;
  color: #666;
  font-weight: 500;
}
.mtg-ci-tag--foil {
  background: #fef9e7;
  color: #8a6010;
}

.mtg-ci-trash {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  border-radius: 4px;
}
.mtg-ci-trash:hover {
  color: #c0392b;
  background: #fff0f0;
}

.mtg-ci-price-row {
  display: flex;
  align-items: center;
  margin-top: 18px;
}
.mtg-ci-qty {
  font-size: 13px;
  color: #555;
}
.mtg-ci-dot {
  font-size: 12px;
  color: #ccc;
}
.mtg-ci-total {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}
.mtg-ci-unit {
  font-size: 11px;
  color: #aaa;
}
.mtg-ci-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

/* ── Cart footer ──────────────────────────────────────────────────────────── */
.mtg-cart-footer {
  border-top: 1px solid #e8e0d8;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
  background: #fff;
}

/* ── Budget bar ───────────────────────────────────────────────────────────── */
.mtg-budget-bar-wrap {
  margin-bottom: 4px;
}
.mtg-budget-label {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 4px;
}
.mtg-budget-bar {
  height: 4px;
  background: #e8e0d8;
  border-radius: 99px;
  overflow: hidden;
}
.mtg-budget-fill {
  height: 100%;
  background: #1a1a2e;
  border-radius: 99px;
  transition: width 0.3s;
}

/* ── Total and submit ─────────────────────────────────────────────────────── */
.mtg-cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 12px;
  font-size: 14px;
  color: #333;
}
.mtg-cart-total-row strong {
  font-size: 22px;
  font-weight: 800;
  color: #111;
}
.mtg-cart-submit {
  width: 100%;
  justify-content: center;
  height: 46px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  background: var(--darkBrown);
  border: none;
}
.mtg-cart-submit:hover {
  background: var(--lightBrown);
}
.mtg-cart-review-note {
  text-align: center;
  font-size: 11px;
  color: #aaa;
  margin-top: 8px;
}

/* ── Submit modal ─────────────────────────────────────────────────────────── */
.mtg-submit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: var(--font-sans);
}
.mtg-submit-inner {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.mtg-submit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}
.mtg-submit-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #aaa;
}
.mtg-submit-close:hover {
  color: #111;
}
.mtg-submit-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.mtg-submit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.mtg-submit-field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
}
.mtg-submit-field input {
  --has-height: 38px;
  --theme-form-field-padding: 0 12px;
  border: 1.5px solid #ddd;
  --theme-form-field-border-radius: 6px;
  --theme-form-font-size: 14px;
  --theme-form-text-initial-color: #111;
  transition: border-color 0.15s;
  --theme-form-field-border-style: none;
  border: 1px solid #ddd;
}
.mtg-submit-field input:focus {
  outline: none;
  border-color: #1a1a2e;
}
.mtg-submit-error {
  border-color: #c0392b !important;
}
.mtg-submit-msg {
  font-size: 12px;
  color: #c0392b;
  min-height: 16px;
  margin-bottom: 8px;
}
.mtg-submit-confirm {
  width: 100%;
  justify-content: center;
  height: 42px;
  font-size: 14px;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .mtg-cart-panel {
    position: absolute;
    top: 100%;
    right: 0;
  }
}
