/* ==========================================================================
   DIGISAAT - CARRINHO LATERAL (MINI-CART), CHECKOUT & FEEDBACKS
   ========================================================================== */

/* Mini-Cart Drawer (Gaveta Lateral) */
.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cart-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: #ffffff;
  z-index: 2001;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer.open {
  right: 0;
}

.cart-drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-drawer-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close-drawer {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
}

.btn-close-drawer:hover {
  background: #f0f4f2;
  color: var(--color-text-dark);
}

.cart-drawer-items {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

.cart-empty-msg {
  text-align: center;
  color: var(--color-text-muted);
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cart-item-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.75rem 0;
  border-bottom: 1px solid #edf2ef;
  min-width: 0;
}

.cart-item-thumb {
  width: 65px;
  height: 65px;
  background: #f4f7f5;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.cart-item-thumb img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.cart-item-info h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.cart-item-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-green-logo);
}

.cart-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cart-item-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.cart-qty-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f5f2;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  gap: 0.5rem;
}

.cart-qty-pill button {
  background: #ffffff;
  border: 1px solid #d4dfd8;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-green-logo);
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cart-qty-pill button:hover {
  background: var(--color-green-logo);
  color: #ffffff;
  border-color: var(--color-green-logo);
}

.cart-qty-pill .qty-num {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-dark);
  min-width: 16px;
  text-align: center;
}

.btn-remove-item {
  background: #fbfdfc;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  color: #9aa8a0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-item:hover {
  color: #e53e3e;
  border-color: #fbcaca;
  background: #fff5f5;
}

.cart-drawer-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--color-border);
  background: #fafcfb;
}

.cart-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin-bottom: 1.2rem;
}

.btn-checkout-drawer {
  width: 100%;
  padding: 1rem;
  background: var(--color-green-btn);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-decoration: none;
  transition: var(--transition);
}

.btn-checkout-drawer:hover {
  background: var(--color-green-btn-hover);
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1b2621;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-notification.success {
  border-left: 4px solid var(--color-gold-logo);
}

/* Checkout Page Styles */
.checkout-wrapper, .checkout-page-wrapper {
  padding-top: 3rem;
  padding-bottom: 5rem;
  overflow-x: hidden;
  min-width: 0;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 3rem;
  align-items: flex-start;
  min-width: 0;
}

.checkout-box {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: 0 0 2rem;
  margin-bottom: 2rem;
}

.checkout-box-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text-title);
  margin-bottom: 1.35rem;
  display: block;
}

.form-group label,
.form-group .field-caption {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-body);
  margin: 0 0 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.7rem 0.2rem;
  border: none;
  border-bottom: 1px solid #c5d4cc;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: transparent;
}

.form-control:focus {
  border-color: #11171F;
  box-shadow: none;
}

.payment-methods-selector {
  display: flex;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5ece8;
}

.payment-card-opt {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.35rem 0 0.7rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: #73877c;
}

.payment-card-opt.active {
  border-bottom-color: #11171F;
  background: transparent;
  color: #11171F;
}

.order-summary-card {
  background: #fbfdfc;
  border: none;
  border-left: 1px solid var(--color-border);
  border-radius: 0;
  padding: 0 0 0 2rem;
  position: sticky;
  top: 100px;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1.5rem;
  row-gap: 1.75rem;
  align-items: start;
}

.checkout-wrapper .form-group {
  margin-bottom: 1.75rem;
  min-width: 0;
}

.checkout-wrapper .form-grid-2 > .form-group {
  margin-bottom: 0;
}

.cep-field-row {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  width: 100%;
}

.cep-field-row .form-control {
  flex: 1;
  min-width: 0;
}

.order-summary-items-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  max-height: 260px;
  overflow-y: auto;
}

.order-line-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.order-calc-table {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 1.2rem 0;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.92rem;
}

.order-calc-row {
  display: flex;
  justify-content: space-between;
  color: var(--color-text-body);
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text-dark);
}

.btn-finalize-order {
  width: 100%;
  padding: 1.1rem;
  background: var(--color-green-btn);
  color: #ffffff;
  border: none;
  border-radius: 0;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: none;
  transition: var(--transition);
}

.btn-finalize-order:hover {
  background: var(--color-green-btn-hover);
}

/* Success Confirmation Screen */
.success-screen-box {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  max-width: 680px;
  margin: 3rem auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.success-icon-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e8f5e9;
  color: #2e7d32;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem auto;
}

.success-screen-box h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--color-green-logo);
  margin-bottom: 0.8rem;
}

.order-number-tag {
  display: inline-block;
  background: #f0f4f2;
  padding: 0.4rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 1.5rem;
}

/* Frete e Calculadora Melhor Envio */
.shipping-calc-card {
  background: #fbfdfc;
  border: 1px dashed var(--color-border);
  border-radius: 0;
  padding: 1.2rem;
  margin-top: 1.75rem;
}

.shipping-calc-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-text-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.shipping-calc-input-group {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.6rem;
  margin-top: 0.5rem;
  width: 100%;
}

.shipping-calc-input-group .form-control {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.btn-calc-shipping {
  padding: 0 1.1rem;
  background: var(--color-green-btn);
  color: #ffffff;
  border: none;
  border-radius: 0;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  min-height: 2.5rem;
}

.btn-calc-shipping:hover {
  background: var(--color-green-logo);
}

.shipping-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.shipping-option-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  transition: var(--transition);
}

