/* =============================================================================
   Pedireito - Cart Drawer (lateral)
   ========================================================================== */
:root {
  --pcd-primary: #009739;
  --pcd-primary-hover: #007a2e;
  --pcd-accent: #ffcc07;
  --pcd-text: #111;
  --pcd-muted: #6b7280;
  --pcd-border: #e5e7eb;
  --pcd-bg: #ffffff;
  --pcd-bg-soft: #f8fafc;
  --pcd-danger: #dc2626;
  --pcd-radius: 8px;
  --pcd-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.pcd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.pcd-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.pcd-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 100%;
  max-width: 420px;
  background: var(--pcd-bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: var(--pcd-shadow);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--pcd-text);
}
.pcd-drawer.is-open {
  transform: translateX(0);
}

.pcd-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--pcd-border);
}
.pcd-drawer__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pcd-drawer__count {
  background: var(--pcd-primary);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 9px;
  font-weight: 600;
}
.pcd-drawer__close {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  color: var(--pcd-muted);
  padding: 4px 8px;
  border-radius: 6px;
}
.pcd-drawer__close:hover { background: var(--pcd-bg-soft); color: var(--pcd-text); }

.pcd-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 24px;
}

.pcd-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--pcd-muted);
}
.pcd-empty__icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.pcd-empty__text { font-size: 16px; margin-bottom: 20px; }
.pcd-empty__cta {
  display: inline-block;
  background: var(--pcd-primary);
  color: #fff;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: var(--pcd-radius);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
}
.pcd-empty__cta:hover { background: var(--pcd-primary-hover); }

.pcd-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--pcd-border);
  align-items: start;
}
.pcd-item:last-child { border-bottom: 0; }

.pcd-item__img {
  width: 80px;
  height: 80px;
  background: var(--pcd-bg-soft);
  border-radius: var(--pcd-radius);
  object-fit: contain;
  display: block;
}
.pcd-item__info {
  min-width: 0;
}
.pcd-item__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
  color: var(--pcd-text);
  text-decoration: none;
  display: block;
}
.pcd-item__title:hover { color: var(--pcd-primary); }
.pcd-item__variant {
  font-size: 12px;
  color: var(--pcd-muted);
  margin-bottom: 8px;
}
.pcd-item__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pcd-border);
  border-radius: var(--pcd-radius);
  overflow: hidden;
}
.pcd-item__qty button {
  width: 28px; height: 28px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  color: var(--pcd-text);
}
.pcd-item__qty button:hover { background: var(--pcd-bg-soft); }
.pcd-item__qty span {
  width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}
.pcd-item__right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.pcd-item__price {
  font-size: 14px;
  font-weight: 700;
}
.pcd-item__remove {
  background: transparent;
  border: 0;
  color: var(--pcd-danger);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.pcd-drawer__footer {
  border-top: 1px solid var(--pcd-border);
  padding: 20px 24px;
  background: #fff;
}
.pcd-drawer__totals {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.pcd-drawer__totals-label {
  font-size: 14px;
  color: var(--pcd-muted);
}
.pcd-drawer__totals-value {
  font-size: 22px;
  font-weight: 800;
}
.pcd-drawer__shipping {
  font-size: 12px;
  color: var(--pcd-muted);
  margin-bottom: 14px;
}
.pcd-drawer__checkout {
  display: block;
  width: 100%;
  background: var(--pcd-primary);
  color: #fff;
  text-align: center;
  text-decoration: none;
  padding: 16px;
  border-radius: var(--pcd-radius);
  font-weight: 700;
  font-size: 16px;
  border: 0;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.pcd-drawer__checkout:hover { background: var(--pcd-primary-hover); }
.pcd-drawer__checkout:active { transform: scale(0.98); }
.pcd-drawer__checkout[disabled] {
  background: var(--pcd-muted);
  cursor: not-allowed;
}

/* Floating cart bubble */
.pcd-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px; height: 56px;
  background: var(--pcd-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 151, 57, 0.4);
  z-index: 9990;
  border: 0;
  transition: transform 0.2s;
}
.pcd-bubble:hover { transform: scale(1.05); }
.pcd-bubble svg { width: 24px; height: 24px; }
.pcd-bubble__count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--pcd-accent);
  color: #000;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}
.pcd-bubble[hidden] { display: none !important; }

/* Toast */
.pcd-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #111;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--pcd-radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.pcd-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .pcd-drawer { max-width: 100%; }
  .pcd-bubble { bottom: 16px; right: 16px; }
}
