.modal-overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(2, 6, 23, 0.72), rgba(2, 6, 23, 0.82)),
    rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeOverlay 0.25s ease;
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  width: min(900px, 90vw);
  height: min(90vh, 800px);
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(22px);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: modalIn 0.28s ease;
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 90px;
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.22), transparent 55%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 48%);
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  transition: 0.25s ease;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 24px 54px 18px 24px;
  background:
    radial-gradient(circle at top left, rgba(137, 34, 197, 0.22), transparent 55%),
    linear-gradient(rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.modal-title {
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--text);
}

.modal-subtitle {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.modal-complements {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px;
}

.modal-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  border-radius: 18px;
  margin-bottom: 14px;
}

.modal-group h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}

.modal-limit {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.complement-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 14px 14px 46px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: 0.22s ease;
  overflow: hidden;
}

.complement-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.complement-option span {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.complement-option small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.complement-option::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  transition: 0.22s ease;
}

.complement-option.checkbox::before {
  border-radius: 6px;
}

.complement-option:has(input:checked) {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(34, 197, 94, 0.06));
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.complement-option:has(input:checked)::before {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.complement-option:has(input:checked)::after {
  content: "✓";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-54%);
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background:
    radial-gradient(circle at top left, rgba(137, 34, 197, 0.22), transparent 55%),
    linear-gradient(rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.modal-footer .btn {
  min-width: 140px;
}

.order-summary-list {
  display: grid;
  gap: 12px;
}

.order-summary-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.order-summary-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 8px;
}

.order-summary-item h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.order-summary-item small {
  color: var(--muted);
  display: block;
  line-height: 1.5;
}

.order-summary-price {
  font-weight: 800;
  white-space: nowrap;
}

.order-summary-total {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
}

.order-summary-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.order-summary-total-row.final {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
}

.order-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.delivery-box {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  margin-top: 18px;
}

.delivery-box h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.delivery-box p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.delivery-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.delivery-actions .btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  border-color: transparent;
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.22);
}

.delivery-field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.delivery-field label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.delivery-field input,
.delivery-field textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.delivery-status {
  display: grid;
  gap: 8px;
}

.delivery-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.delivery-status-row strong {
  color: var(--text);
}

.delivery-status-row.error strong {
  color: #fca5a5;
}

@media (max-width: 640px) {
  .modal-card {
    width: 92vw;
    height: 88vh;
    border-radius: 24px;
  }

  .modal-header {
    padding: 18px 54px 14px 18px;
  }

  .modal-complements {
    padding: 14px 18px;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    padding: 14px 18px;
    flex-direction: column;
  }

  .modal-footer .btn,
  .delivery-actions .btn {
    width: 100%;
  }
}


.checkout-feedback {
  display: none;
  margin: 0 24px 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.checkout-feedback.show {
  display: block;
}

.checkout-feedback.error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.checkout-feedback.success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
  color: #dcfce7;
}

.order-modal-body {
  display: grid;
  gap: 18px;
}

.modal-card-order {
  width: min(980px, 94vw);
}

.transparent-checkout {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 16px;
}

.transparent-checkout-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.transparent-checkout-head h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.transparent-checkout-head p,
.transparent-checkout-status,
.payment-result {
  color: var(--muted);
  line-height: 1.5;
}

.transparent-checkout-status,
.payment-result {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.transparent-checkout-status.success,
.payment-result.success {
  border-color: rgba(34, 197, 94, 0.32);
  color: #c7f9d4;
}

.transparent-checkout-status.error,
.payment-result.error {
  border-color: rgba(239, 68, 68, 0.32);
  color: #fecaca;
}

.payment-result a {
  color: #c4b5fd;
  text-decoration: underline;
}

.payment-result img {
  max-width: 220px;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  margin-top: 12px;
  background: white;
  padding: 8px;
}

.payment-brick-container {
  min-height: 180px;
}

.order-modal-footer {
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .transparent-checkout-head {
    flex-direction: column;
  }

  .order-modal-footer .btn,
  .transparent-checkout-head .btn {
    width: 100%;
  }
}