.shipping-option-item:hover,
.shipping-option-item.selected {
  border-color: var(--color-green-logo);
  background: #f7faf8;
}

.shipping-option-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shipping-option-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--color-text-dark);
}

.shipping-option-info span {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.shipping-option-price {
  font-weight: 800;
  color: var(--color-green-logo);
  font-size: 0.95rem;
}

/* Pagamento Pix e Cartão Transparente */
.pix-display-container {
  background: #fdfefe;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  margin-top: 1rem;
}

.pix-qrcode-img {
  width: 200px;
  height: 200px;
  margin: 1rem auto;
  border: 4px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-radius: 8px;
  display: block;
}

.pix-copy-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-copy-pix {
  background: var(--color-gold-logo);
  color: #1b2621;
  border: none;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.btn-copy-pix:hover {
  background: #dfba60;
}

/* =========================================================================
   Mercado Pago SDK JS v2 — Containers de Campos Seguros (PCI-DSS)
   Os iframes do MP s\u00e3o montados dentro desses containers.
   Devem ter altura e borda id\u00eanticas ao .form-control para alinhamento perfeito.
   ========================================================================= */
.container-mp-field {
  width: 100%;
  min-height: 46px;
  max-width: 100%;
  padding: 0;
  border: none;
  border-bottom: 1px solid #c5d4cc;
  border-radius: 0;
  background: transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* O iframe do MP \u00e9 injetado diretamente \u2014 ocupa 100% do container */
.container-mp-field iframe {
  width: 100% !important;
  height: 46px !important;
  border: none !important;
  display: block;
}

/* Estado de foco: replica o foco do .form-control */
.container-mp-field.mp-field-focused {
  border-color: var(--color-green-logo);
  box-shadow: 0 0 0 3px rgba(17, 23, 31, 0.1);
}

/* Mensagem de erro inline por campo */
.mp-field-error {
  font-size: 0.78rem;
  color: #c81e1e;
  margin-top: 0.25rem;
  min-height: 1rem;
  line-height: 1.3;
}

/* Badge de seguran\u00e7a PCI-DSS vis\u00edvel abaixo do formul\u00e1rio de cart\u00e3o */
.mp-pci-badge {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
  padding: 0;
  background: none;
  border: none;
}

.mp-pci-badge svg {
  color: var(--color-green-logo);
  flex-shrink: 0;
}

/* Spinner e Loader */
.spinner-inline {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   9. RESPONSIVIDADE COMPLETA DO CHECKOUT
   ========================================================================== */

@media (max-width: 1024px) {
  .checkout-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .order-summary-card {
    position: static;
    border-left: none;
    border-top: 1px solid var(--color-border);
    padding: 1.75rem 0 0;
  }
}

@media (max-width: 768px) {
  .checkout-page-wrapper,
  .checkout-wrapper {
    padding-top: 1.25rem;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 1.5rem;
  }

  .checkout-wrapper .form-group {
    margin-bottom: 1.5rem;
  }

  .cep-field-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cep-field-row .btn-calc-shipping {
    width: 100%;
    min-height: 2.75rem;
  }

  .shipping-calc-input-group {
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
  }

  .shipping-calc-input-group .btn-calc-shipping {
    width: auto;
    min-width: 6.5rem;
    flex: 0 0 auto;
  }

  .payment-methods-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
  }

  .shipping-option-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .shipping-option-price {
    align-self: flex-end;
  }

  .pix-copy-box {
    flex-direction: column;
  }

  .btn-copy-pix {
    width: 100%;
    justify-content: center;
  }

  .cielo-pan-head {
    flex-wrap: wrap;
  }

  .checkout-box-title {
    font-size: 1.05rem;
  }
}

@media (max-width: 480px) {
  .order-summary-card {
    position: static;
    padding-top: 1.35rem;
  }

  .btn-finalize-order {
    position: sticky;
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
    z-index: 20;
    width: 100%;
  }

  .form-control,
  body.heroui-chrome .checkout-wrapper input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
  body.heroui-chrome .checkout-wrapper select,
  body.heroui-chrome .checkout-wrapper textarea {
    font-size: 16px !important;
  }

  .container-mp-field {
    min-height: 2.75rem;
  }
}

.cielo-pan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.cielo-pan-head label {
  margin-bottom: 0;
}

.cielo-pan-brand {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: #11171F;
  min-height: 1.1em;
}

body.heroui-chrome .checkout-wrapper input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
body.heroui-chrome .checkout-wrapper select,
body.heroui-chrome .checkout-wrapper textarea {
  border: none !important;
  border-bottom: 1px solid #c5d4cc !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0.55rem 0.2rem 0.65rem !important;
  min-height: 2.5rem !important;
  line-height: 1.4 !important;
  box-sizing: border-box !important;
}

body.heroui-chrome .checkout-wrapper input:focus,
body.heroui-chrome .checkout-wrapper select:focus,
body.heroui-chrome .checkout-wrapper textarea:focus {
  border-color: #11171F !important;
  box-shadow: none !important;
}

.checkout-wrapper .input,
.checkout-wrapper .textarea {
  position: static !important;
}

#btn-submit-order,
.btn-finalize-order,
.btn-calc-shipping {
  border-radius: 0 !important;
}
